/* ===========================================================================
   Stock Manager -- styles scoped to #viewStockManager.
   Reuses Watch Desk's existing design tokens (--color-*, --space-*, --radius-*,
   --text-*, --shadow-*) from base.css/style.css rather than introducing a new
   theme -- deliberately NOT the dark-sidebar look of the original artifact.
   All classes are prefixed `sm-` to avoid clashing with the rest of the app.
=========================================================================== */

/* The confirm dialog must always paint above the generic dynamic modal --
   both share the base .modal-overlay z-index (500), so bump this one so a
   confirm raised from inside an open edit/add modal (e.g. "Delete watch"
   clicked from within the watch-edit modal) is actually visible on top of
   it instead of being hidden underneath by DOM order. */
#smConfirmOverlay { z-index: 600; }

/* Quiet background-refresh indicator -- used instead of the loading-state
   spinner when a tab already has content on screen (e.g. after raising a
   receipt, adding stock, or the periodic background sync in app.js) so the
   view never blanks out or flashes; a slim bar along the top is the only
   sign a refresh happened. */
#smView { position: relative; }
#smView.sm-refreshing::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--color-primary);
  z-index: 5;
  animation: sm-refresh-sweep 1.1s ease-in-out infinite;
  transform-origin: left;
}
@keyframes sm-refresh-sweep {
  0% { transform: scaleX(0); opacity: 0.9; }
  50% { transform: scaleX(0.6); opacity: 0.6; }
  100% { transform: scaleX(1); opacity: 0; }
}

#viewStockManager .sm-page-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin: var(--space-4) 0 var(--space-6);
}

/* ---------- tiles / summary cards ---------- */
.sm-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.sm-tiles.sm-tiles-mini { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.sm-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: var(--space-4) var(--space-5);
  position: relative;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
}
.sm-tile.sm-tile-accent { border-top: 2px solid var(--color-brass); }
.sm-tile[draggable="true"] { cursor: grab; }
.sm-tile.sm-dragging { opacity: 0.4; }
.sm-tile-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.sm-tile-value {
  /* Was --text-xl (up to 2rem) -- large currency figures like
     \u00a3123,456.78 were wider than a 200px tile and overlapped its
     edges/neighbours. A smaller clamp plus wrap-safety keeps any figure
     (however wide) contained within the tile instead of overflowing it. */
  font-size: clamp(1.05rem, 0.9rem + 0.9vw, 1.4rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}
.sm-tile-value.sm-neg { color: var(--color-error); }
.sm-tile-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  overflow-wrap: anywhere;
}

/* ---------- generic card ---------- */
.sm-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  margin-bottom: var(--space-6);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sm-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  flex-wrap: wrap;
}
.sm-card-head h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: var(--text-lg); }
.sm-card-head .sm-spacer { flex: 1; }
.sm-card-body { padding: var(--space-5); }
.sm-card-note {
  padding: 0 var(--space-5) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.sm-two-col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-6);
  align-items: start;
}
/* Grid items default to min-width:auto (content-based), so a wide
   descendant like .sm-table (min-width:720px inside a scrollable
   .sm-table-wrap) would otherwise force the whole track -- and the
   viewport -- wider than the screen even though the table itself is
   meant to scroll internally. min-width:0 lets the track shrink to the
   container instead, so .sm-table-wrap's own overflow-x:auto does its job. */
.sm-two-col > * {
  min-width: 0;
}
@media (max-width: 900px) {
  .sm-two-col { grid-template-columns: 1fr; }
}

/* ---------- filters row ---------- */
.sm-filters {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}
.sm-search {
  flex: 1 1 240px;
  min-width: 180px;
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
}
.sm-ctl {
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
}
.sm-chip {
  padding: var(--space-1) var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
}
.sm-chip.sm-active { background: var(--color-primary); color: var(--color-primary-ink); border-color: var(--color-primary); }

/* ---------- table ---------- */
.sm-table-wrap { overflow-x: auto; }
.sm-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 190px; }
.sm-row-actions .btn { white-space: nowrap; }
.sm-table { width: 100%; min-width: 720px; font-size: var(--text-sm); border-collapse: collapse; }
.sm-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  font-weight: 800;
  border-bottom: 2px solid var(--color-divider);
  white-space: nowrap;
  cursor: default;
}
.sm-table th.sm-sortable { cursor: pointer; user-select: none; }
.sm-table th.sm-r, .sm-table td.sm-r { text-align: right; }
.sm-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}
.sm-table tr:last-child td { border-bottom: none; }
.sm-table tfoot td { font-weight: 800; background: var(--color-surface-2); }
.sm-table .sm-mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.sm-table .sm-num { font-variant-numeric: tabular-nums; }
.sm-table .sm-neg { color: var(--color-error); }
.sm-table .sm-pos { color: var(--color-success); }
.sm-cell-main { font-weight: 700; }
.sm-cell-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }
.sm-cell-sub.sm-age-warn { color: var(--color-warning); font-weight: 700; }
tr.sm-row-reserved td { background: color-mix(in oklab, var(--color-warning) 10%, transparent); }
tr.sm-row-hold td { background: color-mix(in oklab, var(--color-text-faint) 12%, transparent); }

.sm-empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--color-text-muted);
}
.sm-empty .sm-empty-title { font-weight: 800; color: var(--color-text); margin-bottom: var(--space-1); }

/* ---------- pills / badges ---------- */
.sm-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}
.sm-pill-instock { background: var(--color-success-highlight); color: var(--color-success); }
.sm-pill-sold { background: var(--color-sold-highlight); color: var(--color-sold); }
.sm-pill-reserved { background: var(--color-warning-highlight); color: var(--color-warning); }
.sm-pill-hold { background: var(--color-sold-highlight); color: var(--color-sold); }
.sm-pill-px { background: var(--color-brass-highlight); color: var(--color-brass); }
.sm-pill-purchase { background: var(--color-surface-2); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.sm-pill-safe { background: var(--color-warning-highlight); color: var(--color-warning); }
.sm-pill-banked { background: var(--color-success-highlight); color: var(--color-success); }
.sm-pill-auto { background: var(--color-surface-2); color: var(--color-text-faint); font-size: 10px; text-transform: uppercase; }
.sm-pill-in-premises { background: var(--color-success-highlight); color: var(--color-success); }
.sm-pill-departed { background: var(--color-surface-2); color: var(--color-text-muted); border: 1px solid var(--color-border); }
/* Asset Manager v2 (2026-09-15) -- distinct location-bucket pills so an
   off-site-with-watchmaker watch is never visually confused with a watch
   genuinely on the premises, and a live website listing is called out as
   its own state (Sam's explicit "full sweep" request). */
.sm-pill-loc-on-premises { background: var(--color-success-highlight); color: var(--color-success); }
.sm-pill-loc-offsite { background: var(--color-warning-highlight); color: var(--color-warning); }
.sm-pill-loc-live { background: var(--color-brass-highlight); color: var(--color-brass); }

/* ---------- Asset Manager ---------- */
.sm-asset-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  object-fit: cover;
  display: block;
  background: var(--color-surface-2);
}
.sm-asset-thumb-empty {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px dashed var(--color-border);
}
.sm-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--color-brass);
  text-decoration: underline;
  cursor: pointer;
}
.sm-link-btn:hover { color: var(--color-accent); }

/* ---------- banners ---------- */
.sm-banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-warning-highlight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}
.sm-banner.sm-red { background: var(--color-error-highlight); }
.sm-linklike {
  background: none; border: none; padding: 0; text-decoration: underline;
  color: inherit; font-weight: 700; cursor: pointer; font-size: inherit;
}

/* .sm-mission-band / .sm-mission-eyebrow / .sm-mission-text removed --
   the Stock Manager dashboard no longer renders its own mission block;
   the mission statement now lives in one app-wide slim top bar instead
   (see .app-mission-bar in style.css). */

/* ---------- forms inside Stock Manager modals ---------- */
.sm-fgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
@media (max-width: 640px) { .sm-fgrid { grid-template-columns: 1fr; } }
.sm-field { display: flex; flex-direction: column; gap: var(--space-1); }
.sm-field.sm-full { grid-column: 1 / -1; }
.sm-field label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sm-field input, .sm-field select, .sm-field textarea {
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: inherit;
}
.sm-field textarea { min-height: 64px; resize: vertical; }
.sm-hint { font-size: var(--text-xs); color: var(--color-text-faint); }
.sm-seg { display: flex; border: 2px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.sm-seg button {
  flex: 1; padding: var(--space-2) var(--space-3); border: none; background: var(--color-surface);
  color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700; cursor: pointer;
}
.sm-seg button.sm-active { background: var(--color-primary); color: var(--color-primary-ink); }
.sm-hidden { display: none !important; }

/* ---------- modal body inside the shared #smModal ---------- */
#smModal { max-width: 720px; width: 100%; }
#smModal.sm-wide { max-width: 980px; }
.sm-modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--space-5);
}
.sm-modal-actions .sm-spacer { flex: 1; }
.sm-preview-box {
  background: var(--color-brass-highlight);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

/* ---------- receipt preview (HTML mirror of the PDF) ---------- */
.sm-inv-sheet { max-width: 720px; margin: 0 auto; border: 1px solid var(--color-divider); background: #fff; color: #21252d; }
.sm-inv-head { background: #0e1014; color: #e8e4da; padding: 26px 36px; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.sm-inv-head img { max-height: 48px; max-width: 200px; object-fit: contain; }
.sm-inv-meta { text-align: right; font-size: 12px; color: #8e939c; }
.sm-inv-meta .sm-inv-no { color: #ede7da; font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.sm-inv-body { padding: 26px 36px 34px; }
.sm-inv-mission { text-align: center; font-style: italic; font-size: 12px; color: #8a8578; max-width: 520px; margin: 0 auto 18px; padding-bottom: 14px; border-bottom: 1px solid #ecead4; }
.sm-inv-cols { display: flex; justify-content: space-between; gap: 20px; font-size: 13px; margin-bottom: 18px; }
.sm-inv-cols h4 { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #9e7e3a; margin: 0 0 6px; }
.sm-inv-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 13px; }
.sm-inv-table th { border-bottom: 1px solid #21252d; text-align: left; padding: 6px; font-size: 10px; text-transform: uppercase; }
.sm-inv-table td { padding: 8px 6px; border-bottom: 1px solid #ecead4; }
.sm-inv-totals { margin-left: auto; width: 260px; font-size: 13px; }
.sm-inv-totals > div { display: flex; justify-content: space-between; padding: 4px 6px; }
.sm-inv-totals .sm-grand { border-top: 1px solid #21252d; font-weight: 700; font-size: 15px; margin-top: 4px; padding-top: 8px; }
.sm-inv-strip { display: flex; gap: 24px; background: #faf9f5; border: 1px solid #ecead4; border-radius: 8px; padding: 12px 16px; margin-top: 18px; font-size: 12px; }
.sm-inv-strip > div { flex: 1; }
.sm-inv-strip h4 { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: #9e7e3a; margin: 0 0 5px; }
.sm-pay-lines { line-height: 1.7; user-select: all; }
.sm-inv-foot { margin-top: 20px; font-size: 11px; color: #6e7278; line-height: 1.6; }
.sm-inv-footline { margin-top: 20px; text-align: center; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: #9e7e3a; }

/* ---------- trade calculator ---------- */
.sm-trade-offer { font-size: 32px; font-weight: 800; color: var(--color-brass); line-height: 1.15; }
.sm-trade-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.sm-trade-slider { width: 100%; accent-color: var(--color-brass); }

/* ---------- dashboard drag hint ---------- */
.sm-drag-hint { font-size: var(--text-xs); color: var(--color-text-faint); margin-bottom: var(--space-3); }

/* ---------- reports chart ---------- */
.sm-chart-box { padding: var(--space-4) var(--space-5); }

/* ---------- Incoming: DHL insured collection ---------- */
.sm-coll { display: flex; flex-direction: column; gap: 4px; min-width: 210px; }
.sm-coll-chip { align-self: flex-start; padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 700; border: 1px solid transparent; }
.sm-coll-warn { background: var(--color-warning-highlight); color: var(--color-warning); }
.sm-coll-bad { background: var(--color-error-highlight); color: var(--color-error); }
.sm-coll-info { background: var(--color-brass-highlight); color: var(--color-brass); }
.sm-coll-good { background: var(--color-success-highlight); color: var(--color-success); }
.sm-coll-neutral { background: var(--color-surface-2); color: var(--color-text-muted); border-color: var(--color-border); }
.sm-coll-head { font-size: var(--text-sm); font-weight: 700; color: var(--color-text); }
.sm-coll-line { font-size: var(--text-xs); color: var(--color-text-muted); }
.sm-coll-err { font-size: var(--text-xs); color: var(--color-error); }
.sm-coll-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 2px; }
.sm-coll-link, .sm-coll-deal { background: none; border: none; padding: 0; font: inherit; font-size: var(--text-xs); font-weight: 700; color: var(--color-brass); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.sm-coll-deal { color: var(--color-text-muted); }
.sm-coll-link:hover, .sm-coll-deal:hover { color: var(--color-primary); }
.sm-coll-cols { display: grid; grid-template-columns: minmax(250px, 300px) 1fr; gap: var(--space-5); margin-top: var(--space-4); }
@media (max-width: 760px) { .sm-coll-cols { grid-template-columns: 1fr; } }
.sm-coll-sec { font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: var(--space-2); }
.sm-coll-group { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); padding: var(--space-2) var(--space-3); }
.sm-coll-group-title { font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 4px; }
.sm-coll-group-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); padding: 3px 0; }
.sm-coll-group-row > span:first-of-type { flex: 1; }
.sm-coll-group-val { font-variant-numeric: tabular-nums; color: var(--color-text-muted); }
.sm-fgrid-tight { gap: var(--space-3); }
.sm-coll-picked { margin: var(--space-2) 0; font-size: var(--text-sm); }
.sm-coll-sandbox { margin-top: var(--space-4); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-warning-highlight); color: var(--color-warning); font-size: var(--text-sm); font-weight: 600; }
.sm-cal { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); padding: var(--space-3); }
.sm-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); font-size: var(--text-sm); }
.sm-cal-nav { width: 30px; height: 30px; border-radius: var(--radius-full); border: 1px solid var(--color-border); background: var(--color-surface-2); color: var(--color-text); font-size: 18px; line-height: 1; cursor: pointer; }
.sm-cal-nav:disabled { opacity: 0.35; cursor: default; }
.sm-cal-dow, .sm-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.sm-cal-dow span { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--color-text-faint); padding-bottom: 2px; }
.sm-cal-day { aspect-ratio: 1; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--color-surface-2); color: var(--color-text); font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.sm-cal-day:hover:not(.is-off) { border-color: var(--color-brass); }
.sm-cal-day.is-today { border-color: var(--color-border); }
.sm-cal-day.is-sel { background: var(--color-primary); color: var(--color-primary-ink); border-color: var(--color-primary); }
.sm-cal-day.is-off { background: transparent; color: var(--color-text-faint); opacity: 0.45; cursor: default; }
.sm-cal-blank { display: block; }
.sm-coll-done { text-align: center; padding: var(--space-3) 0; }
.sm-coll-tick { width: 48px; height: 48px; margin: 0 auto var(--space-3); border-radius: 50%; background: var(--color-success-highlight); color: var(--color-success); font-size: 24px; line-height: 48px; font-weight: 800; }
.sm-coll-done h4 { margin: 0 0 4px; font-size: var(--text-base); }
.sm-coll-ids { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-5); margin: var(--space-4) 0; }
.sm-coll-ids dt { font-size: var(--text-xs); text-transform: uppercase; color: var(--color-text-muted); font-weight: 700; }
.sm-coll-ids dd { margin: 2px 0 0; font-size: var(--text-sm); }

.sm-coll-mode { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); }
.sm-coll-mode-opt { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer; background: var(--color-surface); }
.sm-coll-mode-opt input { margin-top: 3px; accent-color: var(--color-primary); }
.sm-coll-mode-opt span { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm); }
.sm-coll-mode-opt small { color: var(--color-text-muted); font-size: var(--text-xs); }
.sm-coll-mode-opt.selected { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary) inset; }
@media (max-width: 640px) { .sm-coll-mode { grid-template-columns: 1fr; } }
.sm-coll-mode-opt input[type="radio"] { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 3px 0 0; border: 0; box-shadow: none; outline: none; background: transparent; flex: 0 0 auto; }
.sm-coll-mode-opt input[type="radio"]:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ==========================================================================
   Stock dashboard (Sam, 2026-10-13)
   Reuses the Quoting dashboard building blocks (.qv-hero, .qd-hub, .qd-tile, .qd-card, .qd-row, .qd-mini, .qd-act) so
   the two hubs look the same; only the Stock-specific pieces are styled here.
   ========================================================================== */
#viewStockManager.sd-page > .dd-page-header { display: none; }
#viewStockManager.sd-page .sm-page-actions { display: none; }
.sd-root .sd-hero::before {
  width: 72%; background: url('../assets/hero-stock.webp?v=20261014') right center / cover no-repeat;
}
.sd-root .qv-hero { margin-bottom: var(--space-5, 20px); }
.sd-banner { margin-bottom: var(--space-4, 16px); border-radius: 12px; }

/* key figures: the customisable, draggable tiles, restyled to sit inside a card */
.sd-figs { margin-bottom: 14px; }
.sd-figs .qd-card-h { margin-bottom: 14px; }
.sd-tiles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 0; }
.sd-tiles .sm-tile { background: #faf8f2; border-radius: 12px; box-shadow: none; padding: 12px 14px; }
.sd-tiles .sm-tile.sm-tile-accent { border-top: 1px solid var(--color-border); border-left: 3px solid #d4af6a; }
.sd-tiles .sm-tile-value { font-family: var(--font-display); font-size: clamp(1.15rem, 1rem + 0.7vw, 1.55rem); }
@media (hover: hover) and (pointer: fine) { .sd-tiles .sm-tile:hover { border-color: #d4af6a; } }
.sd-figs-foot { display: flex; justify-content: flex-end; margin-top: 12px; }

/* horizontal bars (ageing and brands) */
.sd-bars { display: grid; gap: 10px; }
.sd-bar { display: grid; grid-template-columns: minmax(84px, 128px) minmax(0, 1fr) auto; align-items: center; gap: 12px; min-width: 0; }
.sd-bar-l { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-bar-t { display: block; height: 10px; border-radius: 6px; background: #ece6d6; overflow: hidden; }
.sd-bar-t i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #b8923f, #e8c785); }
.sd-bar-v { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; min-width: 76px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-bar-v b { font-family: var(--font-display); font-size: 1rem; }
.sd-bar-v em { font-style: normal; font-size: 12px; color: var(--color-text-muted); }
.sd-bar.is-zero .sd-bar-l, .sd-bar.is-zero .sd-bar-v b { color: #b8b2a2; }
.sd-bar.is-late .sd-bar-t i { background: linear-gradient(90deg, #b94a48, #d98a87); }
.sd-bar.is-late .sd-bar-v b { color: #9b2c2c; }
.sd-note { margin: 12px 0 0; font-size: 12.5px; color: var(--color-text-muted); line-height: 1.4; }
.sd-mix-mini { margin: 16px 0 0; }

/* six-month profit columns */
.sd-trend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; height: 170px; margin-top: 4px; }
.sd-col { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px; height: 100%; min-width: 0; text-align: center; }
.sd-col-v { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-text); white-space: nowrap; }
.sd-col-bar { display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.sd-col-bar i { display: block; width: min(100%, 44px); border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #e8c785, #b8923f); opacity: 0.55; }
.sd-col.is-now .sd-col-bar i { opacity: 1; background: linear-gradient(180deg, #e8c785, #a67f2e); }
.sd-col.is-neg .sd-col-bar i { background: linear-gradient(180deg, #d98a87, #b94a48); }
.sd-col.is-neg .sd-col-v { color: #9b2c2c; }
.sd-col-m { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.sd-col.is-now .sd-col-m { color: #8a6d2a; }

/* row details */
.qd-days.is-warn { color: #8a6d2a; }
.qd-row:disabled { cursor: default; opacity: 0.7; }
.sd-profit { min-width: 56px; text-align: right; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; color: #2f6f47; }
.sd-profit.is-neg { color: #9b2c2c; }
.sd-cols-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sd-last { margin-bottom: 14px; }
.sd-last .qd-acts.sd-acts-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }

@media (max-width: 980px) {
  .sd-cols-even { grid-template-columns: minmax(0, 1fr); }
  .sd-last .qd-acts.sd-acts-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .sd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sd-bar { grid-template-columns: minmax(72px, 96px) minmax(0, 1fr) auto; gap: 8px; }
  .sd-trend { gap: 6px; }
  .sd-root .qv-hero { flex-wrap: wrap; }
}

/* ==========================================================================
   Watch stock overhaul (Sam, 2026-10-14): hero + refresh, order flags, card list.
   ========================================================================== */
.sw-root .qv-hero { margin-bottom: var(--space-5, 20px); }
.sw-root .qv-hero-actions { align-items: center; }
.sw-alert {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  background: var(--color-brass-highlight); border: 1px solid var(--color-brass); border-left-width: 4px;
  border-radius: 10px; padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5); font-size: var(--text-sm);
}
.sw-alert b { color: var(--color-text); }
.sw-tiles { margin-bottom: var(--space-5); }
.sw-bar { padding: var(--space-4); margin-bottom: var(--space-4); }
.sw-chiprow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.sw-count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px;
  background: rgba(0,0,0,0.08); font-size: 11px; font-weight: 700; text-align: center;
}
.sm-chip.sm-active .sw-count { background: rgba(255,255,255,0.22); }
.sw-list { display: flex; flex-direction: column; gap: var(--space-3); }
.sw-card {
  display: grid; grid-template-columns: 76px minmax(0, 1.3fr) minmax(250px, 1.1fr) minmax(0, 1fr) auto;
  gap: var(--space-4); align-items: center;
  background: var(--color-surface); border: 1px solid var(--color-border); border-left: 3px solid var(--color-border);
  border-radius: 12px; padding: var(--space-3) var(--space-4); box-shadow: var(--shadow-sm);
}
.sw-card.sw-reserved { border-left-color: var(--color-warning); }
.sw-card.sw-sold_order { border-left-color: var(--color-brass); background: linear-gradient(90deg, var(--color-brass-highlight), var(--color-surface) 45%); }
.sw-card.sw-on_hold { border-left-color: var(--color-sold); }
.sw-card.sw-in_stock { border-left-color: var(--color-success); }
.sw-thumb {
  width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--color-surface-2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sw-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sw-ph { display: flex; width: 34px; height: 34px; color: var(--color-text-faint); }
.sw-ph svg { width: 100%; height: 100%; }
.sw-title { font-weight: 700; font-size: var(--text-base); line-height: 1.25; color: var(--color-text); overflow-wrap: anywhere; }
.sw-meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.sw-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.sw-src { font-size: var(--text-xs); color: var(--color-text-muted); }
.sw-web, .sw-noweb, .sw-web-warn {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 999px; text-decoration: none; white-space: nowrap;
}
.sw-web { background: var(--color-brass-highlight); color: var(--color-brass); }
.sw-noweb { background: var(--color-surface-2); color: var(--color-text-faint); border: 1px solid var(--color-border); }
.sw-web-warn { background: var(--color-warning-highlight); color: var(--color-warning); }
.sw-figs { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; column-gap: 18px; row-gap: 6px; }
.sw-figs > div { min-width: 0; }
.sw-k { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--color-text-muted); }
.sw-figs b { font-size: var(--text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw-state { min-width: 0; }
.sw-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 4px; }
.sw-flag {
  font: inherit; font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; max-width: 100%;
  padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; line-height: 1.3; overflow-wrap: anywhere;
}
.sw-flag-res { background: var(--color-warning-highlight); color: var(--color-warning); border-color: var(--color-warning); }
.sw-flag-sold { background: var(--color-brass-highlight); color: var(--color-brass); border-color: var(--color-brass); }
.sw-flag:hover { filter: brightness(0.96); }
.sw-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; position: relative; }
.sw-more { position: relative; }
.sw-more > summary { list-style: none; cursor: pointer; }
.sw-more > summary::-webkit-details-marker { display: none; }
.sw-more-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; display: flex; flex-direction: column; gap: 4px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px; padding: 6px; box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.14));
}
.sw-more-menu .btn { justify-content: flex-start; width: 100%; }
.sw-foot {
  display: flex; flex-wrap: wrap; gap: var(--space-5); justify-content: flex-end; margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4); font-size: var(--text-sm); color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}
.sw-foot span:first-child { margin-right: auto; }
.sw-foot b { color: var(--color-text); font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) {
  .sw-card { grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr); }
  .sw-figs { grid-column: 2 / -1; }
  .sw-state { grid-column: 2 / 3; }
  .sw-actions { grid-column: 3 / 4; }
}
@media (max-width: 640px) {
  .sw-card { grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-3); }
  .sw-thumb { width: 64px; height: 64px; }
  .sw-figs, .sw-state, .sw-actions { grid-column: 1 / -1; }
  .sw-actions { justify-content: flex-start; }
  .sw-root .qv-hero-actions { width: 100%; }
}
.sw-figs .sm-neg { color: var(--color-error); }
.sw-figs .sm-age-warn { color: var(--color-warning); }
