/* lane.css — the two views.
 *
 * ONE STYLESHEET FOR BOTH, AND WHY
 * The advisor's phone and the porters' iPad show the same things — a request, a
 * person, how long something has been waiting — from opposite ends. If they had
 * separate stylesheets, "eleven minutes is orange" would eventually be true on
 * one screen and not the other, and the two people looking at them would be
 * having a disagreement the software caused. So the components are shared and
 * only the layout differs.
 *
 * THE SURFACE CLASS
 * `is-hand` and `is-desk` come from shared/device.js and mean "poked with a
 * finger" and "read with a mouse in reach". They are the only thing in here
 * that knows about hardware; everything else is composed from them.
 */

/* ---------------- shell ---------------- */

.lane-shell {
  max-width: 620px; margin: 0 auto; min-height: 100vh;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.lane-shell.is-wide { max-width: none; }

.lane-bar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 20;
}
.lane-bar .who { min-width: 0; }
.lane-bar .store { font-weight: 650; font-size: .9375rem; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-bar .state { color: var(--muted); font-size: .75rem; display: flex; align-items: center; gap: 6px; }
.lane-bar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.lane-body { padding: 14px 16px 28px; flex: 1; }

.waiting-badge {
  background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand);
  border-radius: 999px; padding: 4px 12px; font-weight: 650; font-size: .875rem;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------------- panels ---------------- */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 14px;
}
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { font-size: 1rem; }
.panel-note { margin-left: auto; color: var(--muted); font-size: .8125rem; }

/* ---------------- the one button ----------------
   Deliberately the largest thing on the advisor's screen. It is the only reason
   they opened the app. */

.ask {
  appearance: none; width: 100%; border: 0; cursor: pointer;
  background: var(--brand); color: var(--brand-ink);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 20px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font: inherit; font-size: 1.125rem; font-weight: 650;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform .05s ease-out, background-color .1s linear;
}
.ask:active { transform: scale(.985); background: #0d5395; }
.ask-plus {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgb(255 255 255 / .18); font-size: 1.4rem; line-height: 1; font-weight: 500;
}
@media (prefers-reduced-motion: reduce) { .ask:active { transform: none; } }

/* ---------------- the sheet ---------------- */

.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(19 26 36 / .42);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.sheet-card {
  background: var(--surface); width: 100%; max-width: 520px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 92vh; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.sheet-head h2 { font-size: 1.0625rem; }
.sheet-head .gear { margin-left: auto; }
.sheet-body { padding: 18px; }
.sheet-sub { color: var(--muted); font-size: .875rem; margin-bottom: 14px; }
body.sheet-open { overflow: hidden; }

.gear {
  appearance: none; background: none; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text-2);
  width: 38px; height: 38px; cursor: pointer; font-size: 1rem; line-height: 1;
  display: grid; place-items: center;
}
.gear:active { background: var(--surface-3); }

/* The three things an advisor can ask for. Stacked and large: this is a choice
   made while standing next to a customer, not a menu to be browsed. */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  appearance: none; text-align: left; cursor: pointer; font: inherit;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 3px;
  touch-action: manipulation;
}
.choice:active { background: var(--surface-3); }
.choice-label { font-size: 1.0625rem; font-weight: 650; }
.choice-sub { color: var(--muted); font-size: .8125rem; }

/* ---------------- steppers ----------------
   Two big targets and a number, because a <input type=number> raises a keyboard
   and a keyboard covers the button you are reaching for. */

.stepper {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.stepper-label { font-weight: 550; flex: 1; }
.stepper-btn {
  width: 52px; min-height: 52px; font-size: 1.5rem; justify-content: center; padding: 0;
  touch-action: manipulation;
}
.stepper-value {
  min-width: 108px; text-align: center; font-weight: 650; font-size: 1.0625rem;
}

/* ---------------- a request ----------------
 *
 * The left border carries the age. That is the whole colour system on this
 * screen: nothing else is tinted, so a row going orange is unmissable and means
 * exactly one thing. Tinting the whole card was tried in the loaner board and
 * rejected there for the same reason — a wall of coloured cards is a wall.
 */

.req-list, .col-list, .who-list { list-style: none; margin: 0; padding: 0; }
.req-list { display: flex; flex-direction: column; gap: 10px; }

.req {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
}
.req-ok   { border-left-color: var(--ok); }
.req-attn { border-left-color: var(--attn); }
.req-high { border-left-color: var(--high); }
.req-crit { border-left-color: var(--crit); }

/* A run somebody is already on reads as settled rather than urgent — it has
   been picked up, and the thing worth noticing on this screen is the ones that
   have not been. */
.req.is-running { background: var(--surface-2); }
/* Yours. A porter scanning the board needs to find their own runs instantly. */
.req.is-mine { box-shadow: inset 3px 0 0 var(--brand), var(--shadow); }

.req-head { display: flex; align-items: baseline; gap: 10px; }
.req-kind {
  font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted);
}
.req-big { font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.1; }
.req-age { margin-left: auto; color: var(--muted); font-weight: 600; font-size: .9375rem; }
.req-crit .req-age { color: var(--crit); }
.req-high .req-age { color: var(--high); }
.req-attn .req-age { color: var(--attn); }

.req-title { font-size: 1.0625rem; font-weight: 600; margin-top: 2px; }
.req-from, .req-detail { color: var(--text-2); font-size: .875rem; margin-top: 3px; }
.req-note {
  margin-top: 6px; font-size: .875rem; color: var(--text-2);
  background: var(--surface-3); border-radius: 6px; padding: 6px 9px;
}
.req-foot, .req-with {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; font-size: .875rem; color: var(--muted);
}
.req-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-tap { flex: 1; min-height: 52px; justify-content: center; font-size: 1rem; touch-action: manipulation; }
.btn-done { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 650; }
.btn-done:hover { background: #17573a; border-color: #17573a; }

/* ---------------- the porter columns ---------------- */

.columns { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .columns { grid-template-columns: repeat(3, 1fr); align-items: start; }
}

.col {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
}
.col-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.col-head h2 { font-size: .9375rem; }
.col-count {
  margin-left: auto; font-weight: 650; color: var(--muted);
  background: var(--surface-3); border-radius: 999px; padding: 1px 10px; font-size: .8125rem;
}
.col-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.col-list .empty { padding: 22px 8px; }

/* ---------------- the undo strip ---------------- */

.closed-strip {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--line);
}
.closed-chip {
  appearance: none; cursor: pointer; font: inherit; font-size: .8125rem;
  background: var(--surface); border: 1px dashed var(--line-strong);
  color: var(--muted); border-radius: 999px; padding: 6px 13px;
  touch-action: manipulation;
}
.closed-chip:active { background: var(--surface-3); color: var(--text); }

/* ---------------- who is on ---------------- */

.who-list { display: flex; flex-direction: column; }
.who-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.who-row:last-child { border-bottom: 0; }
/* Greyed out, and only greyed out — not hidden. An advisor needs to see that
   Jess exists and is on a shuttle, because "there is nobody" and "everybody is
   out" call for different decisions. */
.who-row.is-away { opacity: .55; }
.who-row.is-me .who-name { font-weight: 650; }
.who-row.is-me .who-desk { color: var(--brand); }

.who-id { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.who-desk { font-weight: 650; font-size: 1.0625rem; color: var(--text-2); }
.who-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-status { margin-left: auto; display: flex; align-items: center; gap: 9px; flex: none; }
.who-since { color: var(--muted); font-size: .8125rem; font-weight: 600; }

.presence-row { display: flex; gap: 8px; flex-wrap: wrap; }
.presence-btn { flex: 1; justify-content: center; min-height: 46px; touch-action: manipulation; }
.presence-btn.is-on {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 650;
}

/* ---------------- the porter view's status panel ----------------
 *
 * A drawer on a narrow screen and a permanent column on a wide one. The iPad in
 * the drive is wide, so in practice it is always up — but the same page opened
 * on a porter's phone must not lose it, and a drawer is how it stays reachable
 * without stealing half the width.
 */

.status-panel { display: none; }
body.status-open .status-panel {
  display: block; position: fixed; inset: 56px 0 0 auto;
  width: min(380px, 92vw); overflow-y: auto; z-index: 30;
  background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 14px;
}
@media (min-width: 1180px) {
  .lane-shell.is-wide { display: grid; grid-template-columns: 1fr 340px; grid-template-rows: auto 1fr; }
  .lane-shell.is-wide .lane-bar { grid-column: 1 / -1; }
  .lane-shell.is-wide .lane-body { grid-column: 1; }
  .lane-shell.is-wide .status-panel {
    display: block; grid-column: 2; position: static; width: auto;
    border-left: 1px solid var(--line); background: transparent; box-shadow: none;
    padding: 14px 16px 28px; overflow-y: visible;
  }
  #statusToggle { display: none; }
}

/* ---------------- the surface ----------------
   Everything above is the desk layout. `is-hand` scales the touch targets and
   the type that has to be read at arm's length; it does not move anything,
   because a layout that reflows between two screens is two layouts to maintain. */

body.is-hand .btn { min-height: 46px; }
body.is-hand .btn-tap { min-height: 58px; font-size: 1.0625rem; }
body.is-hand .req-big { font-size: 2rem; }
body.is-hand .closed-chip { padding: 9px 15px; }
body.is-hand .who-row { padding: 13px 0; }
