/* Warehouse screen. Built for someone nervous with computers: very big, very clear, very calm.
   Every size scales from the font size below. Body text is never smaller than 20px; buttons are at least 56px tall.
   Colour always comes with words:  green = add / confirm,  blue = take out / not urgent,  red = urgent / a problem,  grey = nothing to do. */
:root {
  --bg: #000;
  --panel: #161616;
  --line: #777;
  --text: #fff;
  --muted: #d6d6d6;
  --accent: #ffd400;
  --green: #3dff7a;
  --blue: #59a8ff;
  --red: #ff6b6b;
  --grey: #c4c4c4;
  font-size: 24px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; line-height: 1.35; }
h1 { margin: 0; font-size: 2rem; color: var(--accent); }
h1.plain { margin: 0.8rem 0; }
h2 { margin: 0 0 0.5rem; font-size: 1.7rem; }
h3 { margin: 1.2rem 0 0.4rem; font-size: 1.4rem; color: var(--grey); }
p { margin: 0.5rem 0; }
main { padding: 1rem 2rem 6rem; max-width: 80rem; }
main.narrow { max-width: 32rem; }
.big { font-size: 1.5rem; font-weight: bold; margin: 0.6rem 0; }
.small { font-size: 0.85rem; color: var(--muted); }
.bad { color: var(--red); }
.good { color: var(--green); }
:focus-visible { outline: 0.22rem solid var(--accent); outline-offset: 0.15rem; }
[hidden] { display: none !important; }

/* buttons */
.btn, .bigbtn, .bigname, .tick, .help { font: inherit; cursor: pointer; text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 56px; padding: 0.5rem 1.5rem; border-radius: 0.6rem; border: 0.15rem solid transparent; font-weight: bold; color: #000; }
.btn.green { background: var(--green); }
.btn.blue { background: var(--blue); }
.btn.red { background: var(--red); }
.btn.grey { background: var(--grey); }
.btn.quiet { background: transparent; color: var(--text); border-color: var(--line); font-weight: normal; }
.btn.small { font-size: 0.85rem; padding: 0.3rem 0.9rem; }
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: default; }
.choices { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.8rem 0; }
.back { margin: 0.8rem 0 0.4rem; }

/* top strip */
.strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 2rem; padding: 0.7rem 2rem; border-bottom: 0.25rem solid var(--accent); }
.clock { font-size: 3.4rem; font-weight: bold; line-height: 1; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; color: var(--accent); }
.countdown { font-size: 1.6rem; font-weight: bold; }
.who-box { display: flex; align-items: center; gap: 1rem; }
.signedin { display: flex; flex-direction: column; text-align: right; line-height: 1.15; }
.me { font-size: 1.7rem; }

/* banners */
.practice { background: #ffd400; color: #000; text-align: center; font-weight: bold; font-size: 1.4rem; padding: 0.6rem 1rem; border-bottom: 0.3rem solid #000; }
.offline { position: sticky; top: 0; z-index: 20; background: var(--red); color: #000; font-weight: bold; font-size: 1.2rem; padding: 0.7rem 2rem; }
.eod { background: var(--panel); border: 0.25rem solid var(--blue); border-radius: 0.8rem; margin: 1rem 2rem 0; padding: 0.4rem 1.5rem; }

/* who's using the app */
.who-screen { max-width: 60rem; margin: 0 auto; }
.who-screen h1 { font-size: 2.6rem; text-align: center; }
.bigname { display: block; width: 100%; min-height: 96px; border-radius: 0.9rem; border: 0.2rem solid var(--text); background: var(--panel); color: var(--text); font-size: 2rem; font-weight: bold; }
.bigname.featured { min-height: 180px; font-size: 3.6rem; background: var(--accent); color: #000; border-color: var(--accent); margin-bottom: 1.2rem; }
.bigname:hover { filter: brightness(1.2); }
.names { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }

/* home: two sides */
.home { display: grid; grid-template-columns: 1.25fr 1fr; gap: 2rem; max-width: none; align-items: start; }
.todos, .actions { min-width: 0; }
form { display: flex; flex-direction: column; gap: 0.5rem; }
input { font: inherit; font-size: 1.6rem; min-height: 64px; padding: 0.4rem 0.9rem; color: #000; background: #fff; border: 0.15rem solid var(--accent); border-radius: 0.5rem; width: 100%; }
.addjob { margin-bottom: 0.6rem; }
.field { display: flex; flex-direction: column; gap: 0.2rem; }
.field input { width: 9rem; }

.undo { display: flex; align-items: center; gap: 1.5rem; background: var(--panel); border: 0.2rem solid var(--green); border-radius: 0.6rem; padding: 0.5rem 1rem; margin: 0.5rem 0; }
.todo { display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--panel); border: 0.12rem solid var(--line); border-left-width: 0.7rem; border-radius: 0.6rem; padding: 0.7rem 1rem; margin: 0.7rem 0; }
.todo.red { border-left-color: var(--red); }
.todo.blue { border-left-color: var(--blue); }
.todo.suggested { border-style: dashed; border-left-style: solid; }
.todo .what { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.todo .title { font-size: 1.35rem; overflow-wrap: anywhere; }
.tag { font-size: 0.85rem; font-weight: bold; text-transform: uppercase; letter-spacing: 0.04em; }
.todo.red .tag { color: var(--red); }
.todo.blue .tag { color: var(--blue); }
.tick { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0.25rem solid var(--text); background: transparent; color: #000; font-size: 1.6rem; font-weight: bold; }
.tick:hover { background: #333; }
.tick.spacer { border: none; cursor: default; }
.tick.on { background: var(--grey); border-color: var(--grey); display: inline-flex; align-items: center; justify-content: center; }
.todo.done { cursor: pointer; border-left-color: var(--grey); color: var(--grey); background: #0d0d0d; }
.todo.done .title { text-decoration: line-through; }
.todo.done .tag { color: var(--grey); }

.find { margin-bottom: 0.5rem; }
.found { background: var(--panel); border: 0.12rem solid var(--line); border-radius: 0.6rem; padding: 0.5rem 1rem; margin: 0.6rem 0; }
.found h3 { margin: 0 0 0.3rem; color: var(--text); font-size: 1.3rem; }
.foundrow { display: flex; justify-content: space-between; gap: 1rem; font-size: 1.3rem; padding: 0.15rem 0; }
.bigbuttons { display: flex; flex-direction: column; gap: 1.3rem; margin: 1.5rem 0; }
.bigbtn { display: flex; flex-direction: column; justify-content: center; min-height: 110px; padding: 0.6rem 1.5rem; border-radius: 0.9rem; color: #000; border: 0.2rem solid transparent; }
.bigbtn.green { background: var(--green); } .bigbtn.blue { background: var(--blue); } .bigbtn.red { background: var(--red); }
.bigbtn:hover { filter: brightness(1.12); }
.bname { font-size: 2.2rem; font-weight: bold; }
.bhint { font-size: 0.9rem; }

/* settings, dialogs, help */
.card { background: var(--panel); border: 0.12rem solid var(--line); border-radius: 0.8rem; padding: 1rem 1.5rem; margin: 1.2rem 0; }
.dialog { max-width: 36rem; width: calc(100% - 2rem); background: var(--panel); color: var(--text); border: 0.25rem solid var(--accent); border-radius: 1rem; padding: 1.2rem 1.6rem; font-size: 1rem; }
.dialog::backdrop { background: rgba(0, 0, 0, 0.8); }
.help { position: fixed; right: 1rem; bottom: 1rem; min-height: 56px; padding: 0.3rem 1.3rem; background: #1e1e1e; color: var(--grey); border: 0.12rem solid var(--line); border-radius: 0.6rem; font-size: 0.85rem; opacity: 0.9; z-index: 10; }
.help:hover { color: var(--text); border-color: var(--text); }

/* activity */
.entry { display: grid; grid-template-columns: 11rem 8rem 1fr; gap: 0.2rem 1rem; padding: 0.7rem 0; border-top: 0.08rem solid #444; font-size: 1.1rem; }
.entry .when { color: var(--muted); }
.entry .who2 { font-weight: bold; color: var(--accent); }
#results:empty, #undo:empty, #eod:empty { display: none; }

/* narrow screens (phones, portrait): stack everything */
@media (max-width: 900px) {
  :root { font-size: 22px; }
  .home { grid-template-columns: 1fr; gap: 1rem; }
  .strip, main { padding-left: 1rem; padding-right: 1rem; }
  .eod { margin-left: 1rem; margin-right: 1rem; }
  .clock { font-size: 2.6rem; }
  .entry { grid-template-columns: 1fr; }
  .bigname.featured { min-height: 140px; font-size: 2.8rem; }
  .todo { flex-wrap: wrap; }
  .todo .what { flex: 1 1 8rem; min-width: 8rem; }
  .todo > .btn { flex: 1 1 100%; }
}

/* ===== Stage B: tiles, stock list, stock in ===== */
.bigbtn.grey { background: var(--grey); }
.bigbtn.off { opacity: 0.55; cursor: default; }
.filters, .find { margin: 0.6rem 0; }

.tile { position: relative; aspect-ratio: 1; border-radius: 0.7rem; overflow: hidden; display: flex; align-items: center; justify-content: center; text-align: center; flex: none; border: 0.12rem solid #000; }
.tile.big { width: 11rem; }
.tile.small { width: 8rem; }
.tilename.plain { font-weight: 900; line-height: 1.05; padding: 0.4rem; overflow-wrap: anywhere; }
.tile.big .tilename.plain { font-size: 1.8rem; }
.tile.small .tilename.plain { font-size: 1.3rem; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.withpic .tilename { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.78); color: #fff; font-weight: bold; font-size: 0.85rem; padding: 0.2rem 0.3rem; }

.prod { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; padding: 1rem 0 1rem 1rem; border-top: 0.08rem solid #444; border-left: 0.5rem solid transparent; margin-top: 0.4rem; }
.prod.attn-red { border-left-color: var(--red); }
.prod.attn-amber { border-left-color: #ffb000; }
.ptilelink { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; color: var(--text); text-decoration: none; max-width: 11rem; text-align: center; }
.vcards { display: flex; flex-wrap: wrap; gap: 1rem; flex: 1; min-width: 0; }
.vcard { width: 11rem; border: 0.3rem solid #444; border-radius: 0.8rem; background: var(--panel); padding: 0.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.vcard .vcount { text-align: center; }
.vcard .n { font-size: 2.4rem; font-weight: 900; }
.vcard .unit { font-size: 0.85rem; color: var(--muted); }
.vcard.needs.low { border-color: #ffb000; }
.vcard.needs.out, .vcard.needs.negative { border-color: var(--red); box-shadow: 0 0 0 0.2rem #fff3; }
.vcard.fine { border-color: #3a3a3a; }
.vcard.fine .tile { filter: grayscale(0.85) brightness(0.7); }
.vcard.fine .n { color: #cfcfcf; font-weight: 700; }
.status { width: 100%; text-align: center; font-weight: 900; border-radius: 0.45rem; padding: 0.3rem 0.2rem; }
.status.ok { color: var(--green); border: 0.12rem solid #1f6b3a; font-size: 1.1rem; }
.status.low { background: #ffb000; color: #000; font-size: 1.15rem; }
.status.banner { background: var(--red); color: #000; padding: 0.5rem 0.3rem; outline: 0.15rem solid #fff; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.bannertext { font-size: 1.6rem; line-height: 1.05; font-weight: 900; text-transform: uppercase; }
.bannersub { font-size: 0.9rem; font-weight: bold; }
.bannerimg { width: 100%; max-height: 5rem; object-fit: contain; border-radius: 0.3rem; }
.bannerpreview { max-width: 14rem; margin: 0.6rem 0; }
.attn-title { color: var(--red); font-size: 1.9rem; margin-top: 1.4rem; }
.fine-title { color: var(--grey); margin-top: 1.4rem; }

.ptiles { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 1rem 0; }
.ptilebtn { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--text); padding: 0.5rem; border: 0.2rem solid var(--green); border-radius: 0.8rem; background: var(--panel); }
.ptilebtn .tile.big { width: 12rem; }
.tapword { font-weight: bold; color: var(--green); }
.prodhead { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; margin: 0.8rem 0; }
.vrow { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; }
.vfields { flex: 1; min-width: 14rem; }
.vfields h3 { margin: 0 0 0.4rem; color: var(--text); }
.vtotal { align-self: end; font-size: 1.6rem; font-weight: bold; color: var(--green); min-height: 56px; display: flex; align-items: center; }
.field.wide input { width: 100%; max-width: 22rem; }
.big-add { font-size: 2rem; min-height: 84px; width: 100%; max-width: 24rem; }
.sum { font-size: 1.4rem; padding-left: 1.4rem; margin: 0.4rem 0 1rem; }
.sum li { margin: 0.3rem 0; }
.preview { display: block; max-width: 100%; max-height: 16rem; margin: 0.8rem auto; border-radius: 0.5rem; }
.practice-note { background: var(--accent); color: #000; font-weight: bold; font-size: 1.4rem; padding: 0.6rem 1rem; border-radius: 0.5rem; margin: 0.8rem 0; }
.dialog { max-height: 90vh; overflow: auto; }

/* narrow screens: Stage B parts (kept at the end so they win over the rules above) */
@media (max-width: 900px) {
  .prod { padding-left: 0.5rem; }
  .ptilelink { flex-direction: row; max-width: none; gap: 1rem; }
  .vcards { flex: 1 1 100%; }
  .vcard { width: calc(50% - 0.5rem); min-width: 9.5rem; }
  .tile.big { width: 9rem; }
  .ptilebtn .tile.big { width: 100%; max-width: 12rem; }
}

/* ===== Stage B part 2 ===== */
.btn.red { background: var(--red); }
.btn[aria-pressed="true"] { outline: 0.2rem solid #fff; }
.big-add.red, .big-add.blue, .big-add.green, .big-add.grey { width: 100%; max-width: 24rem; }
.ptilebtn.blue { border-color: var(--blue); } .ptilebtn.blue .tapword { color: var(--blue); }
.ptilebtn.red { border-color: var(--red); } .ptilebtn.red .tapword { color: var(--red); }
.ptilebtn.grey { border-color: var(--grey); } .ptilebtn.grey .tapword { color: var(--grey); }
.undo { margin: 0.5rem 0 1rem; }
.flavours { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.6rem 0; }
.flavourrow input { max-width: 26rem; }
.card.mismatch { border-color: var(--blue); border-width: 0.25rem; }
.card.loan { border-left: 0.7rem solid var(--blue); }
.card.loan.overdue { border-left-color: var(--red); border-color: var(--red); }
.card.loan.done { opacity: 0.6; border-left-color: var(--grey); }
.card.loan .btn { margin-top: 0.5rem; }
.tag.bad { color: var(--red); text-transform: uppercase; }
.todo.flagged { align-items: flex-start; }
.hiddenrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-top: 0.08rem solid #444; }
#results-panel .btn.big-add { margin-top: 1rem; }
.back { margin-right: 0.8rem; }
