/* ==========================================================================
   NEST SHELL AND WORKSPACES (November 2026 rebuild)

   Loaded AFTER site.css. site.css still holds the colours, buttons, cards,
   tables and form fields. This file adds the new pieces: the side menu, the
   Today screen, the consignor and sale workspaces, the roster and drop-off
   mode.

   Phone and tablet rules are at the very bottom.
   ========================================================================== */

/* ---- the shell: side menu on the left, page on the right ---------------- */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--card); border-right: 1px solid var(--line);
  padding: 14px 10px 14px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail .brand {
  display: flex; align-items: center; gap: 9px; padding: 2px 8px 12px;
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  color: var(--purple-deep); text-decoration: none;
}
.rail .brand img { height: 30px; }
.rail .grp {
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); padding: 12px 10px 3px;
}
.rail a.nav {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 11px; border-radius: 11px; min-height: 38px;
  font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  color: var(--ink); text-decoration: none;
}
.rail a.nav:hover { background: var(--bg); }
.rail a.nav.active { background: var(--card-2); color: var(--purple-deep); }
.badge {
  background: var(--danger); color: #fff; font-family: var(--font-body);
  font-weight: 800; font-size: 11.5px; border-radius: 999px; padding: 1px 8px;
}
.rail .me {
  margin-top: auto; border-top: 1px solid var(--line); padding: 12px 8px 0;
  font-size: 13px; color: var(--sub); display: grid; gap: 6px;
}
.rail .me strong { color: var(--ink); }
.rail .me button {
  background: none; border: none; padding: 0; text-align: left; cursor: pointer;
  font: inherit; color: var(--purple-deep); text-decoration: underline;
}

.content { min-width: 0; padding: 14px 22px 70px; }
.content-inner { max-width: 1180px; margin: 0 auto; }
.content-inner main { padding: 0; }

/* ---- top line: the find-anything box ------------------------------------ */
.topline { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.menu-btn { display: none; }
.find { position: relative; flex: 1; }
.find input[type="search"] {
  width: 100%; font-size: 15px; padding: 10px 18px; border-radius: 999px;
  border: 2px solid var(--line); background: #fff;
}
.find-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(70, 51, 94, .20); overflow: hidden;
}
.find-results a {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 16px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line);
}
.find-results a:last-child { border-bottom: none; }
.find-results a:hover, .find-results a.sel { background: var(--card-2); }
.find-results .fr-title { font-weight: 800; }
.find-results .fr-sub { font-size: 12.5px; color: var(--sub); text-align: right; }
.find-results .fr-all { font-weight: 700; color: var(--purple-deep); justify-content: center; }

/* ---- page heading with actions ------------------------------------------ */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px 18px; flex-wrap: wrap; margin-bottom: 14px;
}
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--sub); font-size: 14px; margin: 2px 0 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 13px; margin: 0 0 4px; color: var(--sub); }
.crumb a { color: var(--sub); }

/* ---- tabs (consignor and sale workspaces) ------------------------------- */
.tabs {
  display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.tabs a {
  padding: 9px 14px; font-family: var(--font-display); font-weight: 700; font-size: 14.5px;
  color: var(--sub); text-decoration: none; white-space: nowrap;
  border: 2px solid transparent; border-bottom: none; border-radius: 12px 12px 0 0; margin-bottom: -2px;
}
.tabs a:hover { color: var(--purple-deep); }
.tabs a.active { color: var(--purple-deep); background: var(--card); border-color: var(--line); border-bottom: 2px solid var(--card); }

/* ---- layout helpers (use these instead of inline grid styles) ------------ */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.grid-2 > .card, .grid-even > .card, .grid-3 > .card { margin-bottom: 0; }
.stack { display: grid; gap: 16px; }
.stack > .card { margin-bottom: 0; }
.gap-below { margin-bottom: 16px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; }
.narrow { max-width: 620px; }
.card h2 { margin-bottom: 10px; }
.inline-form { display: inline; }
.field-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.field-row .field { margin-bottom: 0; flex: 1; min-width: 150px; }

/* label / value pairs */
dl.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 16px; margin: 0; }
dl.kv dt { color: var(--sub); }
dl.kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* ---- messages ------------------------------------------------------------ */
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--mint);
  border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; font-weight: 700;
}
.flash::before { content: "\2713"; font-weight: 800; color: var(--mint-deep); }
.flash.flash-err { border-left-color: var(--danger); background: var(--danger-soft); }
.flash.flash-err::before { content: "!"; color: var(--danger); }
.flash.flash-info { border-left-color: var(--purple); }
.flash.flash-info::before { content: "i"; color: var(--purple-deep); }
.note-box { background: var(--gold-soft); border-radius: 12px; padding: 10px 14px; }
.note-box.bad { background: var(--danger-soft); }
.note-box.calm { background: var(--card-2); }

/* ---- chips (extra colours) ---------------------------------------------- */
.chip-warn { background: var(--gold-soft); color: var(--butter-ink); }
.chip-bad { background: var(--danger-soft); color: var(--danger-deep); }
.chip-info { background: var(--card-2); color: var(--purple-deep); }
.chip.plain::before { display: none; }

/* ---- Today screen -------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.stat { background: var(--card-2); border-radius: 12px; padding: 9px 12px; text-decoration: none; color: inherit; display: block; }
a.stat:hover { outline: 2px solid var(--purple); }
.stat b {
  display: block; font-family: var(--font-display); font-size: 21px; line-height: 1.1;
  color: var(--purple-deep); font-variant-numeric: tabular-nums;
}
.stat.alert b { color: var(--danger-deep); }
.stat span { font-size: 12px; font-weight: 700; color: var(--sub); }
.bar { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--mint); border-radius: 999px; }
.bar.full i { background: var(--danger); }

.needs-list { display: grid; }
.needs-list > div {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.needs-list > div:first-child { border-top: none; }
.needs-list .what { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.needs-list .btn { flex: none; }
.btn { white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--danger); transform: translateY(-1px); }
.dot.warn { background: #E3B341; }
.dot.info { background: var(--purple); }
.activity-list { display: grid; }
.activity-list > div { padding: 8px 0; border-top: 1px solid var(--line); }
.activity-list > div:first-child { border-top: none; }
.activity-list .when { display: block; font-size: 12.5px; color: var(--sub); }

/* ---- filter pills -------------------------------------------------------- */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pill {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px;
  font-weight: 700; font-size: 13.5px; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.pill:hover { border-color: var(--purple); }
.pill.on { border-color: var(--purple); background: var(--purple); color: #fff; }
.pill .n { font-variant-numeric: tabular-nums; opacity: .8; margin-left: 4px; }

/* ---- pager ---------------------------------------------------------------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; font-size: 13.5px; color: var(--sub); }
.pager .pages { display: flex; gap: 4px; align-items: center; }
.pager a, .pager .cur { padding: 4px 10px; border-radius: 8px; text-decoration: none; font-weight: 700; }
.pager .cur { background: var(--purple); color: #fff; }
.pager a:hover { background: var(--card-2); }

/* ---- publish checklist ----------------------------------------------------- */
.checklist { display: grid; gap: 7px; }
.checklist > div { display: flex; gap: 9px; align-items: flex-start; }
.tickmark {
  width: 19px; height: 19px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: #fff; background: var(--mint-deep); margin-top: 1px;
}
.tickmark.block { background: var(--danger); }
.tickmark.warn { background: #C8961A; }

/* ---- schedule picture (one row per kind of event) --------------------------- */
.timeline { display: grid; gap: 5px; }
.timeline .tl-row { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 8px; align-items: center; }
.timeline .tl-label { font-size: 12.5px; font-weight: 700; color: var(--sub); }
.timeline .tl-track { position: relative; height: 18px; background: var(--bg); border-radius: 6px; }
.timeline .tl-block {
  position: absolute; top: 0; bottom: 0; min-width: 6px; border-radius: 6px; background: var(--purple);
}
.tl-block.dropoff { background: #E9C75E; }
.tl-block.presale { background: var(--pink); }
.tl-block.saleday { background: var(--mint); }
.tl-block.halfprice { background: var(--mint-deep); }
.tl-block.restock { background: var(--faint); }
.tl-block.checkpickup { background: var(--purple-deep); }
.tl-block.reg { background: var(--card-2); border: 2px solid var(--purple); }
.timeline .tl-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); padding-left: 126px; }
.tl-today { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--danger); }

/* ---- weekly bars (reports) -------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; height: 100%; min-width: 0; }
.bars .col i { display: block; width: 100%; max-width: 44px; background: var(--purple); border-radius: 6px 6px 0 0; min-height: 2px; }
.bars .col b { font-size: 12px; font-variant-numeric: tabular-nums; }
.bars .col span { font-size: 11px; color: var(--sub); white-space: nowrap; }

/* ---- an ordinary tick box (the default checkbox style is a toggle switch,
        which reads wrongly as "select this row") ------------------------------ */
input[type="checkbox"].tick {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--faint); background: #fff;
}
input[type="checkbox"].tick::after { display: none; }
input[type="checkbox"].tick:checked {
  background: var(--purple) url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22%3E%3Cpath fill=%22none%22 stroke=%22%23fff%22 stroke-width=%222.4%22 d=%22M3 8.5l3.2 3L13 4.5%22/%3E%3C/svg%3E") center/14px no-repeat;
  border-color: var(--purple);
}
label.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; cursor: pointer; }

/* ---- drop-off mode: big targets for a phone or tablet at the door ---------- */
.dropoff { max-width: 560px; margin: 0 auto; display: grid; gap: 12px; }
.dropoff .card { margin-bottom: 0; }
.btn-big { display: block; width: 100%; font-size: 17px; padding: 14px 20px; }
.dropoff input[type="search"] { font-size: 17px; padding: 14px 18px; border-radius: 14px; }
.dropoff .result { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 52px; }
.dropoff .result:first-child { border-top: none; }
#scanBox video { width: 100%; border-radius: 14px; background: #000; }

/* wide data tables: let long names wrap instead of forcing a sideways scroll */
table.grid td.wrap { white-space: normal; overflow-wrap: anywhere; }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid.tight td { padding: 6px 8px; }

/* a link that looks like a link inside a table row */
.rowlink { font-weight: 800; text-decoration: none; }
.rowlink:hover { text-decoration: underline; }

/* a button that looks like a plain link (for small actions inside text) */
.linkbtn { background: none; border: none; padding: 0; font: inherit; color: var(--purple-deep); text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--danger-deep); }

/* ---- printing (roster, payroll) --------------------------------------------- */
@media print {
  .rail, .topline, .tabs, .btn-row, .pills, .no-print, .savebar { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  body { background: #fff; font-size: 12px; }
}

/* ---- tablets and phones ------------------------------------------------------ */
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  /* the side menu becomes a drawer that slides in from the left */
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 60; height: auto;
    transform: translateX(-105%); transition: transform .18s ease;
    box-shadow: 0 0 40px rgba(70, 51, 94, .30);
  }
  body.menu-open .rail { transform: none; }
  body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 50; background: rgba(70, 51, 94, .45); }
  .menu-btn { display: inline-block; }
  .content { padding: 12px 14px 60px; }
  .grid-2, .grid-even, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .rail a.nav { min-height: 44px; }
}
@media (max-width: 620px) {
  h1 { font-size: 22px; }
  .card { padding: 14px 14px; border-radius: 14px; }
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 8px 14px; }
  dl.kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  dl.kv dt { margin-top: 8px; font-size: 12.5px; }
  .timeline .tl-row { grid-template-columns: 84px minmax(0, 1fr); }
  .timeline .tl-axis { padding-left: 92px; }
  .find input[type="search"] { font-size: 16px; }   /* 16px stops iPhones zooming in on focus */
  input[type="text"], input[type="number"], input[type="email"], input[type="password"],
  input[type="date"], input[type="datetime-local"], select, textarea { font-size: 16px; }
}

/* ---- sales by hour (Register/Live): one bar per hour ---------------------- */
.hours { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.hour { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.hour i { display: block; width: 100%; background: var(--purple); border-radius: 6px 6px 0 0; }
.hour .n { font-size: 12px; font-weight: 800; color: var(--purple-deep); }
.hour .l { font-size: 11px; color: var(--sub); white-space: nowrap; }

/* ---- pages whose tables need room (Sales rung up, Deposits, Register setup) ----
   Two columns only on a wide screen. On a laptop (1280 or 1366 wide) the two
   parts sit one above the other at full width, so no column is cut off. */
.grid-roomy { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-roomy > .card { margin-bottom: 0; }
/* On the narrow layout an opened sale comes first, above the list it was picked from. */
.grid-roomy.detail-open > .stack { order: -1; }
@media (min-width: 1500px) {
  .grid-roomy { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .grid-roomy.detail-open > .stack { order: 0; }
}
/* A stack never grows wider than the column it sits in (a wide table inside
   it scrolls in its own box instead of stretching the page). */
.stack { grid-template-columns: minmax(0, 1fr); }
/* The "hidden" attribute always hides, whatever display rule a class sets. */
[hidden] { display: none !important; }
