/*
    The warehouse handset.

    Every measurement here is decided by one fact: this is used one-handed, with gloves on, on a
    cheap Android phone, in a shed. So

      - nothing interactive is smaller than 56 px in its short dimension. A gloved thumb is about
        that wide, and the standard 44 px touch target is sized for a bare finger at a desk;
      - the primary action sits at the BOTTOM of the screen, where a thumb reaches without the hand
        regripping. A confirm button at the top is a dropped handset;
      - Confirm and Discard are never adjacent;
      - contrast is high and type is large, because the screen is being read in daylight through a
        scratched protector.

    Colours are the web client's, not a second palette.
*/

.wh-shell {
  --wh-ink: #0f172a;
  --wh-muted: #64748b;
  --wh-line: #cbd5e1;
  --wh-ok: #15803d;
  --wh-warn: #b45309;
  --wh-bad: #b91c1c;
  --wh-brand: #03173d;

  max-width: 720px;
  margin: 0 auto;
  padding: 0 12px 96px;
  color: var(--wh-ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- the bar that is always there ---- */

.wh-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--wh-line);
}

.wh-top__back {
  font-weight: 600;
  color: var(--wh-brand);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.wh-top__who {
  flex: 1;
  color: var(--wh-muted);
  font-size: 14px;
  text-align: right;
}

.wh-top__queue {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--wh-line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  font-size: 15px;
}

/* An attention badge is red and stays red. A queue that needs a person is the only thing on this
   screen allowed to shout. */
.wh-top__queue--attention {
  border-color: var(--wh-bad);
  background: var(--wh-bad);
  color: #fff;
}

.wh-banner {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 15px;
}

/* ---- the menu ---- */

.wh-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.wh-menu__task {
  min-height: 96px;
  border: 2px solid var(--wh-line);
  border-radius: 12px;
  background: #fff;
  font-size: 20px;
  font-weight: 600;
  color: var(--wh-ink);
}

.wh-menu__task--queue {
  grid-column: 1 / -1;
  min-height: 64px;
  font-size: 17px;
  color: var(--wh-muted);
}

.wh-freshness {
  margin-top: 20px;
  color: var(--wh-muted);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.wh-freshness__refresh,
.wh-freshness__send {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--wh-line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

/* ---- a task ---- */

.wh-task {
  padding-top: 12px;
}

.wh-task__title {
  margin: 0 0 12px;
  font-size: 24px;
}

.wh-empty {
  color: var(--wh-muted);
  padding: 20px 0;
}

.wh-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.wh-list__row {
  width: 100%;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--wh-line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.wh-list__no {
  font-weight: 700;
  font-size: 18px;
}

.wh-list__detail {
  color: var(--wh-muted);
  font-size: 14px;
}

/* ---- scanning ---- */

.wh-scan {
  margin: 16px 0;
}

.wh-scan__label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--wh-muted);
  margin-bottom: 6px;
}

.wh-scan__row {
  display: flex;
  gap: 8px;
}

/* 18px is not a style choice. Anything under 16px makes mobile Safari zoom the page on focus, and a
   zoomed page on a handset loses the confirm button off the bottom of the screen. */
.wh-scan__input {
  flex: 1;
  min-height: 56px;
  padding: 0 14px;
  border: 2px solid var(--wh-line);
  border-radius: 10px;
  font-size: 18px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  text-transform: uppercase;
}

.wh-scan__camera {
  min-width: 88px;
  min-height: 56px;
  border: 2px solid var(--wh-brand);
  border-radius: 10px;
  background: #fff;
  color: var(--wh-brand);
  font-weight: 600;
  font-size: 16px;
}

.wh-scan__camera:disabled {
  border-color: var(--wh-line);
  color: var(--wh-muted);
}

.wh-scan__camera--on {
  background: var(--wh-brand);
  color: #fff;
}

.wh-scan__video {
  width: 100%;
  max-height: 240px;
  margin-top: 8px;
  border-radius: 10px;
  background: #000;
  object-fit: cover;
}

.wh-scan__note {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--wh-muted);
}

/* ---- quantities ---- */

.wh-pad {
  margin: 16px 0;
}

.wh-pad__label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--wh-muted);
  margin-bottom: 6px;
}

.wh-pad__display {
  width: 100%;
  min-height: 64px;
  padding: 0 14px;
  border: 2px solid var(--wh-line);
  border-radius: 10px;
  font-size: 28px;
  font-weight: 700;
  text-align: right;
}

.wh-pad__expected {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--wh-muted);
}

.wh-pad__expected--differs {
  color: var(--wh-warn);
  font-weight: 600;
}

.wh-pad__variance {
  display: block;
}

.wh-pad__keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.wh-pad__key {
  min-height: 60px;
  border: 1px solid var(--wh-line);
  border-radius: 10px;
  background: #fff;
  font-size: 22px;
  font-weight: 600;
}

.wh-pad__key--back {
  grid-column: 3;
}

/* ---- instructions ---- */

.wh-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.wh-steps__step {
  border: 1px solid var(--wh-line);
  border-left: 6px solid var(--wh-brand);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.wh-steps__step--done {
  border-left-color: var(--wh-ok);
  opacity: 0.65;
}

.wh-steps__what {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 17px;
}

.wh-steps__count {
  color: var(--wh-muted);
  font-size: 14px;
}

.wh-steps__error {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--wh-bad);
  font-size: 15px;
}

.wh-steps__ok {
  margin: 6px 0 0;
  color: var(--wh-ok);
  font-weight: 600;
}

.wh-lines {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 15px;
}

.wh-lines th,
.wh-lines td {
  border-bottom: 1px solid var(--wh-line);
  padding: 10px 6px;
  text-align: left;
}

.wh-lines__qty {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wh-lines__row--differs {
  color: var(--wh-warn);
  font-weight: 600;
}

.wh-warning {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 14px;
}

/* ---- the commit ---- */

.wh-confirm {
  position: sticky;
  bottom: 12px;
  width: 100%;
  min-height: 68px;
  margin-top: 20px;
  border: none;
  border-radius: 12px;
  background: var(--wh-ok);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}

.wh-confirm:disabled {
  background: #e2e8f0;
  color: var(--wh-muted);
}

.wh-add {
  width: 100%;
  min-height: 56px;
  margin-top: 12px;
  border: 2px solid var(--wh-brand);
  border-radius: 10px;
  background: #fff;
  color: var(--wh-brand);
  font-size: 17px;
  font-weight: 600;
}

.wh-queued {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--wh-ok);
  font-weight: 600;
}

/* ---- the queue ---- */

.wh-outbox__list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.wh-outbox__entry {
  border: 1px solid var(--wh-line);
  border-left: 6px solid var(--wh-muted);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.wh-outbox__entry--applied {
  border-left-color: var(--wh-ok);
}

.wh-outbox__entry--rejected,
.wh-outbox__entry--needsattention {
  border-left-color: var(--wh-bad);
}

.wh-outbox__entry--blockedonsignin {
  border-left-color: var(--wh-warn);
}

.wh-outbox__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.wh-outbox__state {
  white-space: nowrap;
  color: var(--wh-muted);
  font-size: 14px;
}

.wh-outbox__meta {
  margin-top: 4px;
  color: var(--wh-muted);
  font-size: 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.wh-outbox__reason {
  margin: 8px 0 0;
  font-size: 15px;
}

.wh-outbox__actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.wh-outbox__release {
  flex: 1;
  min-height: 56px;
  border: 2px solid var(--wh-brand);
  border-radius: 10px;
  background: #fff;
  color: var(--wh-brand);
  font-weight: 600;
}

/* Deliberately narrower than Send again, and on the far side of a gap. These two were adjacent and
   the same size in the first arrangement, which on a one-handed grip is a queue emptied by a thumb. */
.wh-outbox__discard {
  min-width: 96px;
  min-height: 56px;
  border: 1px solid var(--wh-line);
  border-radius: 10px;
  background: #fff;
  color: var(--wh-bad);
}

/* ---- the update bar, which is plain HTML in index.html rather than Blazor ---- */

#nakala-update {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--wh-brand, #03173d);
  color: #fff;
  font: 15px/1.4 system-ui, sans-serif;
  box-shadow: 0 6px 24px rgb(0 0 0 / 25%);
}

#nakala-update button {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #03173d;
  font-weight: 700;
}
