/* Production Flow Dashboard: styles. Light only: it is read on laptops and projectors. */
:root {
  --scale: 1;
  --surface: #ffffff;
  --page: #f4f4f1;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6c6b66;
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --accent: #1c5cab;
  /* The board's colours: status steps, fixed. */
  --plan: #9eda9e;
  --ok: #0ca30c;
  --late: #d03b3b;
  --warn: #fab219;
  --adv: #2a78d6;
  --unk: #b9b8b0;
  color-scheme: light;
}
html { font-size: calc(15px * var(--scale)); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.35;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h4 { margin: 0; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- header */
header.top {
  display: flex; flex-wrap: wrap; gap: .6rem 2rem; align-items: center; justify-content: space-between;
  padding: .8rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
h1 { font-size: 1.45rem; font-weight: 700; }
h1 .plant { color: var(--accent); }
.proto { margin: .25rem 0 0; color: var(--ink-2); }
.proto strong {
  background: #fff3d1; color: #5c4300; border: 1px solid #e3be5c;
  padding: .05rem .5rem; border-radius: 4px; margin-right: .4rem;
}
.asof-text b { color: var(--ink); }
.controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.controls label.asof { font-weight: 600; display: flex; gap: .4rem; align-items: center; }
.controls input[type=date] { padding: .3rem .4rem; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); }
button { cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: .35rem .8rem; }
button:hover { border-color: var(--ink-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #184f95; }
.zoom button { padding: .35rem .55rem; }
.zoom button + button { margin-left: .25rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* -------------------------------------------------------- loading and errors */
.progress { padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.pbar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; max-width: 40rem; }
.pbar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.pbar.busy span { width: 30% !important; animation: busy 1s linear infinite; }
@keyframes busy { from { margin-left: -30%; } to { margin-left: 100%; } }
.progress p { margin: .35rem 0 0; color: var(--ink-2); }
.errors { padding: .6rem 1.25rem; background: #fdecec; border-bottom: 1px solid #f0b3b3; color: #6d1414; }
.errors p { margin: .2rem 0; }
.exports { display: flex; flex-wrap: wrap; gap: .5rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); align-items: center; }
.exp { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; padding: .3rem .6rem; }
.exp b { font-weight: 600; }
.exp .tag { font-size: .8rem; font-weight: 700; color: #fff; background: var(--ink-2); border-radius: 4px; padding: 0 .4rem; }
.exp input[type=date] { border: 1px solid var(--line-2); border-radius: 5px; padding: .1rem .3rem; }
.exp button { padding: .1rem .5rem; font-size: .85rem; }

main { padding: 1rem 1.25rem 2rem; }
.drop {
  border: 3px dashed var(--line-2); border-radius: 14px; background: var(--surface);
  padding: 3rem 2rem; text-align: center; max-width: 52rem; margin: 2rem auto;
}
.drop h2 { font-size: 1.4rem; margin-bottom: .6rem; }
.drop-shade { display: none; }
body.dragging .drop-shade {
  display: flex; position: fixed; inset: 0; z-index: 50; background: rgba(28, 92, 171, .18);
  align-items: center; justify-content: center; pointer-events: none;
}
body.dragging .drop-shade div {
  background: var(--surface); border: 3px dashed var(--accent); border-radius: 14px;
  padding: 2rem 3rem; font-size: 1.4rem; font-weight: 700; color: var(--accent);
}

/* ------------------------------------------------------------------ panels */
.panels { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .panels { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.panel h2 { font-size: 1.05rem; font-weight: 700; display: inline; }
.panel summary { cursor: pointer; }
details.panel[open] summary { margin-bottom: .5rem; }
details.read { margin-top: 1rem; }
.q { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); gap: .1rem .5rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; margin-top: .3rem; }
.qn {
  grid-row: span 3; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem;
}
.qh { font-weight: 600; }
.qc { color: var(--muted); font-weight: 400; }
.seg { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.seg button { border-radius: 999px; padding: .25rem .8rem; text-align: left; }
.seg button[aria-checked=true] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.seg small { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; opacity: .75; margin-left: .3rem; }
.qx { margin-top: .3rem; color: var(--ink-2); }
.qx input { width: 3.6rem; padding: .1rem .3rem; border: 1px solid var(--line-2); border-radius: 5px; }
.qx .off { opacity: .5; }
.assume ul, .read ul { margin: .2rem 0 .4rem; padding-left: 1.2rem; }
.assume li, .read li { margin: .25rem 0; }
.assume input[type=number] { width: 3.4rem; padding: .05rem .3rem; border: 1px solid var(--line-2); border-radius: 5px; }
.assume input[type=text] { width: 5rem; padding: .05rem .3rem; border: 1px solid var(--line-2); border-radius: 5px; }
.assume select { padding: .05rem .2rem; }
.tba { background: #fff3d1; color: #5c4300; border-radius: 4px; padding: 0 .35rem; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.read h4 { font-size: 1rem; margin-top: .6rem; }
.read .warn { color: #8a1c1c; }

/* -------------------------------------------------------- filters, legend */
.filters { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; margin: 1rem 0 .5rem; }
.filters label { display: flex; gap: .4rem; align-items: center; font-weight: 600; }
.filters select, .filters input[type=search] { padding: .3rem .45rem; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); font-weight: 400; }
.filters input[type=search] { width: 12rem; }
.filters .chk input { width: 1.1rem; height: 1.1rem; }
.chip { display: inline-flex; gap: .4rem; align-items: center; background: #fde8e8; border: 1px solid #efb1b1; border-radius: 999px; padding: .15rem .3rem .15rem .7rem; font-weight: 600; }
.chip button { border: 0; background: transparent; padding: 0 .35rem; font-size: 1.1rem; line-height: 1; }
.counts { margin-left: auto; color: var(--ink-2); }
.counts b { color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1.2rem; align-items: center; color: var(--ink-2); margin: .3rem 0 .6rem; }
.lg { display: inline-flex; gap: .4rem; align-items: center; }
.sw {
  display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 1.15rem;
  border-radius: 3px; font-style: normal; font-weight: 700; font-size: .8rem; color: #fff;
}
.strip-note { margin: 0 0 .4rem; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------------- board */
.board-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.board { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 60rem; table-layout: fixed; }
.board col.c-bn { width: 16.5rem; }
.board col.c-rl { width: 4.2rem; }
.board col.c-ao { width: 9.5rem; }
.board thead { position: sticky; top: 0; z-index: 3; }
.board thead th, .board thead td { background: var(--surface); }
.board th.bn { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; }
.board thead th.bn { z-index: 4; }
.board tr.names th {
  font-size: .9rem; font-weight: 700; padding: .45rem .3rem; border-bottom: 2px solid var(--ink); text-align: center;
}
.board tr.names th.bn { padding-left: .75rem; text-align: left; }
.board tr.names th small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.board .strip > * { padding: .4rem .2rem .3rem; vertical-align: bottom; border-bottom: 1px solid var(--line); }
.board .strip th.rl { color: var(--muted); font-weight: 600; font-size: .8rem; text-align: right; padding-right: .5rem; }
.sc {
  display: block; width: 100%; text-align: left; border: 1px solid transparent; border-radius: 7px;
  padding: .25rem .4rem; background: transparent;
}
.sc:hover { border-color: var(--line-2); }
.sc .n { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.sc .n small { font-size: .78rem; font-weight: 600; color: var(--ink-2); margin-left: .25rem; }
.sc .d { display: block; font-size: .78rem; line-height: 1.25; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc .bar { display: block; height: 6px; border-radius: 3px; background: var(--line); margin: .2rem 0; overflow: hidden; }
.sc .bar i { display: block; height: 100%; background: var(--late); border-radius: 3px; }
.sc.zero { color: var(--muted); cursor: default; }
.sc.zero .n { color: var(--muted); }
.sc.top { border: 2px solid var(--late); }
.sc[aria-pressed=true] { background: #fde8e8; border-color: var(--late); }
.board th.bn .sc { max-width: 15rem; }

.board tbody tr > * { padding: 0; }
.board tbody tr.pl > * { border-top: 1px solid var(--line); }
.board tbody:first-of-type tr.pl > * { border-top: 0; }
.board tbody th.bn { padding: .3rem .75rem; vertical-align: middle; font-weight: 400; border-right: 1px solid var(--line); }
.bn .l1 { display: block; white-space: nowrap; overflow: hidden; }
.bn .no { font-weight: 700; font-size: 1rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.bn .meta { display: block; font-size: .8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 4px; padding: 0 .35rem; margin-left: .35rem; vertical-align: 2px; white-space: nowrap; }
.st.late { background: var(--late); color: #fff; }
.st.warn { background: var(--warn); color: #0b0b0b; }
.st.ok { background: var(--ok); color: #fff; }
.st.adv { background: var(--adv); color: #fff; }
.st.none { background: var(--line); color: var(--ink-2); }
.flag { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 .3rem; margin-left: .3rem; vertical-align: 2px; }
.sw.flag { width: auto; height: auto; margin: 0; color: var(--accent); background: none; }
.board td.rl { font-size: .75rem; color: var(--muted); text-align: right; padding-right: .5rem; text-transform: uppercase; letter-spacing: .04em; }
.board tr.ac td.rl { color: var(--ink-2); font-weight: 600; }
.board td.c {
  height: 1.75rem; border-left: 3px solid var(--surface); text-align: center; vertical-align: middle;
  font-weight: 700; font-size: .85rem; color: #fff; position: relative; white-space: nowrap;
}
.board tr.pl td.c { height: 1.05rem; font-size: .75rem; }
.board tr.ac td.c { border-top: 3px solid var(--surface); }
.board tbody tr.ac > * { padding-bottom: .1rem; }
td.c.plan { background: var(--plan); color: #0b3d0b; }
td.c.ok, .sw.ok { background: var(--ok); }
td.c.late, .sw.late { background: var(--late); }
td.c.warn, .sw.warn { background: var(--warn); color: #0b0b0b; }
td.c.adv, .sw.adv { background: var(--adv); }
td.c.unk, .sw.unk { background: var(--unk); color: #0b0b0b; }
.sw.plan { background: var(--plan); }
td.c.ns, .sw.ns { box-shadow: inset 0 0 0 2px var(--late); color: var(--late); font-size: .72rem; }
.sw.ns { background: var(--surface); }
td.c.btw-left::after, td.c.btw-waits::before, .sw.btw::after {
  content: "\2192"; position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 1rem; color: #0b0b0b; background: var(--surface); border-radius: 50%;
  width: 1.1rem; height: 1.1rem; line-height: 1.1rem; text-align: center; box-shadow: 0 0 0 1px var(--line-2);
}
td.c.btw-left::after { right: -.75rem; z-index: 1; }
td.c.btw-waits::before { left: -.75rem; z-index: 1; }
.sw.btw { position: relative; background: var(--line); }
.sw.btw::after { right: -.4rem; }
td.c.open::after, .sw.open::after {
  content: "?"; position: absolute; right: .25rem; top: 50%; transform: translateY(-50%);
  color: #5c4300; font-weight: 700; font-size: .8rem;
}
.sw.open { position: relative; background: var(--plan); }
.board td.ao { text-align: center; color: var(--muted); border-left: 1px solid var(--line); vertical-align: middle; font-size: 1.1rem; }
.board tbody:hover th.bn, .board tbody:hover td.rl, .board tbody:hover td.ao { background: #f3f6fb; }
.board .empty td { padding: 2rem; text-align: center; color: var(--muted); }
.foot { margin-top: .8rem; font-size: .85rem; }

/* ------------------------------------------------------------------ tooltip */
.tip {
  position: fixed; z-index: 60; max-width: 26rem; background: #1d1d1b; color: #f0efec;
  border-radius: 8px; padding: .55rem .7rem; font-size: .88rem; line-height: 1.4;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25); pointer-events: none;
}
.tip b { color: #fff; }
.tip .t-h { font-weight: 700; color: #fff; margin-bottom: .2rem; }
.tip table { border-collapse: collapse; margin: .25rem 0; }
.tip div + div { margin-top: .15rem; }
.tip td { padding: 0 .9rem 0 0; }
.tip td.v { text-align: right; font-variant-numeric: tabular-nums; }
.tip .t-s { color: #c3c2b7; }
.tip .t-late { color: #ffb3b3; font-weight: 600; }
.tip .t-adv { color: #a9cdf7; font-weight: 600; }
.tip .t-ok { color: #a6e3a6; font-weight: 600; }

/* ------------------------------------------------- the flow service's live board */
.flag.miss { color: #8a1c1c; }
.proto strong.stale { background: #fdecec; color: #6d1414; border-color: #f0b3b3; }
.signin { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0 .5rem; }
.signin input { padding: .4rem .6rem; border: 1px solid var(--line-2); border-radius: 6px; min-width: 16rem; }
.drop .warn { color: #8a1c1c; min-height: 1.2em; }
.admin-link { font-weight: 600; color: var(--accent); padding: .35rem .4rem; }
/* The wall screen (?wall=1): the whole board, large, no controls to reach for. */
body.wall .panels, body.wall #readPanel, body.wall .filters, body.wall .strip-note,
body.wall .controls, body.wall .foot { display: none; }
body.wall main { padding-top: .5rem; }
body.wall .board td.c { height: 2.1rem; }
body.wall .board tr.pl td.c { height: 1.2rem; }
