/* The one stylesheet: the header, the stock grids with Luis's traffic-light colours, the pipeline
   board, lists, forms, the money chart and the truck cards. Colours are the custom properties below. */
:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1d2430; --muted: #6b7380; --line: #dfe3e8;
  --accent: #2459c9;
  --ok: #1f8a4c; --ok-bg: #e3f4ea; --low: #9a6a00; --low-bg: #fdf1d6; --short: #b3261e; --short-bg: #fbe3e1;
  --none-bg: #f0f1f3;
  --es: #8a3fa0; --es-on-dark: #ecd9f5;  /* D54: the Spanish line under each English text */
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.muted { color: var(--muted); }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 600; font-size: 16px; white-space: nowrap; }
nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
nav a { padding: 6px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; }
nav a.on { background: var(--accent); color: #fff; }
/* The open group's screens (Logistics), a second row under the header; scrolls away with the page. */
nav.subnav { flex: none; margin: 10px 20px 0; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; white-space: nowrap; }
.tools select, .tools button { font: inherit; padding: 4px 8px; }
.who { padding: 4px 10px; border-radius: 12px; background: var(--none-bg); }
.banner { margin: 12px 20px 0; padding: 10px 14px; border-radius: 6px; background: var(--low-bg); color: #5c4300; }
main { padding: 16px 20px 40px; }
h1 { font-size: 20px; margin: 4px 0 4px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.lead { margin: 0 0 16px; color: var(--muted); }
.note { padding: 8px 12px; border-left: 3px solid var(--line); color: var(--muted); margin: 8px 0 16px; }

table.grid { border-collapse: collapse; background: var(--panel); width: 100%; }
.grid th, .grid td { border: 1px solid var(--line); padding: 4px 6px; text-align: right; }
.grid th { background: #fafbfc; font-weight: 600; position: sticky; top: var(--top-h, 52px); }  /* --top-h: the header's height, set by main.js */
.grid td.name, .grid th.name { text-align: left; white-space: nowrap; }
.grid td.ok { background: var(--ok-bg); color: var(--ok); }
.grid td.low { background: var(--low-bg); color: var(--low); }
.grid td.short { background: var(--short-bg); color: var(--short); }
.grid td.zero { color: #b8bec6; }
.grid td.neg, .neg { color: var(--short); font-weight: 600; }
.grid td.neg { background: var(--short-bg); }
.grid .wk { display: block; font-size: 11px; }
.grid td.nosales { color: var(--low); font-style: italic; }
.grid tr.group th { text-align: left; background: #eef1f5; }
.legend { display: flex; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.legend span { padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.legend .ok { background: var(--ok-bg); color: var(--ok); } .legend .low { background: var(--low-bg); color: var(--low); } .legend .short { background: var(--short-bg); color: var(--short); }

.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; align-items: start; }
.col { background: #eef1f5; border-radius: 8px; padding: 8px; }
.col h3 { margin: 0 0 8px; font-size: 13px; display: flex; justify-content: space-between; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 8px; }
.card .id { font-weight: 600; font-family: Consolas, monospace; }
.card .row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; margin: 4px 4px 0 0; background: var(--none-bg); }
.badge.warn { background: var(--low-bg); color: var(--low); }
.badge.bad { background: var(--short-bg); color: var(--short); }

table.list { border-collapse: collapse; width: 100%; background: var(--panel); }
.list th, .list td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.list th { background: #fafbfc; }
.list td.num { text-align: right; }
.error { color: var(--short); white-space: pre-wrap; }
.signin { max-width: 420px; margin: 80px auto; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 32px; }
.signin button { font: inherit; padding: 8px 16px; background: var(--accent); color: #fff; border: 0; border-radius: 6px; cursor: pointer; }
input.qty { width: 56px; text-align: right; font: inherit; padding: 2px 4px; }
form label { margin-right: 16px; }
body.testbase .banner { background: var(--short-bg); color: var(--short); font-weight: 600; }
body.testbase .top { border-bottom: 3px solid var(--short); }

.pickers { margin: 0 0 12px; }
.pickers select { font: inherit; padding: 2px 4px; }
table.facts { border-collapse: collapse; margin: 0 0 16px; background: var(--panel); }
.facts th, .facts td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.facts th { width: 170px; color: var(--muted); font-weight: 600; }
.pill { padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.low { background: var(--low-bg); color: var(--low); } .pill.short { background: var(--short-bg); color: var(--short); }
.scroll { overflow-x: auto; }
.grid.proj td.empty { font-weight: 600; }
.grid.proj tr.total td { border-top: 2px solid var(--line); font-weight: 600; }
.grid.proj tr.arr td { background: #f4f7fb; }
.grid td.name a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.lowtext { color: var(--low); }
/* Inside a sideways-scrolling box a sticky header would sit over the first row. */
.grid.proj th { position: static; }
.port { margin: 18px 0 6px; font-size: 15px; }

.bars { display: grid; grid-template-columns: repeat(13, minmax(38px, 1fr)); gap: 6px; align-items: end; height: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 0; }
.bcol { display: flex; flex-direction: column; height: 100%; }
.bstack { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; border-bottom: 1px solid var(--line); }
.bstack .seg:last-child { border-radius: 4px 4px 0 0; }
.bval { font-size: 11px; color: var(--muted); text-align: center; min-height: 16px; }
.blab { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0 8px; white-space: nowrap; }
.bcol.over .blab { color: var(--short); font-weight: 600; }
.blegend { display: flex; gap: 16px; margin: 8px 0 16px; font-size: 12px; }
.blegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs a { padding: 4px 10px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs a.on .muted { color: #e6ecf5; }
.list tr.sum td { border-top: 2px solid var(--line); }
.setform { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .setform button { font: inherit; padding: 2px 10px; } .msg { font-size: 12px; }
body .banner.preview { background: #fff4d6; color: #7a5200; font-weight: 600; } body .banner.preview button { font: inherit; margin-left: 8px; padding: 2px 10px; } #preview-wrap select { font: inherit; padding: 2px 4px; max-width: 220px; }
.truck { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; } .truck h3 { margin: 0 0 4px; font-size: 15px; } .truck p { margin: 4px 0; } .truck button { font: inherit; padding: 4px 12px; }
.card .id a, .list td b a { color: inherit; }
form.cform select, form.cform input[type=date] { font: inherit; padding: 2px 4px; }
/* A4 Arrivals vs projection: the chart's chrome (marks are coloured in screens/arrivalsvs.js). */
.av-wrap { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-width: 900px; }
svg.av { display: block; width: 100%; height: auto; font-family: inherit; }
.av-tip { position: absolute; top: calc(100% + 4px); z-index: 1; min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.08); font-size: 12px; pointer-events: none; }
.av-legend { display: flex; gap: 16px; margin: 0 0 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.av-legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.av-legend .k-line { width: 16px; height: 2px; background: #2a78d6; }
.av-legend .k-col { width: 10px; height: 10px; border-radius: 2px 2px 0 0; background: #eb6834; }
.av-legend .k-safe { width: 16px; height: 1px; background: #52514e; }
.list tr.on td { background: #eef3fc; }
/* F1 Exec summary: the big-number tiles. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; }
.tile .tval { font-size: 26px; font-weight: 600; }
.tile .tlab { color: var(--ink); }
.tile .tsub { color: var(--muted); font-size: 12px; }
/* C5 Floor counts laid out like the count sheet: one card per line, sizes down the card. */
.sheet { display: flex; flex-wrap: wrap; gap: 8px; }
.sheetline { background: var(--panel); border: 1px solid var(--line); padding: 6px 8px; min-width: 150px; }
.sheetline.bundle { border-style: dashed; }
/* Colours from the warehouses' sheet (rules/countsheet.js SHEET_COLOURS, SHEET_TAN): the name cell in the
   glove's colour, group headings and size labels in the sheet's tan. */
.sheetline .sheetname { margin: -6px -8px 4px; padding: 4px 8px; }
.sheetline .ledgername { color: var(--muted, #6b7280); font-size: 0.85em; margin-bottom: 4px; }
.sheetline table { border-collapse: collapse; }
.sheetline th { text-align: left; padding: 2px 8px; font-weight: 600; background: #C4BD97; }
h2.sheetgroup { background: #C4BD97; color: #000; padding: 3px 8px; font-size: 1em; }

/* Freight bills (86bcrnh4e): the bill a truck or container linked to; the row's buttons. */
tr.hl td { background: var(--low-bg); }
td.acts button { margin: 0 4px 2px 0; }
.bfilter label { margin-right: 10px; white-space: nowrap; }

/* D54: English on top, Spanish underneath in its own colour (i18n.js adds span.es). */
/* The freight button's wait (86bctjcm3): the label, its Spanish under it, and the ticking figure beside them. */
.freight-wait { display: inline-flex; align-items: center; gap: 0.4em; text-align: left; }
.freight-wait .countdown { font-variant-numeric: tabular-nums; font-weight: bold; }
.es { display: block; color: var(--es); font-size: 0.9em; font-weight: normal; font-style: normal; line-height: 1.25; }
nav a.on .es { color: var(--es-on-dark); }
