/* Buddy's Bakery, the back office, in the site's clothes. Direction: "Printed Menu, back of house".
   The public site (site/resources/css/site.css) is a printed menu: warm cream, Buddy's red, charcoal,
   a gold accent, PT Sans Narrow over Roboto, square bordered boxes, a double rule under a heading, a
   dotted leader between a name and its figure, a perforation where a ticket tears. This is the same
   vocabulary in a dense working register. The tokens carry the site's names so the two files can be
   read side by side. Red means a quantity going out or something that needs a person; it is also
   the brand, so it marks the current page and the one primary button. Gold is the wash on a row you
   were sent to, and the underline on a link. No motion. */

/* ---------- The site's faces, self-hosted (copied from site/public/assets/fonts) ---------- */

@font-face { font-family: 'PT Sans Narrow'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/pt-sans-narrow-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'PT Sans Narrow'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/pt-sans-narrow-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'PT Sans Narrow'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/pt-sans-narrow-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'PT Sans Narrow'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/pt-sans-narrow-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/roboto-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/roboto-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/roboto-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/roboto-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/roboto-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/roboto-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- The site's tokens, under the site's names ---------- */

:root {
  --color-primary: #871f29;           /* Buddy's red */
  --color-primary-content: #ffffff;
  --color-secondary: #272727;         /* charcoal */
  --color-secondary-content: #ffffff;
  --color-accent: #b08d57;            /* bakery gold */
  --color-neutral: #54595f;
  --color-base-100: #faf7f2;          /* warm cream, not white */
  --color-base-200: #f1ece3;
  --color-base-300: #e2dacc;
  --color-base-content: #272727;
  --color-info: #48719b;
  --color-success: #3a7d44;
  --color-warning: #d9a441;
  --color-error: #871f29;

  --font-display: "PT Sans Narrow", "Arial Narrow", sans-serif;
  --font-body: Roboto, "Helvetica Neue", Arial, sans-serif;

  /* the pale gold wash on a row a link sent you to */
  --mark: color-mix(in srgb, var(--color-accent) 22%, var(--color-base-100));
  /* the dotted leader, as the site draws it: current colour, mostly see-through */
  --leader: color-mix(in srgb, currentColor 40%, transparent);

  --rail-w: 212px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-base-100);
  color: var(--color-base-content);
  font: 13px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); }
h3 { margin: 14px 0 6px; font: 700 14px/1.3 var(--font-display); }

a {
  color: var(--color-base-content);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--color-primary); text-decoration-color: var(--color-primary); }
a:focus-visible, select:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Numbers. Roboto's figures are tabular and lining by default; this holds them to it. */
.num { font-variant-numeric: tabular-nums lining-nums; }

.soft { color: var(--color-neutral); }
.warn { color: var(--color-primary); }
.note { color: var(--color-neutral); }
.sub { display: block; font-size: 11.5px; color: var(--color-neutral); }

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Rail: the pages ---------- */

.rail {
  padding: 18px 14px 40px 18px;
  background: var(--color-base-200);
  border-right: 1px solid var(--color-base-300);
}

.rail-name { margin: 0 0 8px; }
.rail-name a { display: block; text-decoration: none; }
.rail-name img { display: block; width: 152px; height: auto; }

.rail-concept {
  margin: 0 0 22px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-neutral);
}

.rail-label {
  margin: 0 0 4px;
  font: 400 11.5px/1.3 var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-neutral);
}

.rail ol { margin: 0 0 20px; padding: 0; list-style: none; border-bottom: 1px solid var(--color-base-300); }

.rail li {
  padding: 4px 8px 4px 9px;
  border-top: 1px solid var(--color-base-300);
  border-left: 3px solid transparent;
}

.rail li a { color: var(--color-base-content); text-decoration: none; }
.rail li a:hover { text-decoration: underline; text-decoration-color: var(--color-accent); }
/* the current page, marked the way the site marks its active tab, turned on its side */
.rail li.here { border-left-color: var(--color-primary); }
.rail li.here a { color: var(--color-primary); font-weight: 500; }

.rail form { margin: 14px 0 0; }

/* ---------- Main ---------- */

.main { padding: 0 0 60px; min-width: 0; }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--color-base-300);
  font-size: 12px;
  color: var(--color-neutral);
}

.bar > div:last-child { margin-left: auto; }
.bar .crumbs span + span::before { content: "/"; margin: 0 7px; color: var(--color-accent); }
.bar strong { color: var(--color-base-content); font-weight: 500; }

.item { padding: 22px 20px 0; }

.item h1 {
  margin: 0;
  font: 700 28px/1.1 var(--font-display);
  letter-spacing: 0;
}

.item h1 .num { margin-left: 10px; font: 400 13px var(--font-body); color: var(--color-neutral); vertical-align: 3px; }

.item .status {
  margin-left: 10px;
  font: 400 12px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-neutral);
  vertical-align: 5px;
}
.item .status.warn { color: var(--color-primary); }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-neutral);
}

.facts li + li::before { content: "\00b7"; margin: 0 8px; color: var(--color-accent); }

/* On hand, by place: a ruled strip, the figures set like prices on a menu board. */

.onhand {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  margin: 18px 20px 0;
  border: 1px solid var(--color-base-300);
}

.onhand > div { padding: 10px 14px 11px; border-left: 1px solid var(--color-base-300); position: relative; }
.onhand > div:first-child { border-left: 0; }

.onhand dt {
  font: 400 11.5px/1.3 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-neutral);
}

.onhand dd { margin: 3px 0 0; }
.onhand .q { font: 700 26px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.onhand .total .q { font-size: 32px; }
.onhand .sub { margin-top: 2px; }
.onhand .open .q { color: var(--color-primary); }

/* ---------- Sections and tables ---------- */

.sec { margin: 26px 20px 0; }

/* The heading sits on the site's double rule. */
.sec-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  margin-bottom: 11px;
  padding-bottom: 5px;
  border-bottom: 1px solid currentColor;
}
.sec-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; border-top: 1px solid currentColor; }
.sec-head > * { min-width: 0; max-width: 100%; }
.sec-head p { margin: 0; }
.sec-head .note { font-size: 12.5px; max-width: 72ch; }

.sec h2 { margin: 0; font: 700 17px/1.2 var(--font-display); }
.sec .carried { margin: 0 0 8px; color: var(--color-neutral); max-width: 78ch; }
.sec > p.lead { margin: 0 0 8px; color: var(--color-neutral); max-width: 86ch; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; color: var(--color-neutral); }

.filters select {
  font: 12px var(--font-body);
  color: var(--color-base-content);
  background: var(--color-base-100);
  border: 1px solid var(--color-base-300);
  border-radius: 0;
  padding: 3px 6px;
  max-width: 100%;
}

.filters output { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--color-base-content); min-width: 25ch; text-align: right; }

.scroll { overflow-x: auto; border: 1px solid var(--color-base-300); }

table { border-collapse: collapse; width: 100%; }

th, td {
  padding: 4px 7px;
  text-align: left;
  vertical-align: baseline;
  white-space: nowrap;
  border-left: 1px solid var(--color-base-300);
  border-top: 1px solid var(--color-base-300);
}
th:first-child, td:first-child { border-left: 0; }

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 7px 5px;
  border-top: 0;
  border-bottom: 1px solid var(--color-neutral);
  background: var(--color-base-200);
  font: 400 11.5px/1.3 var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-neutral);
}

tbody tr:first-child td { border-top: 0; }
tbody tr:hover td { background: var(--color-base-200); }

.r { text-align: right; }
td.cause { white-space: normal; min-width: 20ch; color: var(--color-neutral); }
td.id { color: var(--color-neutral); }
td.b { color: var(--color-neutral); }
td.wrap { white-space: normal; min-width: 22ch; }

tr.reversal td { background: var(--color-base-200); }
tr[hidden] { display: none; }
tfoot td { border-top: 1px solid var(--color-neutral); font-weight: 500; background: var(--color-base-200); }

.lots td, .lots th { white-space: nowrap; }

/* The rail stays put while a long table scrolls past. */
@media (min-width: 821px) {
  .rail { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; }
}

/* ---------- Inventory dashboard, the plan, today ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.split .today { margin-left: 8px; }

.count { margin-left: 6px; font: 700 13px var(--font-display); color: var(--color-primary); }

/* A ruled list with a red margin: entries waiting to be dealt with. */
.attention ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: a;
  border: 1px solid var(--color-base-300);
}

.attention li {
  counter-increment: a;
  position: relative;
  padding: 7px 14px 7px 44px;
  border-top: 1px solid var(--color-base-300);
  line-height: 1.5;
}

.attention li:first-child { border-top: 0; }

.attention li::before {
  content: counter(a);
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  padding-top: 7px;
  text-align: center;
  font: 700 13px var(--font-display);
  color: var(--color-primary);
  border-right: 1px solid var(--color-primary);
}

.attention .act { color: var(--color-neutral); }
.attention strong { font-weight: 500; }

/* Key and value, with the site's dotted leader between them. */
.today dl, .kv { margin: 0; border: 1px solid var(--color-base-300); }
.today dl > div, .kv > div {
  display: grid;
  grid-template-columns: 38% 1fr;
  gap: 0 12px;
  align-items: baseline;
  padding: 7px 12px 8px;
  border-top: 1px solid var(--color-base-300);
}
.today dl > div:first-child, .kv > div:first-child { border-top: 0; }
.today dt, .kv dt { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--color-neutral); }
.today dt { font: 400 11.5px/1.3 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.today dt::after, .kv dt::after { content: ""; flex: 1; min-width: 12px; border-bottom: 2px dotted var(--leader); transform: translateY(-0.3em); }
.today dd, .kv dd { margin: 0; min-width: 0; }

#items td.z { color: color-mix(in srgb, var(--color-neutral) 50%, transparent); }
#items td.t { color: var(--color-base-content); font-weight: 500; }
#items td.unit { color: var(--color-neutral); }
#items td.note { white-space: normal; min-width: 24ch; }
#items tr.group th {
  position: static;
  padding-top: 12px;
  border-bottom: 1px solid var(--color-base-300);
  background: var(--color-base-100);
  font: 700 13px/1.3 var(--font-display);
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-base-content);
}
#items tr.group th + th { border-left: 0; }
#items tr.group th.num { font: 400 12px var(--font-body); }

.check { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Shared by the record screens (batch, order, transfer, run, account) ---------- */

.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.cols.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols > .sec + .sec { margin-left: 8px; }
/* A grid item's floor is its content's width unless told otherwise, and a wide table inside one
   would push the whole page out past a phone's edge; the table scrolls inside its box instead. */
.cols > .sec, .split > .sec { min-width: 0; }

/* What has happened to this record, in order: the docket's stub, torn along the site's perforation. */
.steps {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  margin: 18px 20px 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-base-300);
  border-top: 1px dashed var(--color-neutral);
}
.steps::before, .steps::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-base-100);
}
.steps::before { left: -7px; }
.steps::after { right: -7px; }
.sec > .steps { margin-left: 0; margin-right: 0; }

.steps li { flex: 1 1 0; min-width: 130px; padding: 8px 12px 9px; border-left: 1px solid var(--color-base-300); }
.steps li:first-child { border-left: 0; }
.steps .what { display: block; font: 700 13.5px/1.3 var(--font-display); letter-spacing: 0.02em; }
.steps .when { display: block; font-size: 11.5px; color: var(--color-neutral); font-variant-numeric: tabular-nums; }
.steps .who { display: block; font-size: 11.5px; color: var(--color-neutral); }
.steps li.todo .what { font-weight: 400; color: var(--color-neutral); }

/* ---------- Map of the operation ---------- */

.opmap { margin: 18px 20px 0; border: 1px solid var(--color-base-300); }
.opmap svg { display: block; width: 100%; height: auto; }
.opmap rect { fill: var(--color-base-100); stroke: var(--color-neutral); stroke-width: 1; }
.opmap rect.hub { fill: var(--color-base-200); stroke: var(--color-base-content); stroke-width: 1.5; }
.opmap a:hover rect { stroke: var(--color-primary); stroke-width: 2; }
.opmap text { font-family: var(--font-body); font-size: 13px; fill: var(--color-base-content); }
.opmap text.t { font-weight: 500; }
.opmap text.n { font-size: 11.5px; fill: var(--color-neutral); font-variant-numeric: tabular-nums; }
.opmap text.warn { fill: var(--color-primary); }
.opmap text.band { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; fill: var(--color-neutral); }
.opmap path { fill: none; stroke: var(--color-neutral); stroke-width: 1.2; }
.opmap path.money { stroke-dasharray: 5 4; }
.opmap marker path { fill: var(--color-neutral); stroke: none; }
.opmap line.rule { stroke: var(--color-primary); stroke-width: 1; }

/* ---------- Arriving from a link that points at one thing: mark it ---------- */

:target { scroll-margin-top: 80px; }
tr:target > td, tr:target > th { background: var(--mark); }
.onhand > div:target, .kv > div:target, .today dl > div:target, .attention li:target { background: var(--mark); }

/* ---------- Narrower windows ---------- */

@media (max-width: 1000px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split .today { margin-left: 20px; }
  .cols, .cols.even { grid-template-columns: minmax(0, 1fr); }
  .cols > .sec + .sec { margin-left: 20px; }
}

@media (max-width: 820px) {
  .app { display: block; }
  .rail { border-right: 0; border-bottom: 1px solid var(--color-base-300); padding-bottom: 8px; }
  .rail ol { columns: 2; column-gap: 20px; }
  .rail li { break-inside: avoid; }
  .onhand { grid-template-columns: 1fr 1fr; }
  .onhand > div { border-top: 1px solid var(--color-base-300); }
  .onhand .total { grid-column: 1 / -1; border-top: 0; }
  .item, .bar { padding-left: 16px; padding-right: 16px; }
  .onhand, .sec, .steps, .opmap { margin-left: 16px; margin-right: 16px; }
  .cols > .sec + .sec, .split .today { margin-left: 16px; }
  .filters output { min-width: 0; }
}
