/* Toolcrib
   Palette is a garage in low light: cast concrete, galvanised steel, chalk
   marks, and one hazard yellow reserved for the thing you scanned. */

:root {
  --concrete:  #26292C;   /* page */
  --steel:     #32363A;   /* raised surfaces */
  --steel-hi:  #3E4348;   /* pressed / hover */
  --galv:      #8D959B;   /* secondary text, hairlines */
  --chalk:     #EDEAE4;   /* primary text */
  --hazard:    #F2C230;   /* codes and the scan affordance. Nothing else. */
  --rust:      #B4553A;   /* destructive only */

  --hair: 1px solid rgba(141,149,155,.22);
  --pad: 16px;
  --radius: 4px;

  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--concrete);
  color: var(--chalk);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) var(--pad) 108px;
}

.boot { color: var(--galv); font-family: var(--mono); font-size: 13px; padding: 40px 0; }

/* ---------- type ---------- */

h1, h2, .eyebrow, .code {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0;
}

h1 { font-size: 30px; font-weight: 700; line-height: 1.05; }
h2 { font-size: 19px; font-weight: 600; color: var(--chalk); }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--galv);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 10px;
}
.eyebrow::after { content: ''; flex: 1; height: 1px; background: rgba(141,149,155,.22); }

.muted { color: var(--galv); }
.small { font-size: 13px; }

/* ---------- the signature: the stamped code chip ---------- */

.chip {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  background: var(--hazard);
  color: #1B1D1F;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .02em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.22);
}

.chip-lg { font-size: 46px; min-width: 86px; height: 66px; padding: 0 12px; line-height: 1; }
.chip-sm { font-size: 20px; min-width: 44px; height: 32px; padding: 0 8px; line-height: 1; }

@media (prefers-reduced-motion: no-preference) {
  .chip-lg { animation: stamp .22s cubic-bezier(.2,.9,.3,1.2) both; }
  @keyframes stamp {
    from { transform: scale(1.14); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
}

/* ---------- box header ---------- */

.boxhead { display: flex; gap: 14px; align-items: center; margin: 6px 0 4px; }
.boxhead .meta { min-width: 0; }
.boxhead h1 { word-break: break-word; }
.boxhead .sub { font-family: var(--mono); font-size: 12px; color: var(--galv); margin-top: 3px; }

/* ---------- controls ---------- */

input[type=text], input[type=search], input[type=email], input[type=number], textarea, select {
  width: 100%;
  background: var(--steel);
  border: var(--hair);
  border-radius: var(--radius);
  color: var(--chalk);
  font: inherit;
  padding: 13px 14px;
  min-height: 50px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--hazard);
  outline-offset: 2px;
}
::placeholder { color: #6E767C; }

.search-big { font-size: 19px; padding: 17px 14px; min-height: 60px; }

button, .btn {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 16px;
  font-weight: 600;
  background: var(--steel);
  color: var(--chalk);
  border: var(--hair);
  border-radius: var(--radius);
  padding: 13px 16px;
  min-height: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
button:active, .btn:active { background: var(--steel-hi); }
button[disabled] { opacity: .45; cursor: default; }

.btn-primary { background: var(--hazard); color: #1B1D1F; border-color: transparent; }
.btn-danger  { color: var(--rust); }
.btn-quiet   { background: transparent; }
.btn-full    { width: 100%; }
.btn-row     { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-row > * { flex: 1 1 auto; }

/* ---------- lists ---------- */

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

.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: var(--hair);
}
.list li:first-child { border-top: var(--hair); }

.list .name, .check .name { flex: 1; min-width: 0; }
.list .name b, .check .name b { font-weight: 500; display: block; word-break: break-word; }
.list .name span, .check .name span { font-size: 12px; color: var(--galv); font-family: var(--mono); }

.qty {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--galv);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

a.row { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }

.empty {
  border: 1px dashed rgba(141,149,155,.3);
  border-radius: var(--radius);
  padding: 22px 18px;
  color: var(--galv);
  font-size: 14px;
  text-align: center;
}

/* ---------- back link ---------- */

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; min-height: 30px; }
.topbar a, .topbar button {
  background: none; border: 0; padding: 4px 0; min-height: 0;
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em;
  color: var(--galv); text-transform: uppercase; text-decoration: none; cursor: pointer;
}

/* ---------- dock ---------- */

.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: rgba(38,41,44,.94);
  backdrop-filter: blur(10px);
  border-top: var(--hair);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.dock a, .dock button {
  flex: 1;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--galv);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 15px 4px;
  min-height: 54px;
  text-decoration: none;
}
.dock [aria-current='page'] { color: var(--hazard); box-shadow: inset 0 2px 0 var(--hazard); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%; bottom: 74px;
  transform: translateX(-50%);
  background: var(--steel-hi);
  border: var(--hair);
  border-left: 3px solid var(--hazard);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  max-width: min(420px, calc(100vw - 32px));
  z-index: 40;
}
.toast[data-tone='bad'] { border-left-color: var(--rust); }

/* ---------- editor rows ---------- */

.editrow { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: var(--hair); }
.editrow input[type=text] { min-height: 46px; }
.editrow input[type=number] { width: 68px; min-height: 46px; text-align: center; padding: 10px 4px; }
.editrow button { min-height: 46px; padding: 0 12px; }

/* Intake photos. A strip you can thumb along, tap for the full size. Square
   crops so the row stays level even though drawers are photographed every
   which way. */
.shots { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 2px; }
.shot { margin: 0; flex: none; width: 128px; }
.shot img {
  display: block;
  width: 128px; height: 128px;
  object-fit: cover;
  background: var(--steel);
  border: var(--hair);
  border-radius: var(--radius);
}
.shot figcaption {
  display: flex; gap: 10px; align-items: baseline;
  font-family: var(--mono); font-size: 11px; color: var(--galv);
  margin-top: 6px;
}

/* A word that behaves like a link but has to be a button to be honest about
   what it does. Undo the chunky button styling rather than fight it. */
.linky {
  background: none; border: 0; padding: 0; min-height: 0;
  font: inherit; text-transform: none; letter-spacing: 0;
  color: var(--rust); text-decoration: underline;
}
.linky:active { background: none; }

.check { display: flex; gap: 12px; align-items: center; padding: 12px 2px; border-bottom: var(--hair); }
.check input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--hazard); flex: none; }
.check input[type=text] { min-height: 44px; }

.field { margin-top: 14px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--galv);
  margin-bottom: 6px;
}

.spinner { color: var(--galv); font-family: var(--mono); font-size: 13px; padding: 20px 0; }

/* ---------- label sheet ---------- */

.labels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.label-card {
  background: #fff;
  color: #111;
  border-radius: 3px;
  padding: 10px;
  text-align: center;
  break-inside: avoid;
}
.label-card svg { width: 100%; height: auto; display: block; }
.label-card .lc-code {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  background: var(--hazard);
  border-radius: 2px;
  padding: 2px 0;
  margin-top: 6px;
  letter-spacing: .04em;
}
.label-card .lc-label {
  font-family: var(--body);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
  line-height: 1.2;
  word-break: break-word;
}

@media print {
  body { background: #fff; }
  .dock, .topbar, .no-print, .toast { display: none !important; }
  #app { padding: 0; max-width: none; }
  .labels { grid-template-columns: repeat(4, 1fr); gap: 6mm; }
  .label-card { border: 1px solid #ccc; }
}
