/* Product Information Manager - styles */
:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-2: #4b5563;
  --muted: #8a93a1;
  --line: #e2e5ea;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --accent-soft: #e6eff6;
  --green: #1f9d55;
  --green-soft: #e4f5ea;
  --red: #d64545;
  --red-soft: #fbe9e9;
  --amber: #c27c0e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --green-ink: #14653a;
  --red-ink: #a12828;
  --amber-soft: #fdf1dc;
  --amber-ink: #8a5509;
  --dev-bg: #e8e6fb;
  --dev-ink: #4a3fb0;
  --surface-2: #f8f9fb;      /* slightly grey panels: notes, upload boxes */
  --surface-3: #eef0f3;      /* photo placeholders */
  --photo-bg: #ffffff;       /* behind the main photo in the part header (white, so a photo with a white background has no visible edges) */
  --hover: #f7f8fa;
  --tag-bg: #eceef2;
  --input-bg: #ffffff;
  --input-border: #cfd4db;
  --alert-bg: #fffafa;
  --alert-border: #f3d0d0;
  --pack-bg: #eef3f8;
  --pack-border: #dbe5ef;
  /* section colours (Overview / Uploads cards): -ink for the icon and title, -bg for the header strip */
  --sec-pn-ink: #1f5f8b;    --sec-pn-bg: #eef5fa;
  --sec-spec-ink: #1e7a46;  --sec-spec-bg: #e8f5ec;
  --sec-tool-ink: #5b3fa0;  --sec-tool-bg: #f4f0fc;
  --sec-photo-ink: #4b5563; --sec-photo-bg: #f3f4f6;
  --sec-doc-ink: #0f6e6e;   --sec-doc-bg: #eaf6f5;
  --sec-pack-ink: #8a5509;  --sec-pack-bg: #fdf6e7;
  --note-bg: #fffbea;       --note-line: #f1e3a6;    --note-ink: #8a5509;
  /* Ipoh Casting orange (from the logo) */
  --brand-orange: #c2481a;  --brand-orange-hover: #a63c14;  --brand-orange-ink: #c2481a;
  --pack-line: #e8c98f;
  color-scheme: light;
  font-size: 15px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
h3.sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-top: 1.2rem; }
.mt { margin-top: 2rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
img { max-width: 100%; }

/* ------------------------------------------------ top bar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: 0 1.5rem; height: 58px;
  background: #16212e; color: #fff; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800;
  font-size: .75rem; letter-spacing: .06em; width: 38px; height: 30px; border-radius: 6px;
}
.brand-mark.big { width: 64px; height: 48px; font-size: 1.1rem; margin: 0 auto .5rem; display: grid; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.mainnav { display: flex; gap: .25rem; flex: 1; }
.mainnav a { color: #c4ccd6; padding: .45rem .8rem; border-radius: 6px; }
.mainnav a:hover { background: #223143; color: #fff; text-decoration: none; }
.mainnav a.on { background: #2b3d52; color: #fff; }
.userbox { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.userbox a { color: #c4ccd6; }
.role { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px;
        background: var(--tag-bg); color: var(--ink-2); vertical-align: middle; }
.topbar .role { background: #2b3d52; color: #c4ccd6; }
.role-admin { background: var(--amber-soft); color: var(--amber-ink); }
.role-editor { background: var(--accent-soft); color: var(--accent); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.foot { text-align: center; color: var(--muted); font-size: .75rem; padding: 2rem 0; }

/* ------------------------------------------------ cards, flash, misc */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.card.narrow, .narrow { max-width: 720px; }
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash-ok { background: var(--green-soft); color: var(--green-ink); }
.flash-err { background: var(--red-soft); color: var(--red-ink); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); background: var(--card); border-radius: var(--radius); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
       background: var(--tag-bg); color: var(--ink-2); vertical-align: middle; }
.tag-green { background: var(--green-soft); color: var(--green-ink); }
.tag-teal { background: var(--sec-doc-bg); color: var(--sec-doc-ink); }
.tag-amber { background: var(--amber-soft); color: var(--amber-ink); }
.tag-blue { background: var(--accent-soft); color: var(--accent); }
a.tag:hover { text-decoration: none; filter: brightness(.96); }
.count { font-size: .72rem; background: var(--tag-bg); color: var(--ink-2); border-radius: 999px; padding: 1px 7px; margin-left: 2px; }

.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.dot-red { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.dot-green { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-pill { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; padding: 4px 12px 4px 8px; border-radius: 999px; }
.status-pill.green { background: var(--green-soft); color: var(--green-ink); }
.status-pill.red { background: var(--red-soft); color: var(--red-ink); }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .55rem 1rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #194f74; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.block { width: 100%; justify-content: center; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: .85rem; cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--red); }

/* ------------------------------------------------ forms */
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .9rem; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea {
  font: inherit; font-weight: 400; color: var(--ink); padding: .55rem .7rem; border: 1px solid var(--input-border);
  border-radius: 8px; background: var(--card); width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus, .filter-bar input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form input[type=file] { font: inherit; font-weight: 400; }
.form .inline-check, .inline-check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.form small { font-weight: 400; }
.form-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.form.inline, form.inline { display: inline; }
fieldset.card { border: 0; }
fieldset legend { font-weight: 700; font-size: 1.05rem; padding: 0; float: left; width: 100%; margin-bottom: 1rem; }
fieldset legend + * { clear: both; }
.grid-2, .grid-3 { display: grid; gap: 0 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }
.checks-row { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-bottom: 1rem; align-items: center; }
.checks-row .lbl { font-size: .85rem; font-weight: 600; color: var(--ink-2); width: 100%; }
.checks-row label { margin: 0; }
.danger-zone { border: 1px solid var(--red-soft); }
.danger-zone summary { cursor: pointer; color: var(--red); font-weight: 600; }
.danger-inline { margin-top: 1rem; }

/* ------------------------------------------------ filter bar & parts list */
.filter-bar { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar input, .filter-bar select {
  font: inherit; color: var(--ink); padding: .65rem .8rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); box-shadow: var(--shadow);
}
.filter-bar input { flex: 1; min-width: 240px; font-size: 1.05rem; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }

.parts-table { border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; table-layout: fixed; }
.parts-table td { padding: .45rem .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.parts-table th { padding: .5rem .75rem; }
.parts-table tbody tr { cursor: pointer; }
.parts-table tbody tr:hover td { background: var(--accent-soft); }
.parts-table .col-dot { width: 36px; text-align: center; padding-right: 0; }
.parts-table .col-dot .dot { width: 10px; height: 10px; }
.parts-table .col-name a { color: var(--ink); font-weight: 600; }
.parts-table td.col-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.clear-filters { align-self: center; color: var(--ink-2); }
.cust-pick { margin-bottom: 1rem; }
.cust-pick-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .4rem; }
.cust-pick-head input { font: inherit; font-size: .85rem; padding: .3rem .55rem !important; border: 1px solid var(--input-border); border-radius: 6px; width: 200px !important; }
.lbl-strong { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.cust-list { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 170px; overflow-y: auto; padding: .1rem; }
.form .cust-chip { flex-direction: row; align-items: center; gap: .4rem; margin: 0; padding: .35rem .7rem; border: 1px solid var(--line);
  border-radius: 999px; font-weight: 500; color: var(--ink); cursor: pointer; background: var(--card); }
.form .cust-chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cust-chip[hidden] { display: none !important; }
.parts-table tr[data-status=inactive] td, .parts-table tr[data-status=ceased] td { color: var(--muted); }
.parts-table tr[data-status=inactive] .col-name a, .parts-table tr[data-status=ceased] .col-name a { color: var(--ink-2); font-weight: 500; }
.more { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: .72rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 6px; }
.status-developing { background: var(--dev-bg); color: var(--dev-ink); }
.status-active { background: var(--green-soft); color: var(--green-ink); }
.status-inactive { background: var(--tag-bg); color: var(--ink-2); }
.status-ceased { background: #3a4250; color: #fff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* part numbers table (edit form) */
.hint { margin: -.4rem 0 .8rem; }
.table-scroll { overflow-x: auto; }
.pn-table { width: 100%; border-collapse: collapse; margin-bottom: .75rem; min-width: 820px; }
.pn-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 .3rem .35rem; }
.pn-table td { padding: .2rem .3rem; }
.pn-table td:last-child { width: 30px; text-align: center; }
.pn-table input, .pn-table select { font: inherit; font-size: .92rem; padding: .45rem .55rem; border: 1px solid var(--input-border); border-radius: 6px; width: 100%; background: var(--card); }
.pn-table input:focus, .pn-table select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pn-remove { font-size: 1rem !important; }
.pn-view { margin-bottom: .5rem; }
.pn-view td, .pn-view th { padding: .45rem .6rem; }
h3.sub.first { margin-top: 0; }

/* change log clearing */
.clear-log { position: relative; }
.clear-log > summary { list-style: none; }
.clear-log > summary::-webkit-details-marker { display: none; }
.clear-log form { position: absolute; right: 0; top: 2.4rem; width: 340px; z-index: 5; box-shadow: 0 8px 24px rgba(16,24,40,.18); }
.clear-log .inline-check { margin-bottom: .6rem; }
.clear-log input[type=date] { width: auto !important; padding: .3rem .4rem !important; }

/* ------------------------------------------------ part page */
.part-head { display: grid; grid-template-columns: 160px 1fr auto; gap: 1.5rem; align-items: center; }
.part-head-img { width: 160px; height: 120px; border-radius: 8px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; }
.part-head-img.has-img { background: var(--photo-bg); }
.part-head-img img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.part-head h1 { margin: 0 0 .4rem; }
.part-head-nos { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin-bottom: .6rem; }
.part-head-nos b { font-size: 1.05rem; }
.part-head-tags { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.part-head-tags .tag { font-size: .8rem; padding: 4px 10px; }

.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: 1.25rem 0 1rem; overflow-x: auto; }
.tabs a { padding: .65rem 1rem; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.on { display: block; }
.no-js .tab-panel { display: block; }

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem 1.5rem; }
.field .val { font-size: 1rem; margin-top: .1rem; }
.notes { margin-top: 1.25rem; padding: .9rem 1rem; background: var(--surface-2); border-radius: 8px; border-left: 3px solid var(--line); }
.notes .lbl { margin-bottom: .2rem; }
.meta { margin: 1.25rem 0 0; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.gallery figure { margin: 0; background: var(--surface-2); border-radius: 8px; overflow: hidden; border: 2px solid transparent; }
.gallery figure.main { border-color: var(--accent); }
.gallery img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.gallery figcaption { font-size: .82rem; padding: .4rem .6rem 0; min-height: 1.4em; }
.fig-actions { display: flex; gap: .8rem; padding: .25rem .6rem .5rem; }
.upload-box { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-top: 1.25rem; padding: 1rem;
              background: var(--surface-2); border: 1px dashed var(--input-border); border-radius: 8px; }
.upload-box label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.upload-box input:not([type=file]), .upload-box select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--input-border); border-radius: 6px; }

/* documents */
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.table td { padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.inactive td { color: var(--muted); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions form { display: inline; margin-left: .6rem; }
body > .wrap > .table { border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.docs { table-layout: fixed; }
.docs td:nth-child(1), .docs th:nth-child(1) { width: 38%; }
.docs td:nth-child(2), .docs th:nth-child(2) { width: 12%; }
.docs td:nth-child(3), .docs th:nth-child(3) { width: 13%; }
.docs td:nth-child(4), .docs th:nth-child(4) { width: 15%; }
.docs tr.superseded td { color: var(--muted); }
.docs tr.superseded .doc-title { color: var(--ink-2); }
.doc-title { font-weight: 600; }
.rev { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; background: var(--tag-bg); padding: 2px 8px; border-radius: 5px; }
.docs tr.current .rev { background: var(--accent-soft); color: var(--accent); }
.old-revs { margin-top: .5rem; }
.old-revs summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; padding: .4rem 0; }
.pdf-preview { margin-top: 1rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pdf-bar { display: flex; justify-content: space-between; padding: .5rem .75rem; background: var(--surface-2); font-size: .85rem; font-weight: 600; }
.pdf-preview iframe { width: 100%; height: 75vh; border: 0; display: block; }
.upload-details { margin-top: 1rem; }
.upload-details > summary { list-style: none; display: inline-flex; }
.upload-details > summary::-webkit-details-marker { display: none; }
.upload-details[open] > summary { margin-bottom: .75rem; }
.upload-details form { background: var(--surface-2); border: 1px dashed var(--input-border); border-radius: 8px; padding: 1rem; }

/* tooling */
.tool { padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.tool.retired { opacity: .7; }
.tool-head { display: flex; justify-content: space-between; align-items: center; }
.tool-head .muted { font-weight: 500; font-size: .95rem; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 1rem 0 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 104px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.ev { display: grid; grid-template-columns: 92px 1fr; gap: 28px; padding: .5rem 0; position: relative; }
.ev::before { content: ""; position: absolute; left: 99px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); border: 2px solid var(--card); }
.ev-date { font-size: .82rem; color: var(--ink-2); text-align: right; padding-top: .15rem; }
.ev-details { margin: .3rem 0; color: var(--ink-2); }
.ev-fai::before { background: var(--green); }
.ev-fai .ev-tag { background: var(--green-soft); color: var(--green-ink); }
.ev-modification::before { background: var(--amber); }
.ev-modification .ev-tag { background: var(--amber-soft); color: var(--amber-ink); }
.ev-reject::before { background: var(--red); }
.ev-reject .ev-tag { background: var(--red-soft); color: var(--red-ink); }
.ev-revision::before { background: var(--accent); }
.ev-revision .ev-tag { background: var(--accent-soft); color: var(--accent); }

/* change log */
.diff { margin: .3rem 0 0; padding-left: 1rem; font-size: .85rem; color: var(--ink-2); }
del { color: var(--red-ink); background: var(--red-soft); text-decoration: line-through; padding: 0 3px; border-radius: 3px; }
ins { color: var(--green-ink); background: var(--green-soft); text-decoration: none; padding: 0 3px; border-radius: 3px; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* companies */
.chips { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chip { font: inherit; font-size: .85rem; padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* lightbox */
#lightbox { position: fixed; inset: 0; background: rgba(10, 14, 20, .92); z-index: 100; display: flex; align-items: center; justify-content: center; }
#lightbox[hidden] { display: none; }
#lightbox figure { margin: 0; max-width: 90vw; max-height: 90vh; text-align: center; }
#lightbox img { max-width: 90vw; max-height: 82vh; border-radius: 4px; }
#lightbox figcaption { color: #dfe3e8; margin-top: .6rem; }
#lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; font-size: 2rem; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; }
#lightbox button:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 18px; right: 18px; font-size: 1.3rem !important; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }

/* login / install */
.login-body { display: grid; place-items: center; min-height: 100vh; background: #16212e; }
.login-card { background: var(--card); padding: 2rem; border-radius: 14px; width: 360px; max-width: 92vw; text-align: center; }
.login-card.wide { width: 520px; text-align: left; }
.login-card h1 { font-size: 1.2rem; margin-bottom: 1.5rem; }
.login-card .form { text-align: left; }
.checks { list-style: none; padding: 0; }
.checks .ok { color: var(--green); }
.checks .bad { color: var(--red); font-weight: 600; }

/* ------------------------------------------------ smaller screens */
@media (max-width: 900px) {
  .parts-table col.c-no { width: 16%; }
  .parts-table col.c-cust { width: 18%; }
  .parts-table col.c-status { width: 92px; }
  .parts-table col.c-pqty, .parts-table col.c-pwt, .parts-table col.c-ppn { width: 88px; }
  .part-head { grid-template-columns: 1fr; }
  .part-head-img { width: 100%; height: 200px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .topbar { gap: .75rem; padding: 0 .75rem; }
  .brand-name, .userbox .role { display: none; }
  .wrap { padding: 1rem; }
  .legend { display: none; }
  .docs { table-layout: auto; }
  .docs td:nth-child(4), .docs th:nth-child(4) { display: none; }
  .timeline::before { left: 8px; }
  .ev { grid-template-columns: 1fr; gap: 0; padding-left: 28px; }
  .ev::before { left: 3px; }
  .ev-date { text-align: left; }
}

.no-img { font-size: .75rem; color: var(--muted); text-align: center; }

/* rejects */
.tag-red { background: var(--red-soft); color: var(--red-ink); }
.count-red { background: var(--red); color: #fff; }
a.status-pill:hover { text-decoration: none; filter: brightness(.97); }
.btn.danger-outline { color: var(--red); border-color: var(--alert-border); }
.reject { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 8px; padding: .9rem 1.1rem; margin: 1rem 0; background: var(--card); }
.reject.open { border-left-color: var(--red); background: var(--alert-bg); }
.reject.resolved { border-left-color: var(--green); }
.reject-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .5rem; }
.reject-meta { color: var(--ink-2); font-size: .9rem; }
.reject-desc { margin-bottom: .6rem; }
.fields.compact { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem 1.5rem; margin-bottom: .6rem; }
.resolved-note { margin: .5rem 0; border-left-color: var(--green); background: var(--green-soft); }
.reject-log { list-style: none; padding: .5rem 0 .2rem .8rem; margin: .3rem 0 .5rem; border-left: 2px solid var(--line); font-size: .9rem; }
.reject-log li { margin-bottom: .25rem; }
.reject-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-top: .7rem; }
.reject-actions details { flex: 0 0 auto; }
.reject-actions details[open] { flex: 1 1 100%; order: 10; }
.reject-actions details > summary { list-style: none; display: inline-flex; }
.reject-actions details > summary::-webkit-details-marker { display: none; }
.reject-actions details form { margin-top: .6rem; background: var(--surface-2); border: 1px dashed var(--input-border); border-radius: 8px; padding: .9rem; }
.reject-actions form.inline { align-self: center; }
.resolved-list .reject { margin-left: 0; }
.ev-resolved::before { background: var(--green); }
.ev-resolved .ev-tag { background: var(--green-soft); color: var(--green-ink); }

/* overview & uploads: one long page with sections */
.jump { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.25rem 0 1rem; position: sticky; top: 58px; z-index: 10;
        background: var(--bg); padding: .5rem 0; }
.jump a { font-size: .85rem; font-weight: 600; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; }
.jump a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.ov { scroll-margin-top: 120px; }
.ov-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.ov-head h2 { margin: 0; }
.ov .pn-view { margin-bottom: 1rem; }
.gallery.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.gallery.compact figcaption { padding-bottom: .4rem; }
.tool-view td { vertical-align: middle; }
.mini-gallery { white-space: nowrap; }
.mini-gallery img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; margin-right: 4px; vertical-align: middle; cursor: zoom-in; }
.alert-rejects { border-left: 4px solid var(--red); background: var(--alert-bg); }
.alert-rejects h2 { color: var(--red-ink); display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.alert-rejects ul { margin: 0 0 .5rem; padding-left: 1.1rem; }
.alert-rejects li { margin-bottom: .2rem; }
.tab-panel > .card:last-child { margin-bottom: 0; }


/* ================================================ v1.4: denser layout */
.wrap { max-width: 1320px; padding: 1rem 1.5rem; }
h1 { font-size: 1.4rem; }
.card { padding: .85rem 1.1rem; margin-bottom: .75rem; }
.crumbs { margin-bottom: .15rem; }
.part-head { grid-template-columns: 110px 1fr auto; gap: 1.1rem; padding: .75rem 1rem; }
.part-head-img { width: 110px; height: 82px; }
.part-head h1 { font-size: 1.35rem; margin-bottom: .25rem; }
.part-head-nos { margin-bottom: .4rem; gap: .2rem 1.25rem; }
.part-head-nos b { font-size: .98rem; }
.tabs { margin: .75rem 0 .75rem; }
.tabs a { padding: .5rem .9rem; }
.fields { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .45rem 1.25rem; }
.field .val { font-size: .95rem; margin-top: 0; }
.lbl { font-size: .66rem; }
.notes { margin-top: .6rem; padding: .45rem .75rem; font-size: .93rem; }
.notes .lbl { margin-right: .4rem; }
.meta { margin: .6rem 0 0; font-size: .78rem; }
.ov-head { margin-bottom: .5rem; padding-bottom: .35rem; }
.ov-head h2 { font-size: 1.02rem; }
h3.sub { margin: .8rem 0 .35rem; font-size: .72rem; }
.table td { padding: .45rem .6rem; }
.table th { padding: .4rem .6rem; }
.pn-view td, .pn-view th { padding: .3rem .5rem; }
.ov .pn-view { margin-bottom: .6rem; }
.packing-block { margin-top: .75rem; padding-top: .1rem; border-top: 1px dashed var(--line); }
.docs-view { table-layout: auto; }
.docs-view td { width: auto !important; padding: .3rem .5rem; vertical-align: middle; }
.docs-view td:first-child { width: 100% !important; }
.docs-view .btn.small { padding: .2rem .55rem; font-size: .8rem; }
.ov .old-revs summary { font-size: .82rem; padding: .25rem 0; }
.ov .doc-section > p.muted { margin: .2rem 0; }
.gallery.compact { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .5rem; }
.gallery.compact figcaption { font-size: .75rem; padding: .3rem .45rem .35rem; line-height: 1.3; }
.gallery.compact figcaption .lbl { font-size: .6rem; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: .75rem; margin-bottom: .75rem; align-items: start; }
.ov-grid > .card { margin-bottom: 0; }
.tool-view td { padding: .35rem .5rem; }
.mini-gallery img { width: 46px; height: 34px; }
.alert-rejects { padding: .7rem 1.1rem; }
.alert-rejects h2 { font-size: 1rem; }
.timeline { margin-top: .6rem; }
.ev { padding: .3rem 0; }
.ev-correction::before { background: var(--green); }
.ev-correction .ev-tag { background: var(--green-soft); color: var(--green-ink); }
.ev-note .ev-tag { background: var(--tag-bg); }
.note-box { margin: 0 0 .8rem; padding: .5rem .8rem; border-radius: 8px; background: var(--green-soft); color: var(--green-ink); }
@media (max-width: 1000px) {
  .ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .part-head { grid-template-columns: 1fr; }
  .part-head-img { width: 100%; height: 180px; }
}
.ev-meta { font-size: .8rem; color: var(--muted); margin-left: .3rem; }
.ev-meta form { margin-left: .4rem; }
.ev-details { margin: .15rem 0 0; font-size: .93rem; }


/* ================================================ v1.5 */
.part-head { grid-template-columns: 110px 1fr auto; }
.part-head-img { width: 110px; height: 110px; aspect-ratio: 1 / 1; }
@media (max-width: 900px) { .part-head-img { width: 160px; height: 160px; } }
.tooling-block { margin-top: .75rem; border-top: 1px dashed var(--line); }
.alert-rejects .ar-item { background: var(--card); border: 1px solid var(--alert-border); border-radius: 8px; padding: .65rem .85rem; margin-top: .6rem; }
.ar-title { font-size: 1.02rem; font-weight: 600; margin-bottom: .3rem; }
.ar-title .mono { color: var(--red-ink); margin-right: .35rem; }
.ar-facts { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .9rem; margin-bottom: .35rem; }
.ar-facts .lbl { margin-right: .3rem; }
.ar-desc { font-size: .93rem; margin-bottom: .35rem; }
.ar-updates { margin: .2rem 0 .4rem; padding-left: 1rem; font-size: .88rem; border-left: 2px solid var(--alert-border); list-style: none; }
.ar-updates li { margin-bottom: .15rem; }
.ar-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }
.ar-actions details > summary { list-style: none; display: inline-flex; }
.ar-actions details > summary::-webkit-details-marker { display: none; }
.ar-actions details[open] { flex: 1 1 100%; order: 10; }
.ar-actions details form { margin-top: .5rem; background: var(--surface-2); border: 1px dashed var(--input-border); border-radius: 8px; padding: .75rem; }
.pdf-test { list-style: none; padding: 0; }
.pdf-test .ok { color: var(--green-ink); } .pdf-test .bad { color: var(--red-ink); font-weight: 600; }
.pdf-test-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; }
.checks-table td { vertical-align: top; }
.part-head-img > a { display: block; width: 100%; height: 100%; }
.part-head-img img { width: 100%; height: 100%; object-fit: contain; }   /* whole photo, never cropped */


/* ================================================ v1.6 */
.packing-block { background: var(--pack-bg); border: 1px solid var(--pack-border); border-top: 1px solid var(--pack-border); border-radius: 8px;
                 padding: .2rem .85rem .7rem; margin-top: .85rem; }
.packing-block h3.sub { color: var(--accent); margin-top: .55rem; }
.packing-block .notes { background: var(--card); }
#materialOther { margin-top: .35rem; }

/* ================================================ v1.7: compact Uploads tab */
#tab-uploads .card { padding: .7rem 1rem; margin-bottom: .6rem; }
#tab-uploads .ov-head { margin-bottom: .4rem; padding-bottom: .3rem; }
#tab-uploads h3.sub { margin: .55rem 0 .25rem; }
#tab-uploads h3.sub.first { margin-top: 0; }
#tab-uploads p.small.muted { margin: .2rem 0 .35rem; }
#tab-uploads .gallery.compact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .45rem; }
#tab-uploads .gallery.compact figcaption { font-size: .72rem; padding: .25rem .4rem 0; min-height: 0; }
#tab-uploads .gallery.compact .tag { font-size: .62rem; padding: 0 5px; }
#tab-uploads .fig-actions { padding: .1rem .4rem .3rem; gap: .5rem; }
#tab-uploads .fig-actions .link { font-size: .74rem; }
#tab-uploads .upload-box { margin-top: .5rem; padding: .45rem .6rem; gap: .5rem; align-items: center; }
#tab-uploads .upload-box label { flex-direction: row; align-items: center; gap: .35rem; font-size: .78rem; }
#tab-uploads .upload-box input:not([type=file]), #tab-uploads .upload-box select { padding: .25rem .45rem; font-size: .85rem; }
#tab-uploads .upload-box input[type=file] { font-size: .8rem; }
#tab-uploads .docs td { padding: .35rem .5rem; vertical-align: middle; }
#tab-uploads .docs th { padding: .3rem .5rem; }
#tab-uploads .docs td.small { white-space: nowrap; }
#tab-uploads .old-revs summary { font-size: .82rem; padding: .2rem 0; }
#tab-uploads .upload-details { margin-top: .4rem; }
#tab-uploads .upload-details > summary.btn { padding: .3rem .65rem; font-size: .85rem; }
#tab-uploads .upload-details form { padding: .6rem .75rem; }
#tab-uploads .upload-details .form label { margin-bottom: .5rem; }
#tab-uploads .pdf-preview { margin-top: .5rem; }
#tab-uploads .tool { padding-bottom: .5rem; margin-bottom: .5rem; }
#tab-uploads .tool:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
#tab-uploads .tool-head h3 { margin: .2rem 0 .3rem; font-size: .95rem; }
#tab-uploads .none { margin: .2rem 0; }
#tab-uploads .fig-actions { justify-content: space-between; white-space: nowrap; }
#tab-uploads .upload-box input[name=caption] { width: 170px; }
#tab-uploads .gallery.compact figure.main { border-width: 2px; }


/* ================================================ dark theme (switch with the ☾ / ☀ button) */
[data-theme="dark"] {
  --bg: #0f141b;
  --card: #18202a;
  --ink: #e4e8ee;
  --ink-2: #b3bcc8;
  --muted: #7f8a99;
  --line: #2a3441;
  --accent: #5aa4d6;
  --accent-ink: #0f141b;
  --accent-soft: #1d3446;
  --green: #3cc47a;
  --green-soft: #173527;
  --green-ink: #7fdcaa;
  --red: #ef6666;
  --red-soft: #3d1d1f;
  --red-ink: #ff9d9d;
  --amber: #e0a33a;
  --amber-soft: #3b2e17;
  --amber-ink: #f1c27a;
  --dev-bg: #2b2753;
  --dev-ink: #c3bcff;
  --surface-2: #1e2732;
  --surface-3: #232d39;
  --photo-bg: #232d39;
  --hover: #1f2934;
  --tag-bg: #27313d;
  --input-bg: #121920;
  --input-border: #354150;
  --alert-bg: #241a1c;
  --alert-border: #4a2a2e;
  --pack-bg: #1a2a3a;
  --pack-border: #27405a;
  --sec-pn-ink: #7fb8e0;    --sec-pn-bg: #1b2a38;
  --sec-spec-ink: #6fd39b;  --sec-spec-bg: #16301f;
  --sec-tool-ink: #b9a3f0;  --sec-tool-bg: #251f38;
  --sec-photo-ink: #c3cad4; --sec-photo-bg: #1f2731;
  --sec-doc-ink: #6fd0c8;   --sec-doc-bg: #16302e;
  --sec-pack-ink: #f1c27a;  --sec-pack-bg: #2e2617;
  --note-bg: #2c2817;       --note-line: #4d4421;    --note-ink: #f1c27a;
  --brand-orange: #c2481a;  --brand-orange-hover: #d4561f;  --brand-orange-ink: #f08a55;
  --pack-line: #6b5426;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
[data-theme="dark"] .topbar { background: #0a0e13; border-bottom: 1px solid var(--line); }
[data-theme="dark"] .form input:not([type=checkbox]):not([type=radio]):not([type=file]),
[data-theme="dark"] .form select, [data-theme="dark"] .form textarea,
[data-theme="dark"] .filter-bar input, [data-theme="dark"] .filter-bar select,
[data-theme="dark"] .pn-table input, [data-theme="dark"] .pn-table select,
[data-theme="dark"] .upload-box input:not([type=file]), [data-theme="dark"] .upload-box select,
[data-theme="dark"] .cust-pick-head input { background: var(--input-bg); color: var(--ink); border-color: var(--input-border); }
[data-theme="dark"] .btn { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .btn:hover { background: var(--hover); }
[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .btn.danger { background: var(--red); border-color: var(--red); color: #1a0d0d; }
[data-theme="dark"] .btn.danger-outline { background: transparent; color: var(--red); }
[data-theme="dark"] .chip { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .chip.on { background: var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .status-ceased, [data-theme="dark"] .count-red { color: #fff; }
[data-theme="dark"] .part-head-img, [data-theme="dark"] .gallery figure, [data-theme="dark"] .gallery img { background: var(--surface-3); }
[data-theme="dark"] .pdf-preview iframe, [data-theme="dark"] .pdf-test-frame { background: #fff; }
[data-theme="dark"] .login-card { background: var(--card); color: var(--ink); }
[data-theme="dark"] .login-body { background: #0a0e13; }
[data-theme="dark"] .rev { background: var(--tag-bg); }
[data-theme="dark"] del { background: var(--red-soft); color: var(--red-ink); }
[data-theme="dark"] ins { background: var(--green-soft); color: var(--green-ink); }
[data-theme="dark"] img { opacity: .95; }

.theme-toggle { background: none; border: 1px solid #2b3d52; color: #c4ccd6; border-radius: 8px; width: 34px; height: 30px;
                cursor: pointer; font-size: 1rem; line-height: 1; display: inline-grid; place-items: center; }
.theme-toggle:hover { background: #223143; color: #fff; }
.login-card .theme-toggle { position: absolute; top: .8rem; right: .8rem; border-color: var(--line); color: var(--ink-2); }
.login-card { position: relative; }

/* ================================================ v1.9: tooling condition, ownership, tooling list */
.stars { color: var(--amber); letter-spacing: 1px; white-space: nowrap; font-size: .95rem; }
.stars-off { color: var(--line); }
.stars-1, .stars-2 { color: var(--red); }
.tool-head h3 .stars { margin-left: .35rem; font-size: .9rem; }
.tool-head h3 .tag { margin-left: .25rem; }
.tool-extra { margin-top: .5rem; gap: 1rem; }
.tool-extra fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem .7rem; margin: 0; background: var(--surface-2); }
.tool-extra legend { float: none; width: auto; font-size: .9rem; margin: 0; padding: 0 .3rem; }
.tool-extra .inline-check { margin: .15rem 0; }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; vertical-align: middle; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.star-input label { font-size: 1.9rem; line-height: 1; color: var(--line); cursor: pointer; padding: 0 .08rem; margin: 0; display: inline; }
.star-input input:checked ~ label,
.star-input label:hover, .star-input label:hover ~ label { color: var(--amber); }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.star-caption { margin-left: .5rem; font-weight: 600; color: var(--ink-2); vertical-align: middle; }
.rated-on { margin-top: .35rem; max-width: 220px; }
.owner-customer { margin-top: .35rem; }
.tooling-list td { vertical-align: middle; }
.tooling-list .thumb-cell img { width: 52px; height: 39px; object-fit: cover; border-radius: 4px; display: block; }
.tooling-list tr.inactive td { opacity: .65; }
.report-bar { gap: .6rem 1rem; align-items: center; margin-bottom: .6rem; }
.report-bar select { min-width: 220px; }
.report-bar .inline-check { margin: 0; }
.filter-bar.report-bar input[type=checkbox] { flex: none; min-width: 0; padding: 0; box-shadow: none; }
.report-box { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .6rem 1rem; }
.report-box label:not(.inline-check) { display: flex; flex-direction: row; align-items: center; gap: .5rem; font-weight: 600; font-size: .9rem; }
.report-box select { font: inherit; color: var(--ink); padding: .4rem .6rem; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); min-width: 220px; }
.tag-red { background: var(--red-soft); color: var(--red-ink); }
.cond-summary { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .6rem; }

/* ================================================ v1.10: reject alert bell in the top bar */
.rej-alert { position: relative; }
.rej-alert > summary { list-style: none; position: relative; width: 38px; height: 34px; display: grid; place-items: center;
  border: 1px solid #2b3d52; border-radius: 8px; color: #c4ccd6; cursor: pointer; }
.rej-alert > summary::-webkit-details-marker { display: none; }
.rej-alert > summary:hover, .rej-alert[open] > summary { background: #223143; color: #fff; }
.rej-alert > summary:focus-visible { outline: 2px solid #7fb2d9; outline-offset: 2px; }
.rej-alert.has-rejects > summary { color: #fff; }
.rej-count { position: absolute; top: -7px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 800; line-height: 16px; text-align: center;
  border: 2px solid #16212e; }
.rej-ok { position: absolute; top: -6px; right: -7px; width: 17px; height: 17px; border-radius: 50%; background: var(--green);
  color: #fff; display: grid; place-items: center; border: 2px solid #16212e; }
[data-theme="dark"] .rej-count, [data-theme="dark"] .rej-ok { border-color: #0a0e13; }
.rej-panel { position: absolute; top: calc(100% + 10px); right: -8px; width: 460px; max-width: calc(100vw - 16px); z-index: 40;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(16,24,40,.22), 0 2px 6px rgba(16,24,40,.10); font-size: .9rem; }
.rej-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .7rem 1rem .6rem; border-bottom: 1px solid var(--line); }
.rej-title { font-weight: 700; color: var(--red-ink); }
.rej-title.ok { color: var(--green-ink); }
.rej-sum { font-size: .78rem; color: var(--ink-2); }
.rej-list { max-height: min(60vh, 460px); overflow-y: auto; }
.userbox .rej-item { display: block; padding: .6rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.userbox .rej-item:hover { background: var(--hover); text-decoration: none; }
.rej-line { display: flex; align-items: center; gap: .5rem; }
.rej-line .dot { width: 9px; height: 9px; box-shadow: none; flex: none; }
.rej-no { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.rej-days { margin-left: auto; flex: none; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 1px 8px;
  background: var(--red-soft); color: var(--red-ink); }
.rej-detail { display: block; font-size: .8rem; color: var(--ink-2); margin: .2rem 0 0 1.05rem; }
.rej-detail b { color: var(--red-ink); }
.rej-foot { margin: 0; padding: .55rem 1rem; font-size: .78rem; color: var(--ink-2); background: var(--surface-2); }

.reject-photo-input { grid-column: 1 / -1; }
.reject-photo-input small { display: block; font-weight: 400; margin-top: .15rem; }

/* ================================================ v1.11: reject photos on the History timeline */
.ev.has-photos { grid-template-columns: 92px minmax(0, 1fr) auto; }
.ev-photos { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: .35rem; max-width: 216px; }
.ev-photos a { display: block; }
.ev-photos img { width: 104px; height: 78px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.ev-photos a:hover img { border-color: var(--accent); }

/* ================================================ v1.12: layouts / QC documents per variant */
.doc-variant { font-size: .8rem; font-weight: 600; color: var(--ink-2); margin: .6rem 0 .2rem; padding-bottom: .15rem; border-bottom: 1px dashed var(--line); }
.doc-variant:first-child { margin-top: 0; }
.doc-variant .mono { color: var(--ink); }
.applies-to { max-width: 520px; }
.applies-to small { display: block; font-weight: 400; margin-top: .15rem; }

/* ================================================ v1.13: colour-coded section cards (Overview + Uploads) */
.ov-cols { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; margin-bottom: .5rem; }
.ov-col-main { flex: 999 1 620px; min-width: 0; display: flex; flex-direction: column; gap: .75rem; }
.ov-col-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: .75rem; }
.card.sec { padding: 0; overflow: hidden; margin-bottom: 0; }
.sec-head { display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); }
.sec-head h2 { margin: 0; font-size: 1rem; }
.sec-icon { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex: none; }
.sec-extra { font-size: .82rem; color: var(--ink-2); margin-left: auto; }
.sec-action { margin-left: auto; }
.sec-extra + .sec-action { margin-left: .5rem; }
.sec-body { padding: .7rem .9rem .8rem; }
.sec-body > .table:first-child { margin-top: -.2rem; }
.sec-pn .sec-head { background: var(--sec-pn-bg); }     .sec-pn h2 { color: var(--sec-pn-ink); }     .sec-pn .sec-icon { background: var(--sec-pn-ink); }
.sec-spec .sec-head { background: var(--sec-spec-bg); } .sec-spec h2 { color: var(--sec-spec-ink); } .sec-spec .sec-icon { background: var(--sec-spec-ink); }
.sec-tool .sec-head { background: var(--sec-tool-bg); } .sec-tool h2 { color: var(--sec-tool-ink); } .sec-tool .sec-icon { background: var(--sec-tool-ink); }
.sec-photo .sec-head { background: var(--sec-photo-bg); } .sec-photo h2 { color: var(--sec-photo-ink); } .sec-photo .sec-icon { background: var(--sec-photo-ink); }
.sec-doc .sec-head { background: var(--sec-doc-bg); }   .sec-doc h2 { color: var(--sec-doc-ink); }   .sec-doc .sec-icon { background: var(--sec-doc-ink); }
.sec-pack .sec-head { background: var(--sec-pack-bg); } .sec-pack h2 { color: var(--sec-pack-ink); } .sec-pack .sec-icon { background: var(--sec-pack-ink); }
[data-theme="dark"] .sec-icon { color: var(--card); }
.note-callout { display: flex; gap: .5rem; margin-top: .75rem; padding: .55rem .75rem; background: var(--note-bg); border: 1px solid var(--note-line);
  border-radius: 8px; font-size: .93rem; }
.note-callout > svg { color: var(--note-ink); flex: none; margin-top: .15rem; }
.sec-note { margin: .6rem 0 0; color: var(--ink-2); }
.sec-pack .fields, .sec-photo .fields { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
p.meta { margin: .2rem .2rem .75rem; }
.sec .tool { padding: .5rem 0; }

/* ---- Uploads: the one "Add a file" box */
.add-file { border-color: var(--accent); }
.add-file h2 { margin: 0 0 .15rem; font-size: 1.1rem; }
.add-intro { margin: 0 0 .8rem; }
.add-step { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: .9rem 0 .4rem; }
.kind-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.kind-tile { position: relative; display: flex; flex-direction: column; gap: .1rem; padding: .6rem .75rem; min-height: 60px; border: 1px solid var(--input-border);
  border-radius: 8px; background: var(--card); cursor: pointer; }
.kind-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind-tile .k-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.kind-tile .k-hint { font-size: .78rem; color: var(--ink-2); }
.kind-tile:hover { border-color: var(--accent); }
.kind-tile:has(input:checked) { background: var(--accent); border-color: var(--accent); }
.kind-tile:has(input:checked) .k-title, .kind-tile:has(input:checked) .k-hint { color: var(--accent-ink); }
.kind-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.add-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem .9rem; align-items: end; }
.add-fields label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.add-fields input, .add-fields select { font: inherit; font-size: .95rem; font-weight: 400; color: var(--ink); padding: .45rem .6rem;
  border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); width: 100%; }
.add-file .inline-check { margin-top: .6rem; font-size: .9rem; display: flex; gap: .45rem; align-items: center; }
#tab-uploads .card.sec, .card.sec { padding: 0; }
.up-grid > #up-docs { grid-column: 1 / -1; }
.ov-col-side .doc-title { white-space: nowrap; }
.ov-col-side .docs-view td { padding-left: .3rem; padding-right: .3rem; }
.ov-col-side .docs-view td.small { display: none; }   /* upload date: shown on the Uploads tab */
.drop-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: stretch; }
.drop-zone { position: relative; flex: 1 1 340px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; padding: 1rem;
  border: 2px dashed var(--input-border); border-radius: 10px; background: var(--surface-2); color: var(--ink-2); cursor: pointer; text-align: center; }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone u { color: var(--accent); font-weight: 600; }
.drop-zone.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-chosen { flex-basis: 100%; font-weight: 600; color: var(--ink); font-size: .9rem; }
.add-go { min-width: 130px; justify-content: center; }
h2.already { font-size: 1rem; margin: 1.2rem .1rem .5rem; }
.up-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: .75rem; align-items: start; }

/* ================================================ v1.14: Ipoh Casting logo, login and top bar */
.brand-logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand .brand-kicker { font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #f08a55; }
.brand .brand-name { font-size: .95rem; font-weight: 600; max-width: none; }
.login-card.branded { border-top: 4px solid var(--brand-orange); padding-top: 1.8rem; }
.login-logo { width: 96px; height: 96px; object-fit: contain; display: block; margin: 0 auto .6rem; }
.login-kicker { font-size: .8rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-orange-ink); }
.login-card.branded h1 { margin: .15rem 0 1.4rem; font-size: 1.35rem; }
.btn.brand-btn { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; justify-content: center; }
.btn.brand-btn:hover { background: var(--brand-orange-hover); border-color: var(--brand-orange-hover); }

/* ---- parts list (1.14): customer, status, then an amber Packing group.
   Column widths are on <col> because the first heading row uses colspan (fixed table layout reads widths from it) */
.parts-table col.c-dot { width: 36px; }
.parts-table col.c-name { width: auto; }
.parts-table col.c-no { width: 14%; }
.parts-table col.c-cust { width: 20%; }
.parts-table col.c-status { width: 108px; }
.parts-table col.c-pqty, .parts-table col.c-pwt, .parts-table col.c-ppn { width: 108px; }   /* three equal packing columns */
.parts-table td.col-cust { color: var(--ink-2); }
.parts-table .col-pack { text-align: center; }
.parts-table td.col-ppn { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; line-height: inherit; vertical-align: middle; }
.parts-table td.col-ppn .muted { font-family: inherit; font-size: 1rem; }
.parts-table .pack-first { border-left: 2px solid var(--pack-line); }
.parts-table thead .col-pack { background: var(--sec-pack-bg); color: var(--sec-pack-ink); }
.parts-table .grp-row th { padding: 0; border-bottom: 0; }
.parts-table .grp-row .grp-pack { background: var(--amber-soft); color: var(--sec-pack-ink); border-left: 2px solid var(--pack-line);
  padding: .35rem .75rem; text-align: center; }
.parts-table .grp-label { display: inline-flex; align-items: center; gap: .35rem; }
.parts-table .grp-row .grp-blank { background: transparent; }

/* ================================================ v1.15: supplier popup, qty unit, photos on any history entry */
button.link.company-link { padding: 0; font: inherit; font-size: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; background: none; border: 0; text-align: left; }
.info-dialog { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem 1.1rem; width: min(440px, calc(100vw - 2rem));
  background: var(--card); color: var(--ink); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.info-dialog::backdrop { background: rgba(10, 14, 19, .45); }
.dlg-head { display: flex; align-items: center; gap: .5rem; }
.dlg-head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.dlg-close { width: 36px; height: 36px; border: 0; background: transparent; color: var(--ink-2); font-size: 1.1rem; cursor: pointer; border-radius: 8px; }
.dlg-close:hover { background: var(--hover); }
.dlg-sub { margin: .1rem 0 .8rem; }
.dlg-list { display: grid; grid-template-columns: 90px 1fr; gap: .45rem .8rem; margin: 0; }
.dlg-list dt { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding-top: .15rem; }
.dlg-list dd { margin: 0; overflow-wrap: anywhere; }
.dlg-foot { margin: .9rem 0 0; font-size: .9rem; }
.qty-unit { display: flex; gap: .4rem; }
.qty-unit input { flex: 1; min-width: 0; }
.qty-unit select { width: auto; flex: none; }
.history-photo-input small { display: block; font-weight: 400; margin-top: .15rem; }

.clone-box { border-color: var(--accent); background: var(--accent-soft); }
.clone-box p { margin: 0 0 .5rem; }
.clone-box .inline-check { display: flex; gap: .45rem; align-items: center; margin: .25rem 0; }
.part-head-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

/* change log: reject and correction entries stand out (1.17) */
.log-reject { color: var(--red-ink); font-weight: 700; }
.log-correction { color: var(--green-ink); font-weight: 700; }

/* Users › Email reminders (1.17) */
.remind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-items: start; }
.remind-people { list-style: none; margin: 0 0 .5rem; padding: 0; }
.remind-people li { padding: .35rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.remind-send { flex-wrap: wrap; align-items: center; }
.remind-send form { margin: 0; }
.cron-cmd { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .55rem .7rem; font-size: .82rem; white-space: pre-wrap; word-break: break-all; user-select: all; }

/* ================================================ 1.19.0: GRID THEME
   One block that re-skins the whole app: charcoal top bar, light grey work area, white panels with a thin
   border and a grey title strip, one blue accent, labels in a shaded column, tables with plain row lines,
   right-aligned numbers and fixed-width digits so columns line up.
   Delete this block (down to the "phones" block) to go back to the 1.18 look. */
html:not([data-theme="dark"]) {   /* light colours (the dark ones are in the next block) */
  --bg: #eef0f3;
  --card: #ffffff;
  --ink: #374151;            /* body text: dark grey, not black */
  --ink-head: #111827;       /* headings and key values */
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;           /* row lines inside tables */
  --panel-line: #d5d9df;     /* panel borders, a shade darker so each block has a clear frame */
  --strip: #f5f6f8;          /* panel title strips */
  --label-bg: #fafbfc;       /* shaded label column and table headers */
  --accent: #2453c9;
  --accent-hover: #1c43a6;
  --accent-soft: #eef4ff;
  --hover: #f5f7fa;
  --tag-bg: #f0f1f4;
  --input-border: #d1d5db;
}
:root {
  --radius: 6px;
  --shadow: none;
  --charcoal: #3d4249;       /* top bar */
  --charcoal-2: #575d66;     /* selected menu item, bell border */
  --charcoal-3: #4a5058;     /* menu hover */
  --charcoal-ink: #d6d9de;   /* menu text */
  --pack-bg: var(--label-bg); --pack-border: var(--panel-line);
  /* section cards: same neutral strip for every section (one accent colour only) */
  --sec-pn-ink: var(--charcoal);    --sec-pn-bg: var(--strip);
  --sec-spec-ink: var(--charcoal);  --sec-spec-bg: var(--strip);
  --sec-tool-ink: var(--charcoal);  --sec-tool-bg: var(--strip);
  --sec-photo-ink: var(--charcoal); --sec-photo-bg: var(--strip);
  --sec-doc-ink: var(--charcoal);   --sec-doc-bg: var(--strip);
  --sec-pack-ink: var(--charcoal);  --sec-pack-bg: var(--strip);
  --font: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}
[data-theme="dark"] {
  --ink-head: #f3f4f6;
  --panel-line: #333d4a;
  --strip: #1e2630;
  --label-bg: #1b222b;
  --accent: #7ea2f5;
  --accent-hover: #9ab6f7;
  --accent-soft: #1e2a45;
  --accent-ink: #0f141b;
  --charcoal: #22262c;
  --charcoal-2: #3a4049;
  --charcoal-3: #2e333a;
  --sec-pn-ink: #c3cad4; --sec-spec-ink: #c3cad4; --sec-tool-ink: #c3cad4; --sec-photo-ink: #c3cad4; --sec-doc-ink: #c3cad4; --sec-pack-ink: #c3cad4;
}

/* ---- type: tabular digits everywhere so numbers and dates line up in columns */
body { font-family: var(--font); font-variant-numeric: tabular-nums; }
.mono, .parts-table td.col-no, .parts-table td.col-ppn, .rev { font-family: var(--font-mono); }
h1, h2, h3, .part-head h1, .doc-title, .parts-table .col-name a { color: var(--ink-head); }
h1 { font-size: 1.45rem; }

/* ---- top bar: charcoal */
.topbar, [data-theme="dark"] .topbar { background: var(--charcoal); border-bottom: 0; height: 52px; }
.mainnav a, .userbox a { color: var(--charcoal-ink); }
.mainnav a:hover { background: var(--charcoal-3); }
.mainnav a.on, .topbar .role { background: var(--charcoal-2); color: #fff; }
.theme-toggle, .rej-alert > summary { border-color: var(--charcoal-2); color: var(--charcoal-ink); }
.theme-toggle:hover, .rej-alert > summary:hover, .rej-alert[open] > summary { background: var(--charcoal-3); }
.rej-count, .rej-ok, [data-theme="dark"] .rej-count, [data-theme="dark"] .rej-ok { border-color: var(--charcoal); }
.jump { top: 52px; }
.login-body, [data-theme="dark"] .login-body { background: var(--charcoal); }

/* ---- panels: thin border instead of a shadow, square-ish corners */
.card, .empty { border: 1px solid var(--panel-line); border-radius: var(--radius); box-shadow: none; }
body > .wrap > .table, .parts-table, .tooling-list, .table.companies { border: 1px solid var(--panel-line); border-radius: var(--radius); box-shadow: none; }
.sec-head { background: var(--strip); border-bottom: 1px solid var(--panel-line); padding: .45rem .8rem; }
.sec-head h2, .sec-pn h2, .sec-spec h2, .sec-tool h2, .sec-photo h2, .sec-doc h2, .sec-pack h2 {
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-head); }
.sec-icon { width: 22px; height: 22px; border-radius: 5px; }
.sec-icon svg { width: 13px; height: 13px; }
.sec-extra { font-size: .8rem; color: var(--muted); }
.sec-body { padding: .6rem .8rem .7rem; }
.ov-cols, .ov-col-main, .ov-col-side, .up-grid { gap: .6rem; }
.wrap { padding: .9rem 1.25rem; }

/* ---- Specification / Packing: label in a shaded column on the left, value on the right, a line under each row */
.sec .fields { display: block; margin: -.6rem -.8rem 0; }
.sec .fields + *, .sec .note-callout { margin-top: .6rem; }
.sec .field { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; border-bottom: 1px solid var(--line); }
.sec .field:last-child { border-bottom: 0; }
.sec .field .lbl { background: var(--label-bg); border-right: 1px solid var(--line); padding: .4rem .8rem;
  font-size: .85rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.sec .field .val { padding: .4rem .8rem; font-size: .93rem; color: var(--ink-head); }
.sec-pack .fields, .sec-photo .fields { display: block; }   /* beat the older auto-fill grid */
.sec .fields:has(+ .note-callout), .sec .fields:has(+ .sec-note) { border-bottom: 1px solid var(--line); }
.note-callout { background: var(--label-bg); border: 1px solid var(--line); border-radius: var(--radius); }
.note-callout > svg { color: var(--muted); }

/* ---- tables: plain row lines, small grey headings in sentence case, no zebra */
.table th { text-transform: none; letter-spacing: 0; font-size: .8rem; font-weight: 600; color: var(--muted);
  background: var(--label-bg); border-bottom: 1px solid var(--panel-line); }
.table td { border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: 0; }
.parts-table tbody tr:hover td { background: var(--hover); }
.parts-table td.col-cust { color: var(--ink-2); }
/* numbers right-aligned (packing qty and weight in the parts list), headings aligned with their column */
.parts-table .col-pqty, .parts-table .col-pwt { text-align: right; }
.table .td-num, .table .th-num { text-align: right; }

/* ---- buttons, inputs, tags: same shapes everywhere */
.btn { border-radius: var(--radius); border-color: var(--input-border); padding: .45rem .85rem; }
.btn.small { padding: .25rem .6rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea,
.filter-bar input, .filter-bar select, .pn-table input, .pn-table select { border-radius: var(--radius); border-color: var(--input-border); box-shadow: none; }
.filter-bar input { font-size: 1rem; }
.tag, .status-pill, .fcb, .fcs, .count, .rej-days { border-radius: 4px; }
.chip { border-radius: 999px; border-color: var(--input-border); }
.tabs { border-bottom: 1px solid var(--panel-line); }
.tabs a { border-bottom-width: 2px; margin-bottom: -1px; }
.tabs a.on { color: var(--ink-head); border-color: var(--accent); }

/* ---- part header: white band with the photo, name, numbers and buttons together */
.part-head { padding: .65rem .9rem; }
.part-head-img { width: 84px; height: 84px; border: 1px solid var(--line); }
.part-head-img { border-radius: var(--radius); }
.part-head-actions .btn:first-child { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---- open reject: a red bar down the left edge */
.alert-rejects { border: 1px solid var(--alert-border); border-left: 4px solid var(--red); }
.alert-rejects .ar-item { border-radius: var(--radius); }
.reject { border-radius: var(--radius); }


/* ---- part page (1.19): header band = photo, name and buttons, a strip of key facts, then the tabs */
.part-band { padding: 0; overflow: hidden; margin-bottom: .6rem; }
.part-band .part-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .7rem 1rem; }
.part-band .part-head-img { width: 64px; height: 64px; flex: none; }
.part-band .part-head-main { min-width: 0; }
.part-title { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.part-title h1 { margin: 0; font-size: 1.4rem; }
.part-band .part-head-nos { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin: .15rem 0 .35rem; font-size: .92rem; }
.part-band .part-head-nos .mono { color: var(--ink-head); }
.part-head-cust { color: var(--muted); }
.part-band .part-head-tags .tag, .part-band .status-pill { font-size: .75rem; padding: 2px 8px; }
.part-band .part-head-actions { margin-left: 1.5rem; align-self: flex-start; margin-top: .3rem; }
.part-head-actions .btn:first-child { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.part-facts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); }
.part-facts > div { padding: .45rem 1rem; border-right: 1px solid var(--line); min-width: 0; }
.part-facts > div:last-child { border-right: 0; }
.part-facts dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.part-facts dd { margin: .1rem 0 0; font-weight: 600; color: var(--ink-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-facts dd a:hover { text-decoration: none; }
.part-band .tabs { margin: 0; padding: 0 1rem; gap: 1.2rem; border-top: 1px solid var(--line); border-bottom: 0; }
.part-band .tabs a { padding: .55rem .1rem; }

/* ---- overview panels on a 12-column grid; panels in a row stretch to the same height */
.ov-grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .6rem; align-items: stretch; margin-bottom: .5rem; }
.ov-grid12 > div { display: flex; min-width: 0; }
.ov-grid12 > div > .card { flex: 1; margin: 0; display: flex; flex-direction: column; min-width: 0; }
.ov-grid12 .sec-body { flex: 1; }
.g-spec { grid-column: span 4; }  .g-pack { grid-column: span 3; }  .g-pn { grid-column: span 5; }
.g-doc { grid-column: span 7; }   .g-hist { grid-column: span 5; }
.g-tool { grid-column: span 7; }  .g-photo { grid-column: span 5; }
@media (max-width: 1100px) {
  .g-spec, .g-pack { grid-column: span 6; }
  .g-pn, .g-doc, .g-hist, .g-tool, .g-photo { grid-column: span 12; }
}
/* Documentation: each group (layouts, QC, flow chart) gets a grey heading strip across the panel */
.sec-doc h3.sub { margin: .5rem -.8rem .25rem; padding: .3rem .8rem; background: var(--label-bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink-2); }
.sec-doc h3.sub.first { margin-top: -.6rem; border-top: 0; }
/* Packing notes: a footer strip */
.sec-pack .sec-note { margin: 0 -.8rem -.7rem; padding: .45rem .8rem; background: var(--label-bg); border-top: 1px solid var(--line); }
/* Recent history panel */
.sec-hist .sec-icon { background: var(--sec-pn-ink); }
.hist-view td { vertical-align: top; }
.hist-reject { background: var(--red-soft); color: var(--red-ink); }
.hist-correction, .hist-fai, .hist-resolved { background: var(--green-soft); color: var(--green-ink); }
.hist-modification { background: var(--amber-soft); color: var(--amber-ink); }
.hist-revision { background: var(--accent-soft); color: var(--accent); }

/* ================================================ 1.20.0 */
/* ---- colours used below, light and dark */
html:not([data-theme="dark"]) {
  --pk-bg: #fdf6e3; --pk-head: #fbefc8; --pk-ink: #8a6200; --pk-line: #e8c98f;   /* packing: light yellow */
}
[data-theme="dark"] {
  --pk-bg: #262117; --pk-head: #3a3018; --pk-ink: #e8c36b; --pk-line: #6b5426;
}
:root { --pack-line: var(--pk-line); --sec-pack-bg: var(--pk-bg); --sec-pack-ink: var(--pk-ink); }

/* ---- parts list: packing columns shaded light yellow, under a darker yellow "Packing" heading, amber line on the left */
.parts-table td.col-pack { background: var(--pk-bg); }
.parts-table tbody tr:hover td.col-pack { background: var(--pk-head); }
.parts-table thead .col-pack { background: var(--pk-bg); color: var(--pk-ink); }
.parts-table .grp-row .grp-pack { background: var(--pk-head); color: var(--pk-ink); font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; font-size: .72rem; border-bottom: 1px solid var(--pk-line); }
.parts-table .pack-first, .parts-table .grp-row .grp-pack { border-left: 2px solid var(--pk-line); }

/* ---- part page: each section has its own soft colour, stepping gently round the colour wheel.
   --st = title strip tint, --sl = label column / table heading tint, --sd = deep tone for the title, icon and left edge.
   To change a section's colour, change its three values here. */
.sec { --st: #f1f2f5; --sl: #fafbfc; --sd: #3d4249; }
.sec-spec  { --st: #e6eefb; --sl: #f6f9fe; --sd: #2a5bb0; }   /* blue */
.sec-pack  { --st: #fbefc8; --sl: #fefaee; --sd: #8a6200; }   /* yellow, as the parts list */
.sec-pn    { --st: #eae9fb; --sl: #f8f7fe; --sd: #4b46a8; }   /* lavender */
.sec-doc   { --st: #ddf2ef; --sl: #f3fbfa; --sd: #13706a; }   /* teal */
.sec-hist  { --st: #f1e7f8; --sl: #fbf7fd; --sd: #74389a; }   /* purple */
.sec-tool  { --st: #e3f3e8; --sl: #f5fbf7; --sd: #2d7a45; }   /* green */
.sec-photo { --st: #eceef2; --sl: #f8f9fa; --sd: #4b5563; }   /* grey */
[data-theme="dark"] .sec       { --st: #262c35; --sl: #1e232a; --sd: #c3cad4; }
[data-theme="dark"] .sec-spec  { --st: #1d2a40; --sl: #19212d; --sd: #8fb3f0; }
[data-theme="dark"] .sec-pack  { --st: #3a3018; --sl: #262117; --sd: #e8c36b; }
[data-theme="dark"] .sec-pn    { --st: #27264a; --sl: #1f1f33; --sd: #b2aef0; }
[data-theme="dark"] .sec-doc   { --st: #163432; --sl: #152523; --sd: #6fd0c8; }
[data-theme="dark"] .sec-hist  { --st: #33233f; --sl: #241c2c; --sd: #c9a3e6; }
[data-theme="dark"] .sec-tool  { --st: #1b3324; --sl: #172519; --sd: #7fd19a; }
[data-theme="dark"] .sec-photo { --st: #262c35; --sl: #1e232a; --sd: #c3cad4; }
.sec .sec-head { background: linear-gradient(90deg, var(--st) 0%, var(--sl) 100%); box-shadow: inset 3px 0 0 var(--sd); }
.sec .sec-head h2 { color: var(--sd); }
.sec .sec-icon { background: var(--sd); color: var(--card); }
.sec .field .lbl, .sec .table th, .sec-doc h3.sub, .sec-pack .sec-note, .sec .note-callout { background: var(--sl); }

/* ---- list pages (Tooling): one white panel with saved-view tabs, a tool bar, the table and a footer */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.txt-red { color: var(--red-ink); }
a.strong-link { color: var(--ink-head); font-weight: 600; }
.list-page { padding: 0; overflow: visible; }
.list-head { padding: .7rem 1rem .2rem; }
.list-head h1 { margin: 0; font-size: 1.35rem; }
.list-head h1 .muted { font-weight: 500; }
.view-tabs { display: flex; flex-wrap: wrap; gap: .15rem; padding: .4rem 1rem 0; border-bottom: 1px solid var(--panel-line); background: var(--label-bg); }
.view-tabs a { padding: .45rem .85rem; color: var(--ink-2); border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; }
.view-tabs a:hover { text-decoration: none; color: var(--ink-head); }
.view-tabs a.on { background: var(--card); border-color: var(--panel-line); color: var(--ink-head); font-weight: 600; }
.vt-n { color: var(--muted); font-weight: 400; font-size: .85em; margin-left: .15rem; }
.view-tabs a.warn .vt-n { color: var(--red-ink); font-weight: 700; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--panel-line); }
.lt-search { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--input-border); border-radius: var(--radius); padding: 0 .6rem;
  height: 34px; min-width: 260px; background: var(--input-bg); color: var(--muted); }
.lt-search input { border: 0; outline: 0; font: inherit; flex: 1; background: transparent; color: var(--ink); min-width: 0; }
.lt-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.list-tools select { font: inherit; height: 34px; padding: 0 .5rem; border: 1px solid var(--input-border); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.list-tools select.chosen { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.report-pop { margin-left: auto; position: relative; }
.report-pop > summary { list-style: none; }
.report-pop > summary::-webkit-details-marker { display: none; }
.report-pop-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; padding: .8rem; display: flex; flex-direction: column; gap: .5rem;
  background: var(--card); border: 1px solid var(--panel-line); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(16,24,40,.18); }
.report-pop-body p { margin: 0; }
.report-pop-body label:not(.inline-check) { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.report-pop-body select { width: 100%; }
.report-pop-body .btn { justify-content: center; }
.list-page .table-scroll { overflow-x: auto; }
.list-page .tooling-list { border: 0; border-radius: 0; }
.list-page .empty { border: 0; border-radius: 0; }
.list-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; padding: .55rem 1rem; border-top: 1px solid var(--panel-line);
  font-size: .82rem; color: var(--muted); background: var(--label-bg); border-radius: 0 0 var(--radius) var(--radius); }
.tooling-list .grp-row th { background: var(--strip); color: var(--ink-head); font-size: .85rem; font-weight: 700; padding: .4rem 1rem;
  border-top: 1px solid var(--panel-line); border-bottom: 1px solid var(--panel-line); }
.tooling-list .grp-row .muted { font-weight: 400; margin-left: .4rem; }
.tooling-list td:first-child, .tooling-list th:first-child { padding-left: 1rem; }
.tooling-list .thumb-cell { width: 64px; }

/* ---- tool condition: five small bars and a word, red when it needs attention */
.cond { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.cond-bars { display: inline-flex; gap: 2px; }
.cond-bars i { width: 7px; height: 12px; border-radius: 1px; background: var(--line); }
.cond-bars i.on { background: var(--ink-2); }
.cond-bad { color: var(--red-ink); font-weight: 600; }
.cond-bad .cond-bars i.on { background: var(--red); }
.cond-none { color: var(--muted); }

/* ================================================ 1.21.0 */
/* ---- tool condition bars coloured by the rating: 1 red, 2 orange, 3 amber, 4 light green, 5 green */
.cond-r1 .cond-bars i.on { background: #dc2626; }
.cond-r2 .cond-bars i.on { background: #ea580c; }
.cond-r3 .cond-bars i.on { background: #ca8a04; }
.cond-r4 .cond-bars i.on { background: #65a30d; }
.cond-r5 .cond-bars i.on { background: #16a34a; }
[data-theme="dark"] .cond-r1 .cond-bars i.on { background: #f87171; }
[data-theme="dark"] .cond-r2 .cond-bars i.on { background: #fb923c; }
[data-theme="dark"] .cond-r3 .cond-bars i.on { background: #facc15; }
[data-theme="dark"] .cond-r4 .cond-bars i.on { background: #a3e635; }
[data-theme="dark"] .cond-r5 .cond-bars i.on { background: #4ade80; }

/* ---- part page, Documentation > Flow chart: one line of title, status and buttons, then the approved chart's own little flow */
.fc-top { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; padding: .15rem 0; }
a.fc-title { font-weight: 700; font-size: 1rem; color: var(--ink-head); }
.fc-rev { color: var(--accent); }
.fc-btns { margin-left: auto; display: flex; gap: .35rem; }
.fc-note { margin: .25rem 0 0; }
/* the little flow: always on white with black captions, like the printout */
a.fc-strip { display: block; margin: .5rem 0 .2rem; padding: .65rem .55rem .55rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; overflow-x: auto; }
a.fc-strip:hover { border-color: var(--accent); text-decoration: none; }
.fs { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .6rem 0; }
.fs-step { width: 96px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.fs-step img, .fs-none { width: 54px; height: 54px; object-fit: contain; display: block; }
.fs-none { border: 1px dashed #c8ccd2; border-radius: 10px; display: grid; place-items: center; color: #9ca3af; }
.fs-cap { margin-top: .3rem; font-family: "Times New Roman", Times, serif; font-size: .68rem; text-transform: uppercase; line-height: 1.15; color: #000; }
.fs-cap.altered { color: #c2410c; }       /* changed on this chart (renamed, OPT, subcontracted) */
.fs-sub { display: block; font-style: italic; text-transform: none; font-size: .62rem; }
.fs-arr { width: 20px; height: 54px; display: grid; place-items: center; color: #374151; flex: none; }
.fs-ins { display: flex; flex-direction: column; justify-content: center; gap: .3rem; min-height: 54px; }
.fs-in { display: flex; align-items: center; gap: .35rem; width: 112px; }
.fs-in img, .fs-in .fs-none { width: 28px; height: 28px; }
.fs-in .fs-cap { margin: 0; text-align: left; font-size: .6rem; }
.fs-arr-in { width: 16px; }
.fc-strip-note { margin: .1rem 0 .35rem; }
@media (max-width: 700px) {
  .fs-step { width: 78px; }
  .fs-step img, .fs-step .fs-none { width: 44px; height: 44px; }
  .fs-arr { height: 44px; width: 16px; }
}

/* ================================================ 1.22.0: ASSEMBLIES */
/* ---- section colours for the bill of materials (same idea as the part page sections) */
.sec-own  { --st: #dceef7; --sl: #f2f9fc; --sd: #0e6a8c; }   /* our parts: steel blue */
.sec-buy  { --st: #fde6d8; --sl: #fff6f0; --sd: #b4501b; }   /* bought-in: orange */
.sec-calc { --st: #e4e8f7; --sl: #f6f7fd; --sd: #3346a3; }   /* order calculator: indigo */
[data-theme="dark"] .sec-own  { --st: #14303b; --sl: #15242b; --sd: #7cc7e6; }
[data-theme="dark"] .sec-buy  { --st: #3b2316; --sl: #2a1b13; --sd: #f2a36f; }
[data-theme="dark"] .sec-calc { --st: #232a4a; --sl: #1c2133; --sd: #a9b5f2; }
.g-full { grid-column: 1 / -1; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.g-full > .card, .ov-grid12 > .g-full > .card { margin: 0; flex: none; }   /* full-width sections keep their own height */
.ov-grid12 > .g-full { display: flex; }
.tag-asm { background: #e0f0f7; color: #0e6a8c; border-radius: 4px; }
[data-theme="dark"] .tag-asm { background: #14303b; color: #7cc7e6; }
.costing-down { margin: 0; }
.strong { font-weight: 700; color: var(--ink-head); }

/* ---- small tags: variants ("used in"), origin, component group colour */
.vchip { display: inline-block; padding: 0 6px; border: 1px solid var(--panel-line); border-radius: 4px; font-size: .75rem; color: var(--ink-2); background: var(--card); white-space: nowrap; }
.vchip.one { border-color: #b9c7f0; background: var(--accent-soft); color: var(--accent); }
.vchips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.org { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.org-local { background: #e4f5ea; color: #14653a; }
.org-asean { background: #fdf1d6; color: #8a6200; }
.org-imported { background: #fde4e4; color: #a12727; }
[data-theme="dark"] .org-local { background: #173322; color: #86d9a3; }
[data-theme="dark"] .org-asean { background: #3a3018; color: #e8c36b; }
[data-theme="dark"] .org-imported { background: #3d1c1c; color: #f2a0a0; }
.grp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

/* ---- bill of materials tables */
.bom-view td { vertical-align: middle; }
.bom-view td.td-num { white-space: nowrap; }
details.calc > summary .sec-action { margin-left: auto; }
.bom-item { min-width: 220px; }
.bom-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; margin-right: 8px; background: var(--card); }
.bom-thumb.none { display: inline-block; background: var(--label-bg); }
tr.bom-missing td { background: var(--red-soft); }

/* ---- pop-up boxes that open under a button (Add part, Edit a line, order lot) */
details.pop { position: relative; display: inline-block; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop > summary.link { color: var(--accent); }
.pop-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 340px; padding: .8rem; text-align: left; white-space: normal;
  display: flex; flex-direction: column; gap: .5rem; background: var(--card); border: 1px solid var(--panel-line); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(16,24,40,.18); font-size: .9rem; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; }
.pop-body form { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.pop-body p { margin: 0; }
.pop-body label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.pop-body select, .pop-body input[type=number] { font: inherit; height: 32px; padding: 0 .5rem; border: 1px solid var(--input-border); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.pop-body input[type=number] { width: 90px; text-align: right; }
.pop-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.qty-unit { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; }
.sec-head .pop-body { width: 420px; }

/* ---- order calculator: a section that opens and closes (starts closed) */
details.calc { margin: 0; }
details.calc > summary { list-style: none; cursor: pointer; }
details.calc > summary::-webkit-details-marker { display: none; }
details.calc .calc-close, details.calc[open] .calc-open, details.calc[open] .calc-hint { display: none; }
details.calc[open] .calc-close { display: inline-flex; }
details.calc:not([open]) > summary { border-bottom: 0; }
.calc-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 1.4rem; padding: .7rem .8rem; margin: -.6rem -.8rem .6rem;
  background: var(--sl); border-bottom: 1px solid var(--line); }
.calc-controls .lbl { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .25rem; }
.calc-qty-row { display: flex; gap: .35rem; align-items: center; }
#calcQty { width: 110px; height: 36px; font: inherit; font-size: 1.1rem; font-weight: 700; text-align: right; padding: 0 .6rem;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--input-bg); color: var(--ink-head); }
.seg { display: inline-flex; border: 1px solid var(--input-border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg label { margin: 0; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--input-border); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; height: 32px; padding: 0 .8rem; font-size: .88rem; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.calc-out { margin-left: auto; display: flex; gap: .4rem; }
.calc-results { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1rem; }
.calc-results h3 { margin: 0 0 .3rem; font-size: .9rem; }
.calc-own h3 { color: #0e6a8c; }
.calc-buy h3 { color: #b4501b; }
[data-theme="dark"] .calc-own h3 { color: #7cc7e6; }
[data-theme="dark"] .calc-buy h3 { color: #f2a36f; }
.calc-results .table, .order-table { border: 1px solid var(--line); border-radius: var(--radius); }
tr.sup-row th { background: var(--strip); color: var(--ink-head); font-weight: 700; text-align: left; font-size: .85rem; }
tr.sup-row th .muted { font-weight: 400; margin-left: .3rem; }

/* ---- component lists (Components page and Add a component) */
.comp-browser { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 420px; }
.comp-groups { border-right: 1px solid var(--line); padding: .6rem; background: var(--label-bg); display: flex; flex-direction: column; gap: 1px; }
.comp-groups .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .1rem .3rem .35rem; }
a.cg { display: flex; align-items: center; gap: .45rem; padding: .35rem .5rem; border-radius: 5px; color: var(--ink); }
a.cg:hover { background: var(--hover); text-decoration: none; }
a.cg.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
a.cg i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
a.cg span { margin-left: auto; color: var(--muted); font-weight: 400; font-size: .8rem; }
.comp-main { min-width: 0; }
.comp-table { border: 0; border-radius: 0; }
.comp-table tbody tr { cursor: default; }
.comp-table tr.sel td { background: var(--accent-soft); }
.comp-page .list-head p { margin: .2rem 0 .4rem; }
.pick-foot { position: sticky; bottom: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem 1.2rem; padding: .7rem 1rem;
  background: var(--label-bg); border-top: 1px solid var(--panel-line); border-radius: 0 0 var(--radius) var(--radius); }
.pick-foot label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.pick-foot input[type=number], .pick-foot select { font: inherit; height: 34px; padding: 0 .5rem; border: 1px solid var(--input-border); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.pick-foot input[type=number] { width: 90px; text-align: right; }
.pick-chosen { flex: 1 1 100%; }
.pick-btns { margin-left: auto; display: flex; gap: .4rem; }

/* ---- assemblies list */
.asm-table { table-layout: auto; }
.asm-table .thumb-cell { width: 52px; }
.asm-table .thumb-cell img { width: 40px; height: 40px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); display: block; }

/* ---- order list page (print) */
.order-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.order-head h1 { margin: 0 0 .2rem; font-size: 1.3rem; }
.order-sub { font-size: 1rem; margin: 1rem 0 .4rem; }
.tick-col { width: 36px; text-align: center; }
@media print {
  .topbar, .foot, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .order-sheet { border: 0; box-shadow: none; padding: 0; }
  .order-table { border-color: #999; }
  .order-table td, .order-table th { border-bottom: 1px solid #bbb; }
  .tick-col { border-left: 1px solid #bbb; }
}

/* ---- phones */
@media (max-width: 700px) {
  .comp-browser { grid-template-columns: 1fr; }
  .comp-groups { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .comp-groups .lbl { display: none; }
  a.cg { white-space: nowrap; padding-left: .5rem !important; }
  .calc-results { grid-template-columns: 1fr; }
  .calc-results .table { display: block; overflow-x: auto; }
  /* bill of materials and component lists as cards: one line per value, label on the left */
  .bom-view, .comp-table, .bom-view tbody, .comp-table tbody { display: block; width: 100%; border: 0; }
  .bom-view thead, .comp-table thead { display: none; }
  .bom-view tr, .comp-table tr { display: block; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  .bom-view td, .comp-table td { display: flex; gap: .6rem; justify-content: space-between; align-items: baseline; border: 0 !important;
    padding: .12rem 0 !important; text-align: right !important; white-space: normal; }
  .bom-view td::before, .comp-table td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .8rem; text-align: left; font-family: var(--font); font-weight: 400; }
  .bom-view td.bom-item, .comp-table td:first-child { display: block; text-align: left !important; font-size: 1rem; }
  .bom-view td.bom-item::before, .comp-table td:first-child::before, .bom-view td.actions::before, .bom-view td[data-label=""]::before { content: none; }
  .bom-view td.actions { justify-content: flex-start; padding-top: .3rem !important; }
  .bom-view td.bom-item .small { text-align: left; }
  .calc-out { margin-left: 0; }
  .pop-body, .sec-head .pop-body { position: fixed; left: .6rem; right: .6rem; top: auto; bottom: .6rem; width: auto; }
}

/* ================================================ 1.23.0 */
/* ---- order calculator as a pop-up window (opened by the "Order calculator" button in the assembly header) */
dialog.calc-dialog { width: min(1120px, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--panel-line); border-radius: 8px;
  background: var(--card); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; }
dialog.calc-dialog[open] { display: flex; flex-direction: column; }
dialog.calc-dialog::backdrop { background: rgba(17,24,39,.5); }
.calc-dlg-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--panel-line);
  background: linear-gradient(90deg, var(--st) 0%, var(--sl) 100%); box-shadow: inset 3px 0 0 var(--sd); }
.calc-dlg-head h2 { margin: 0; font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--sd); }
.calc-dlg-head h2 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.calc-dlg-head .sec-icon { background: var(--sd); color: var(--card); }
.calc-x { margin-left: auto; }
.calc-body { padding: .9rem; overflow: auto; }
.calc-results td.td-num, .order-table td.td-num { white-space: nowrap; }
.calc-body .calc-controls { margin: -.9rem -.9rem .8rem; padding: .8rem .9rem; }
.btn-calc svg { width: 15px; height: 15px; margin-right: .3rem; vertical-align: -2px; }

/* ---- Add part: type to filter the long list */
.opt-filter { width: 100%; font: inherit; font-weight: 400; height: 34px; padding: 0 .6rem; border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--input-bg); color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
select.opt-list { width: 100%; height: auto; min-height: 9.5rem; padding: .2rem; font-weight: 400; }
select.opt-list optgroup { font-weight: 700; color: var(--ink-head); }
select.opt-list option { font-weight: 400; padding: .15rem .3rem; }

/* ---- parts used in an assembly: "Refer to assembly" where the packing would be */
.parts-table td.col-refer { text-align: left; font-style: italic; color: var(--pk-ink); }
.parts-table td.col-refer a { font-style: normal; font-weight: 600; }
.refer-asm { margin: 0 0 .5rem; padding: .45rem .6rem; border-radius: var(--radius); background: var(--sl); border: 1px solid var(--line); font-style: italic; }
.refer-asm a { font-style: normal; font-weight: 600; }
@media (max-width: 700px) {
  .parts-table td.col-refer { grid-column: 1 / -1; padding-left: 30px; }
  .parts-table.asm-table tr { grid-template-columns: 30px 52px repeat(2, minmax(0, 1fr)); }
  .parts-table.asm-table td.thumb-cell { grid-column: 2; grid-row: 1 / 3; padding-top: .55rem; }
  .parts-table.asm-table td.col-name { grid-column: 3; white-space: normal; }
  .parts-table.asm-table td.col-status { grid-column: 4; }
  .parts-table.asm-table td:nth-child(4) { grid-column: 3; grid-row: 2; padding-bottom: .5rem; }
  .parts-table.asm-table td.col-cust { grid-column: 4; grid-row: 2; text-align: right; }
  .parts-table.asm-table td.td-num { display: none; }
  dialog.calc-dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
}

/* ================================================ 1.23.1: part picker (Add part on an assembly) */
details.pop-wide .pop-body { width: 560px; }
.pick-search { width: 100%; font: inherit; font-weight: 400; height: 36px; padding: 0 .65rem; border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--input-bg); color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.pick-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--panel-line); border-radius: var(--radius); background: var(--card); }
.pick-row { display: grid !important; grid-template-columns: 18px 32px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr); align-items: center; gap: .55rem;
  padding: .35rem .6rem; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 400 !important; color: var(--ink) !important; font-size: .9rem !important; }
.pick-row:last-of-type { border-bottom: 0; }
.pick-row[hidden] { display: none !important; }   /* filtered out */
.pop-body .qty-unit input[type=number] { width: 90px !important; flex: none; }
.pop-body select { width: auto !important; max-width: 100%; }
.pick-row:hover { background: var(--hover); }
.pick-row.on, .pick-row:has(input:checked) { background: var(--accent-soft); }
.pick-row input { margin: 0; }
.pick-row img, .pick-row .pr-img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--label-bg); display: block; }
.pick-row .pr-name { font-weight: 600; color: var(--ink-head); }
.pick-row .pr-no { color: var(--ink-head); }
.pick-row .pr-var { color: var(--ink-2); }
.pick-none { margin: 0; padding: .7rem; }
@media (max-width: 700px) {
  details.pop .pop-body { width: auto !important; max-height: 85vh; overflow-y: auto; }
  .pick-list { max-height: 40vh; }
  .pick-row { grid-template-columns: 18px 32px minmax(0, 1fr) auto; }
  .pick-row .pr-var { grid-column: 3 / -1; font-size: .8rem; }
}

/* ==========================================================================================
   1.24  First article inspection (fai.php, fai_balloon.php)
   ========================================================================================== */
.flash-warn { background: var(--amber-soft); color: var(--amber-ink); }
.sec-fai   { --st: #e0f0ea; --sl: #f4fbf8; --sd: #1d6b4f; }   /* FAI green-teal */
[data-theme="dark"] .sec-fai { --st: #163328; --sl: #14231d; --sd: #74d3ac; }
.tag.fai-draft    { background: var(--tag-bg); color: var(--ink-2); }
.tag.fai-passed   { background: var(--accent-soft); color: var(--accent); }
.tag.fai-sent     { background: var(--amber-soft); color: var(--amber-ink); }
.tag.fai-approved { background: var(--green-soft); color: var(--green-ink); }
.tag.fai-rejected { background: var(--red-soft); color: var(--red-ink); }
.tag.fai-complete { background: #1d6b4f; color: #fff; }
.tag-fai-warn { background: var(--red-soft); color: var(--red-ink); text-decoration: none; }
.seg a, .seg button { display: inline-flex; align-items: center; height: 30px; padding: 0 .75rem; font: inherit; font-size: .85rem; border: 0; background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; }
.seg a + a, .seg button + button { border-left: 1px solid var(--input-border); }
.seg a.on, .seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 2px 5px; border-radius: 4px; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.btn.wide { width: 100%; justify-content: center; }
.btn.ok { background: #1d6b4f; border-color: #1d6b4f; color: #fff; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.fai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.fai-toolbar { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.fai-toolbar h1 { margin: 0; font-size: 1.3rem; }
.fai-toolbar .spacer, .bal-bar .spacer { flex: 1; }
/* the report looks like the printed form */
.fai-sheet { background: #fff; color: #111827; border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 26px 30px; max-width: 1000px; margin: 0 auto; }
[data-theme="dark"] .fai-sheet { background: #fdfdfd; }
.fai-lh { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #111827; padding-bottom: 8px; margin-bottom: 10px; }
.fai-logo { height: 44px; width: auto; }
.fai-co { font-weight: 700; font-size: 1rem; }
.fai-addr { font-size: .72rem; color: #4b5563; }
.fai-title { margin-left: auto; text-align: right; font-weight: 700; font-size: 1.02rem; }
.fai-title .mono { font-weight: 400; font-size: .78rem; }
.ffs { width: 100%; border-collapse: collapse; font-size: .84rem; }
.ffs th, .ffs td { border: 1px solid #9ca3af; padding: 4px 6px; vertical-align: middle; color: #111827; }
.ffs th { background: #f3f4f6; font-weight: 600; font-size: .78rem; text-align: left; white-space: nowrap; }
.ffs input, .ffs select, .fai-notes { width: 100%; border: 1px solid #d1d5db; border-radius: 4px; padding: 3px 6px; font: inherit; font-size: .84rem; background: #fff; color: #111827; min-height: 26px; }
.ffs input:focus, .ffs select:focus, .fai-notes:focus { outline: 2px solid #93b4f5; border-color: #2453c9; }
.fai-head th { width: 13%; }
.fai-head-note { margin: .35rem 0 0; }   /* 1.27: under the header table (the shrinkage field took its cell) */
.fai-h { font-size: .92rem; margin: 14px 0 6px; color: #111827; }
.fai-fail-txt { color: #b91c1c; }
.fai-dims .c-no { width: 42px; text-align: center; }
.fai-dims .c-unit { width: 74px; }
.fai-dims .c-unit select { padding-right: 18px; }
.fai-dims .c-num { width: 84px; text-align: right; }
.fai-dims .c-num input { text-align: right; font-family: var(--font-mono); font-size: .8rem; }
.fai-dims .c-tol { width: 140px; text-align: center; white-space: nowrap; }
.fai-dims .c-tol input { width: 62px; font-family: var(--font-mono); font-size: .8rem; text-align: right; }
.fai-dims .c-tol input + input { margin-left: 4px; }
.fai-dims .c-res { width: 60px; text-align: center; }
.fai-dims .c-x, .fai-checks .c-x { width: 30px; text-align: center; }
/* 1.26: Type column, and tolerance boxes that the standard fills (read-only) */
.fai-dims .c-type { width: 118px; min-width: 104px; }
.fai-dims .c-unit { min-width: 66px; }
.fai-dims .c-type select { padding-right: 18px; }
/* 1.26.1: a tolerance filled in by the standard is shaded; a line's own tolerance gets ↺ to put the standard back */
.fai-dims .c-tol { position: relative; }
.fai-dims .c-tol.auto input { background: #f3f4f6; color: #374151; }
.fai-dims .c-tol.own input { background: #fffbeb; border-color: #f2c94c; }
.fai-dims .tol-reset { display: none; position: absolute; top: -7px; right: -6px; width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 1px solid #d1a32b; background: #fff8e1; color: #8a6200; font-size: 11px; line-height: 16px; cursor: pointer; }
.fai-dims .c-tol.own.has-std .tol-reset { display: block; }
.fai-std-note { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.bal-card .tols.auto input { background: var(--label-bg); }
.bal-card .tols.own input { background: #fffbeb; border-color: #f2c94c; color: #111827; }
.fai-dims td.out, .fai-dims input.out { color: #b91c1c; font-weight: 700; background: #fef2f2; border-color: #f87171; }
.fai-dims tr.gone td, .fai-checks tr.gone td { opacity: .35; text-decoration: line-through; }
.balloon { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 3px; border-radius: 999px; border: 1.6px solid #2453c9; color: #2453c9; font: 700 .72rem var(--font-mono); background: #fff; }
.balloon.none { border-style: dashed; border-color: #9ca3af; color: #6b7280; }
.res-pass, .res-fail, .res-na { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: .74rem; font-weight: 700; }
.res-pass { background: #dcfce7; color: #166534; }
.res-fail { background: #fee2e2; color: #991b1b; }
.res-na { background: #f3f4f6; color: #4b5563; }
.fai-under { margin: 6px 0 0; display: flex; gap: .6rem; align-items: center; }
.fai-checks .c-cname { width: 30%; }
.fai-checks .c-cres { width: 96px; text-align: center; }
.fai-notes-view { border: 1px solid #9ca3af; padding: 6px 8px; min-height: 40px; font-size: .86rem; }
.fai-sign { margin-top: 16px; }
.fai-sign th { text-align: center; }
.fai-sign td { height: 50px; width: 33.3%; vertical-align: top; }
.fai-sign td.sign-wait { background: #fff8e6; color: #92400e; }
.fai-sign td.sign-bad { background: #fef2f2; color: #991b1b; }
.fai-savebar { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; padding: .7rem 0; background: linear-gradient(transparent, var(--bg) 30%); max-width: 1000px; margin: 0 auto; }
.fai-rail { display: flex; flex-direction: column; gap: .8rem; }
.fai-rail .sec-body { display: flex; flex-direction: column; gap: .55rem; }
.fai-rail .sec-body p { margin: 0; }
.fai-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fai-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.fai-steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; border: 2px solid var(--line); flex: none; }
.fai-steps li.done { color: var(--ink); }
.fai-steps li.done .dot { background: #1d6b4f; border-color: #1d6b4f; color: #fff; }
.fai-steps li.now { color: var(--ink); font-weight: 600; }
.fai-steps li.now .dot { border-color: #d97706; color: #d97706; }
.fai-steps li.bad .dot { background: var(--red); border-color: var(--red); color: #fff; }
.fai-steps .when { margin-left: auto; font-size: .76rem; color: var(--muted); font-weight: 400; }
.fai-todo { background: var(--amber-soft); color: var(--amber-ink); border-radius: 6px; padding: .5rem .7rem; font-size: .82rem; }
.fai-todo ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.fai-photo img { width: 100%; max-height: 220px; object-fit: contain; border-radius: 6px; background: var(--photo-bg); display: block; }
.fai-cust-img { max-width: 100%; max-height: 160px; border-radius: 4px; }
.fai-upl { display: flex; gap: .4rem; align-items: center; }
.fai-upl input[type=file] { flex: 1; min-width: 0; font-size: .8rem; }
.fai-send, .fai-cust { display: flex; flex-direction: column; gap: .45rem; }
.fai-send label, .fai-cust label { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; color: var(--ink-2); margin: 0; }
.fai-cust .two { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.fai-result { display: flex; gap: 1rem; }
.fai-result label { flex-direction: row; align-items: center; gap: .35rem; font-size: .88rem; color: var(--ink); }
.small-drop { display: flex !important; flex-direction: column; align-items: center; text-align: center; padding: .7rem; border: 2px dashed var(--input-border); border-radius: 8px; cursor: pointer; position: relative; }
.small-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.small-drop .dz-chosen { font-weight: 600; color: var(--green-ink); }
.fai-rail hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; width: 100%; }

/* balloon screen */
.bal-bar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; padding: .6rem .9rem; margin-bottom: .8rem; }
.bal-bar h1 { margin: 0; font-size: 1.1rem; }
.bal-bar label { display: flex; align-items: center; gap: .35rem; margin: 0; }
.bal-bar select { max-width: 280px; }
.bal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 520px; gap: 1rem; align-items: start; }
.bal-stage { overflow: auto; max-height: calc(100vh - 170px); background: #e5e7eb; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.bal-paper { position: relative; width: 100%; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); min-height: 300px; }
.bal-paper canvas { display: block; width: 100%; height: auto; }
.bal-paper svg { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.bal-paper.mode-move svg { cursor: default; }
.bal-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; text-align: center; color: #6b7280; }
.bal-help { margin: .5rem 0 0; }
.bal-side { position: sticky; top: .5rem; }
.bal-side .sec-body { max-height: calc(100vh - 200px); overflow: auto; }
.bal-table td { padding: 4px 5px; vertical-align: middle; }
.bal-table input, .bal-table select { font-size: .82rem; padding: 2px 5px; min-height: 26px; }
.bal-table input[data-k=feature] { width: 100%; min-width: 120px; }
.bal-table .w-num { width: 64px; text-align: right; }
.bal-table .w-tol { width: 58px; text-align: right; }
.bal-table .w-tol + .w-tol { margin-left: 3px; }
.bal-table select[data-k=unit] { width: 48px; margin-left: 3px; }
.bal-table tr.sel td { background: #fff8e6; }
.bal-table tr.sel td:first-child { box-shadow: inset 3px 0 0 #d97706; }
.bal-tip { margin-top: .5rem; }
.nowrap { white-space: nowrap; }
svg .bal-tail { stroke: #2453c9; stroke-width: 1.4; }
svg .bal-tip { fill: #2453c9; cursor: move; }
svg .bal-ring { fill: #fff; stroke: #2453c9; stroke-width: 2.2; cursor: move; }
svg .bal-num { fill: #2453c9; font: 700 16px Arial, sans-serif; cursor: move; user-select: none; }
svg .bal.sel .bal-ring { stroke: #d97706; }
svg .bal.sel .bal-num, svg .bal.sel .bal-tip { fill: #d97706; }
svg .bal.sel .bal-tail { stroke: #d97706; }
svg .bal-glow { fill: #fde68a; opacity: .55; }
.fai-list td { vertical-align: middle; }
.fai-ov-line { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .2rem 0; }
.tag-fai-list { margin-left: .35rem; font-size: .68rem; padding: 1px 6px; }
@media (max-width: 1100px) {
  .fai-layout, .bal-layout { grid-template-columns: minmax(0, 1fr); }
  .bal-side { position: static; }
}
@media (max-width: 760px) {
  /* phones: the form keeps its printed shape and scrolls sideways inside its own box */
  .fai-sheet { padding: 12px; overflow-x: auto; }
  .fai-sheet .ffs { min-width: 640px; }
  .fai-lh { min-width: 640px; }
  .fai-toolbar h1 { font-size: 1.1rem; }
  .bal-stage { max-height: none; }
}


/* ==========================================================================================
   1.25  "Packing in Assembly detail" and the FAI balloon screen v2
   ========================================================================================== */
.g-spec.wide { grid-column: span 7; }
.g-spec.wide .sec .fields, .g-spec.wide .fields { display: grid; grid-template-columns: 1fr 1fr; }
.g-spec.wide .field:nth-child(odd) { border-right: 1px solid var(--line); }
.tag-inasm { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
a.tag-inasm:hover { text-decoration: underline; }
.inasm-note { margin: 0 -.8rem -.7rem; padding: .45rem .8rem; background: var(--sl); border-top: 1px solid var(--line); color: var(--ink-2); }
.inasm-note button.link { font-size: inherit; }
.inasm-tick { margin: -.6rem -.8rem .5rem; padding: .4rem .8rem; background: var(--sl); border-bottom: 1px solid var(--line); }
.inasm-tick label { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 600; color: var(--sd); cursor: pointer; }
.inasm-tick input { width: 16px; height: 16px; accent-color: var(--sd); }
@media (max-width: 1100px) { .g-spec.wide { grid-column: span 12; } }
@media (max-width: 700px) { .g-spec.wide .fields { grid-template-columns: 1fr; } .g-spec.wide .field:nth-child(odd) { border-right: 0; } }

/* FAI balloon screen v2 (1.25): features along the top, two per line; the drawing gets the full width */
.bal-feats { margin-bottom: .8rem; }
.bal-feats #balListWrap { max-height: 34vh; overflow: auto; position: relative; }   /* the list scrolls on its own; the drawing keeps its place */
.bal-heads { position: sticky; top: -.6rem; z-index: 1; background: var(--card); padding-top: .3rem; }   /* column names stay at the top of the list while it scrolls */
.bal-feats .sec-action { display: flex; align-items: center; gap: .45rem; }
.bal-heads, .bal-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.bal-heads { margin: -.6rem 0 4px; }
.bal-head, .bal-card { display: grid; grid-template-columns: 28px minmax(0, 1fr) 72px 56px 128px 66px; gap: 5px; align-items: center; padding: 0 8px; }
.bal-head.ro, .bal-list.ro .bal-card { grid-template-columns: 28px minmax(0, 1fr) 90px 140px; }
.bal-head span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.bal-card { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); cursor: pointer; }
.bal-card.sel { background: #fff8e6; border-color: #f5c26b; box-shadow: inset 3px 0 0 #d97706; }
[data-theme="dark"] .bal-card.sel { background: #3a2f17; border-color: #8a6a2a; }
.bal-card.other { opacity: .7; }
.bal-card input, .bal-card select { width: 100%; min-width: 0; font-size: .82rem; padding: 2px 5px; min-height: 26px; }
.bal-card .w-num { text-align: right; font-family: var(--font-mono); }
.bal-card .tols { display: flex; gap: 3px; }
.bal-card .tols input { text-align: right; font-family: var(--font-mono); font-size: .78rem; padding: 2px 4px; }
.bal-card .acts { display: flex; white-space: nowrap; }
.bal-card .acts .icon-btn { padding: 2px 4px; }
.bal-card .ro-num, .bal-card .ro-tol { text-align: right; font-size: .8rem; }
.bal-card .ro-feat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-empty { grid-column: 1 / -1; margin: .2rem 0; }
.bal-feats .bal-hint { margin: .5rem 0 0; }
.bal-stage { max-height: none; }
.bal-help { margin: .5rem 0 0; }
@media (max-width: 1100px) { .bal-heads { grid-template-columns: 1fr; } .bal-heads .bal-head + .bal-head { display: none; } .bal-list { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .bal-heads { display: none; } .bal-card { grid-template-columns: 28px 1fr 64px; } .bal-card select, .bal-card .tols, .bal-card .acts { grid-column: span 1; } }

/* tables and key/value lists run edge to edge inside their panel */
@media (min-width: 701px) {
  .sec-body > .table:first-child { margin: -.6rem -.8rem 0; width: calc(100% + 1.6rem); }
}
@media (max-width: 700px) {
  .sec .fields { margin: -.6rem -.7rem 0; }
  .sec .field { grid-template-columns: minmax(110px, 42%) 1fr; }
  .topbar { height: auto; }
  .part-band .part-head { align-items: flex-start; padding: .65rem .7rem; }
  .part-band .part-head-img { width: 56px; height: 56px; }
  .part-band .part-head-main { flex: 1; }
  .part-title h1 { font-size: 1.15rem; }
  .part-band .part-head-actions { margin: 0; flex: 1 1 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .part-band .part-head-actions .btn { justify-content: center; width: auto; }
  .part-facts { grid-template-columns: 1fr 1fr; }
  .part-facts > div { padding: .4rem .7rem; border-bottom: 1px solid var(--line); }
  .part-facts > div:nth-child(2n) { border-right: 0; }
  .part-band .tabs { padding: 0 .4rem; gap: 0; }
  .ov-grid12 { display: flex; flex-direction: column; }
  .sec-doc h3.sub { margin-left: -.7rem; margin-right: -.7rem; padding-left: .7rem; }
  .sec-pack .sec-note { margin: 0 -.7rem -.7rem; }
  .list-tools { padding: .5rem .6rem; }
  .lt-search { min-width: 0; flex: 1 1 100%; }
  .list-tools select { flex: 1 1 40%; min-width: 0; }
  .report-pop { margin-left: 0; flex: 1 1 100%; }
  .report-pop > summary { width: 100%; justify-content: center; }
  .report-pop-body { left: 0; right: 0; width: auto; }
  .list-head { padding: .6rem .7rem .1rem; }
  .view-tabs { padding: .3rem .4rem 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .view-tabs a { white-space: nowrap; padding: .4rem .6rem; }
  .tooling-list tr.grp-row { display: block; padding: 0; }
  .tooling-list tr.grp-row th { display: block; padding: .4rem .7rem; }
  .tooling-list .td-num, .tool-view .td-num { text-align: left !important; }   /* phone cards: label above value */   /* phone cards: label above value */
}
/* ================================================ end of grid theme */

/* ================================================ phones (keep this block at the end of the file) */
fieldset { min-width: 0; }
@media (max-width: 700px) {
  html { -webkit-text-size-adjust: 100%; }
  .wrap { padding: .6rem .6rem 1rem; }
  h1 { font-size: 1.2rem; }

  /* top bar: logo + buttons on one row, menu scrolls sideways underneath */
  .topbar { height: auto; flex-wrap: wrap; gap: .3rem .5rem; padding: .45rem .6rem 0; }
  .brand-name { display: none; }
  .userbox { margin-left: auto; gap: .5rem; font-size: .85rem; }
  .userbox a[href="account.php"] { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mainnav { order: 3; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; gap: .1rem; padding-bottom: .35rem; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { padding: .35rem .65rem; white-space: nowrap; font-size: .92rem; }
  .jump { top: 0; }

  /* parts list */
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
  .filter-bar input { grid-column: 1 / -1; min-width: 0; font-size: 1rem; }
  .filter-bar select { min-width: 0; padding: .55rem .5rem; }
  .filter-bar .btn.primary { grid-column: 1 / -1; justify-content: center; }
  .filter-bar .clear-filters { grid-column: 1 / -1; justify-self: start; }
  /* parts list: one card per part; packing in an amber strip along the bottom */
  .parts-table, .parts-table tbody { display: block; width: 100%; }
  .parts-table thead { display: none; }
  .parts-table colgroup { display: none; }
  .parts-table tr { display: grid; grid-template-columns: 30px repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .parts-table td { display: block; padding: 0 .5rem 0 0; border: 0; width: auto !important; }
  .parts-table td.col-dot { grid-column: 1; grid-row: 1; padding: .75rem 0 0 .65rem; text-align: left; }
  .parts-table td.col-name { grid-column: 2 / 4; grid-row: 1; padding-top: .55rem; }
  .parts-table td.col-status { grid-column: 4; grid-row: 1; padding-top: .55rem; text-align: right; }
  .parts-table td.col-no { grid-column: 2; grid-row: 2; padding-bottom: .5rem; font-size: .82rem; }
  .parts-table td.col-cust { grid-column: 3 / 5; grid-row: 2; padding-bottom: .5rem; font-size: .82rem; }
  .parts-table td.col-pack { grid-row: 3; background: var(--sec-pack-bg); color: var(--sec-pack-ink); padding: .4rem .5rem .4rem 0;
    border-top: 1px solid var(--pack-line); font-size: .82rem; text-align: left; }
  .parts-table td.col-ppn { grid-column: 1 / 3; padding-left: 30px; font-weight: 700; }
  .parts-table td.col-pqty { grid-column: 3; }
  .parts-table td.col-pwt { grid-column: 4; }
  .parts-table td.pack-first { border-left: 0; }
  .parts-table tr.no-pack td.col-pack { display: none; }

  /* part header: square photo left, text right, button underneath */
  .part-head { grid-template-columns: 76px 1fr; gap: .75rem; padding: .7rem; align-items: start; }
  .part-head-img { width: 76px; height: 76px; }
  .part-head h1 { font-size: 1.12rem; margin-bottom: .2rem; }
  .part-head-nos { flex-direction: column; gap: .05rem; margin-bottom: .35rem; }
  .part-head-nos b { font-size: .9rem; }
  .part-head-tags { gap: .3rem; }
  .part-head-tags .tag, .status-pill { font-size: .72rem; padding: 2px 8px; }
  .part-head-actions { grid-column: 1 / -1; }
  .part-head-actions .btn { width: 100%; justify-content: center; }

  /* tabs fit the screen */
  .tabs { margin: .55rem 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: .5rem .6rem; font-size: .92rem; flex: 1 0 auto; text-align: center; }

  .card { padding: .7rem .75rem; margin-bottom: .6rem; border-radius: 8px; }
  .fields { grid-template-columns: 1fr 1fr; gap: .45rem .9rem; }
  .ov-grid { grid-template-columns: 1fr; gap: .6rem; margin-bottom: .6rem; }

  /* tables become small cards: each value with its label */
  .pn-view thead, .tool-view thead { display: none; }
  .pn-view, .pn-view tbody, .pn-view tr, .tool-view, .tool-view tbody, .tool-view tr { display: block; width: 100%; }
  .pn-view tr, .tool-view tr { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .9rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .pn-view td, .tool-view td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  .pn-view td[data-label]:not([data-label=""])::before, .tool-view td[data-label]::before {
    content: attr(data-label); display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
  .pn-view td:empty, .tool-view td:empty { display: none; }
  .pn-view td:first-child, .tool-view td:first-child { grid-column: 1 / -1; font-size: 1rem; }
  .tool-view td.mini-gallery { grid-column: 1 / -1; white-space: normal; }

  /* document rows: title on top, revision + date + buttons underneath */
  .docs thead { display: none; }
  .docs, .docs tbody { display: block; width: 100%; }
  .docs tr { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
  .docs td { display: block; padding: 0 !important; border: 0; width: auto !important; }
  .docs td:first-child { flex: 1 1 100%; width: 100% !important; }
  .docs td.actions { margin-left: auto; }
  #tab-uploads .docs td.small { white-space: normal; }

  /* photos */
  .gallery.compact, #tab-uploads .gallery.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .gallery.compact figcaption { font-size: .68rem; }
  #tab-uploads .fig-actions { flex-direction: column; align-items: flex-start; gap: .1rem; }
  .upload-box, #tab-uploads .upload-box { flex-direction: column; align-items: stretch; }
  #tab-uploads .upload-box label { justify-content: space-between; }
  #tab-uploads .upload-box input[name=caption] { width: auto; flex: 1; }
  .upload-box .btn { justify-content: center; }

  /* open reject notice */
  .ar-facts { gap: .2rem .8rem; font-size: .85rem; }
  .ar-actions summary.btn { padding: .4rem .8rem; }

  /* history timeline: line and dots on the left, date above each entry */
  .timeline::before { left: 7px; }
  .ev { grid-template-columns: 1fr; gap: .05rem; padding: .35rem 0 .35rem 26px; }
  .ev::before { left: 2px; top: .55rem; }
  .ev-date { text-align: left; padding: 0; font-size: .78rem; }
  .ev-meta { display: inline-block; margin-left: 0; }

  /* forms */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-actions .btn { flex: 1; justify-content: center; }
  .pn-table { min-width: 0; }
  .pn-table thead { display: none; }
  .pn-table, .pn-table tbody { display: block; }
  .pn-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .5rem; padding: .6rem; margin-bottom: .5rem;
                 border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); position: relative; }
  .pn-table td { display: block; padding: 0; }
  .pn-table td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 600; color: var(--ink-2); margin-bottom: .15rem; }
  .pn-table td.pn-x { position: absolute; top: .25rem; right: .4rem; }
  .cust-pick-head { flex-wrap: wrap; }

  /* other lists scroll sideways inside their box instead of stretching the page */
  .companies, body > .wrap > .table, .checks-table { display: block; overflow-x: auto; }
  .page-head { flex-wrap: wrap; gap: .5rem; }
  .clear-log form { position: static; width: auto; margin-top: .5rem; }
  .login-card { padding: 1.4rem; }
}
@media (max-width: 700px) {
  .tool-view td.no-photos { display: none; }
  .pack-grid { grid-template-columns: 1fr 1fr; gap: 0 .6rem; }
  .pack-grid label:nth-child(1), .pack-grid label:nth-child(2) { grid-column: 1 / -1; }
  .tool-extra { grid-template-columns: 1fr; }
  .report-bar select { min-width: 0; width: 100%; }
  .report-box label:not(.inline-check) { flex: 1 1 100%; }
  .report-box select { min-width: 0; flex: 1; }
  .report-box .btn { flex: 1 1 100%; justify-content: center; }
  /* tooling list: one card per tool */
  .tooling-list thead { display: none; }
  .tooling-list, .tooling-list tbody { display: block; width: 100%; }
  .tooling-list tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem .7rem; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
  .tooling-list td { display: block; padding: 0 !important; border: 0; min-width: 0; white-space: normal; }
  .tooling-list td:empty { display: none; }
  .tooling-list td.part-cell { grid-column: 1 / -1; }
  .tooling-list td[data-label]:not([data-label=""])::before {
    content: attr(data-label); display: block; font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
  .tooling-list td.actions { align-self: end; justify-self: end; }
  /* reject alert: the list opens full width under the top bar */
  .rej-alert { position: static; }
  .rej-alert > summary { width: 36px; height: 32px; }
  .rej-panel { position: absolute; left: 8px; right: 8px; top: calc(100% + 6px); width: auto; max-width: none; }
  /* reject photos go under the entry text */
  .ev.has-photos { grid-template-columns: 1fr; }
  .ev-photos { justify-content: flex-start; max-width: none; margin-top: .35rem; }
  .ev-photos img { width: 88px; height: 66px; }
  /* section cards and the Add a file box */
  .ov-cols { flex-direction: column; }
  .ov-col-main, .ov-col-side { flex: none; width: 100%; }
  .up-grid { grid-template-columns: 1fr; }
  .kind-tiles { grid-template-columns: 1fr 1fr; }
  .kind-tile { min-height: 56px; padding: .5rem .6rem; }
  .add-fields { grid-template-columns: 1fr; }
  .drop-zone { flex-basis: 100%; }
  .add-go { flex: 1 1 100%; }
  .sec-head { padding: .5rem .7rem; }
  .sec-body { padding: .6rem .7rem .7rem; }
  /* stacked Ipoh Casting name stays on phones, a little smaller */
  .brand { gap: .45rem; min-width: 0; }
  .brand-logo { width: 30px; height: 30px; }
  .brand .brand-name { display: block; font-size: .76rem; white-space: normal; max-width: 112px; line-height: 1.15; }
  .topbar .userbox { gap: .4rem; }
  .userbox a[href="account.php"] { max-width: 80px; }
  .brand .brand-kicker { font-size: .58rem; }
  .remind-grid { grid-template-columns: 1fr; }
  .remind-send .btn, .remind-send form { flex: 1 1 100%; }
  .remind-send form .btn { width: 100%; justify-content: center; }
}


/* ---------------------------------------------------------------- 1.18.0: COO flow charts */
/* badge in the parts list's Flow chart column */
.fcb { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.fcb + .fcb { margin-left: .25rem; }
.fcb-ok { background: var(--green-soft); color: var(--green-ink); }
.fcb-warn { background: var(--amber-soft); color: var(--amber-ink); }
.fcb-draft { background: var(--tag-bg); color: var(--ink-2); }
.fcb-stop { background: var(--red-soft); color: var(--red-ink); }
.fcb-none { color: var(--muted); font-weight: 400; }
.parts-table col.c-fc { width: 150px; }
/* status line under the flow chart in the part's Documentation section */
.fc-status { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .15rem 0 .3rem .35rem; font-size: .85rem; }
.fcs { border-radius: 999px; padding: 1px 9px; font-size: .76rem; font-weight: 600; }
.fcs-ok { background: var(--green-soft); color: var(--green-ink); }
.fcs-warn { background: var(--amber-soft); color: var(--amber-ink); }
.fcs-draft { background: var(--tag-bg); color: var(--ink-2); }
.fcs-stop { background: var(--red-soft); color: var(--red-ink); }
.fc-none { display: flex; align-items: center; gap: .6rem; }
@media (max-width: 700px) {
  .parts-table td.col-fc, .parts-table th.col-fc { display: none; }
}

/* change log: area labels and filters (1.18.0) */
.area-tag { font-size: .7rem; }
.area-flowchart { background: var(--sec-doc-bg); color: var(--sec-doc-ink); }
.area-history { background: var(--red-soft); color: var(--red-ink); }
.area-document { background: var(--accent-soft); color: var(--accent); }
.area-tooling { background: var(--sec-tool-bg); color: var(--sec-tool-ink); }
.area-photo { background: var(--sec-photo-bg); color: var(--sec-photo-ink); }
.area-part { background: var(--sec-spec-bg); color: var(--sec-spec-ink); }
.log-filters { flex-wrap: wrap; }
.log-filters input[type=search] { flex: 1 1 160px; min-width: 140px; }
.log-filters label { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
select.area-filter { font: inherit; font-size: .8rem; padding: .15rem .3rem; margin-left: .5rem; border-radius: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--ink); }


/* ================================================ 1.26.0: WORKBENCH LOOK
   Mock-up option B (canvas "PIM calmer look", artboard "Option B: Workbench"), chosen by Keith 4/12/26.
   - The menu is a charcoal sidebar on the left (includes/header.php), grouped Products / Records / Admin,
     with the user and Log out at the bottom. On phones and narrow screens it becomes a bar across the top.
   - A slim white top bar holds a parts search (it opens the Parts list filtered), the reject bell and the theme button.
   - Each section is a softly tinted frame in its own colour (--st) holding a white sheet; the label column is no
     longer shaded, so there are fewer lines. Other panels get rounder corners and a faint shadow.
   - The part header is taller, with a bigger photo, part numbers as chips and the tabs as a segmented bar.
   It sits after the phones block on purpose, so it wins. Deleting this block and the sidebar in header.php
   brings back the 1.25 look. */
:root { --side-w: 232px; --side-bg: #2f343a; --side-ink: #b9bec6; --side-on: #3e444c; --side-line: #444a52;
        --sheet-shadow: 0 1px 2px rgba(16, 24, 40, .06); --card-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
html:not([data-theme="dark"]) { --panel-line: #e1e4e9; }
[data-theme="dark"] { --side-bg: #171b20; --side-on: #262c34; --side-line: #2a3038; --sheet-shadow: none; --card-shadow: none; }

/* ---- page frame: sidebar | (top bar, page, footer) */
body.has-side { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 100vh;
  background: linear-gradient(to right, var(--side-bg) var(--side-w), var(--bg) var(--side-w)); }   /* the sidebar colour runs the full height of long pages */
body.has-side > .topbar { grid-column: 2; grid-row: 1; }
body.has-side > main.wrap { grid-column: 2; grid-row: 2; width: 100%; max-width: 1440px; box-sizing: border-box; padding: 1.2rem 1.6rem 1.5rem; }
body.has-side > main.wrap.fc-main { max-width: none; }
body.has-side > .foot { grid-column: 2; grid-row: 3; padding: 1rem 0 1.5rem; }

/* ---- sidebar */
.sidenav { grid-column: 1; grid-row: 1 / 4; position: sticky; top: 0; height: 100vh; overflow-y: auto; box-sizing: border-box;
  display: flex; flex-direction: column; background: var(--side-bg); padding: 1rem .75rem .8rem; z-index: 25; }
.sidenav .brand { padding: .15rem .45rem 1.3rem; gap: .65rem; }
.sidenav .brand-logo { width: 36px; height: 36px; }
.sidenav .brand .brand-kicker { font-size: .64rem; letter-spacing: .12em; color: #f3a37f; }
.sidenav .brand .brand-name { font-size: .86rem; line-height: 1.2; white-space: normal; }
.sidenav .mainnav { display: flex; flex-direction: column; gap: 2px; flex: none; }
.sidenav .nav-group { font-size: .68rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #7f8690; padding: 1.1rem .75rem .35rem; }
.sidenav .nav-group:first-child { padding-top: 0; }
.sidenav .mainnav a { display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: 8px; color: var(--side-ink); font-size: .95rem; background: none; }
.sidenav .mainnav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.sidenav .mainnav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidenav .mainnav a.on { background: var(--side-on); color: #fff; font-weight: 500; }
.sidenav .mainnav a.on svg { color: #f3a37f; opacity: 1; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: .5rem; padding: .8rem .35rem 0; border-top: 1px solid var(--side-line); }
.side-me { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; color: #fff; }
.side-me:hover { text-decoration: none; }
.side-me .avatar { width: 32px; height: 32px; border-radius: 50%; background: #5b6370; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem; flex: none; }
.side-who { min-width: 0; line-height: 1.2; }
.side-who b { display: block; font-weight: 500; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-who small { display: block; color: #9aa1ab; font-size: .74rem; }
.side-user .logout { color: var(--side-ink); font-size: .8rem; border: 1px solid var(--side-line); border-radius: 7px; padding: .3rem .55rem; white-space: nowrap; }
.side-user .logout:hover { color: #fff; background: rgba(255, 255, 255, .06); text-decoration: none; }

/* ---- slim top bar: search, reject bell, theme */
body.has-side > .topbar, [data-theme="dark"] body.has-side > .topbar {
  background: var(--card); color: var(--ink); border-bottom: 1px solid var(--panel-line); height: 56px; gap: 1rem; padding: 0 1.6rem; }
.top-title { font-weight: 600; color: var(--ink-head); font-size: 1rem; }
.top-search { display: flex; align-items: center; gap: .5rem; width: min(440px, 100%); background: var(--label-bg); border: 1px solid var(--panel-line);
  border-radius: 8px; padding: 0 .75rem; color: var(--muted); }
.top-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.top-search svg { flex: none; }
.top-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; color: var(--ink); padding: .5rem 0; }
body.has-side > .topbar .userbox { margin-left: auto; gap: .5rem; }
body.has-side > .topbar .theme-toggle, body.has-side > .topbar .rej-alert > summary { border: 1px solid var(--panel-line); color: var(--ink-2); background: var(--card); width: 36px; height: 34px; }
body.has-side > .topbar .theme-toggle:hover, body.has-side > .topbar .rej-alert > summary:hover,
body.has-side > .topbar .rej-alert[open] > summary { background: var(--hover); color: var(--ink-head); }
body.has-side > .topbar .rej-count, body.has-side > .topbar .rej-ok { border-color: var(--card); }
body.has-side .jump { top: 56px; }

/* ---- parts list: the sidebar takes about 230px, so the other columns give it back to the part name (and its ⚠ FAI tag) */
@media (min-width: 901px) {
  body.has-side .parts-table col.c-no { width: 12%; }
  body.has-side .parts-table col.c-cust { width: 16%; }
  body.has-side .parts-table col.c-status { width: 100px; }
  body.has-side .parts-table col.c-fc { width: 128px; }
  body.has-side .parts-table col.c-pqty, body.has-side .parts-table col.c-pwt, body.has-side .parts-table col.c-ppn { width: 92px; }
}

/* ---- panels: rounder, a faint shadow in place of a dark frame */
.card, .empty { border-radius: 12px; box-shadow: var(--card-shadow); }

/* ---- sections: a tinted frame in the section's colour holding a white sheet */
.card.sec { background: var(--st); border: 0; padding: 4px; box-shadow: none; display: flex; flex-direction: column; }
.card.sec > .sec-head, [data-theme="dark"] .card.sec > .sec-head { background: none; box-shadow: none; border: 0; padding: .45rem .6rem .45rem .5rem; gap: .5rem; }
.card.sec > .sec-head h2 { color: var(--sd); font-size: .74rem; letter-spacing: .07em; }
.card.sec .sec-icon { background: none; color: var(--sd); width: 20px; height: 20px; }
.card.sec .sec-icon svg { width: 16px; height: 16px; }
.card.sec .sec-extra { color: var(--sd); opacity: .8; }
.card.sec > .sec-body { background: var(--card); border-radius: 9px; box-shadow: var(--sheet-shadow); flex: 1; }
.card.sec .field { border-bottom-color: var(--line); }
.card.sec .field .lbl { background: none; border-right: 0; color: var(--muted); font-size: .84rem; }
.card.sec .field .val { font-weight: 500; }
.card.sec .table th { background: none; }
.card.sec h3.sub.first { border-radius: 9px 9px 0 0; }
.card.sec .sec-note { border-radius: 0 0 9px 9px; }

/* ---- part header: taller, bigger photo, part numbers as chips, tabs as a segmented bar */
.part-band { border-radius: 12px; overflow: hidden; }
.part-band .part-head { padding: 1.1rem 1.3rem; gap: .8rem 1.3rem; background: linear-gradient(120deg, #fbfcfe 0%, #f4f7fc 60%, #fbf3ee 100%); }
[data-theme="dark"] .part-band .part-head { background: linear-gradient(120deg, #1b222b 0%, #18202a 60%, #201c1a 100%); }
.part-band .part-head-img { width: 96px; height: 96px; border-radius: 12px; background: var(--card); }
.part-band .part-title h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em; }
.part-band .part-head-nos { align-items: center; gap: .35rem .45rem; margin: .5rem 0 .6rem; }
.pn-chip { background: var(--card); border: 1px solid var(--panel-line); border-radius: 6px; padding: 1px 8px; font-size: .86rem; }
.part-band .part-head-cust { margin-left: .4rem; }
.part-band .part-head-main { flex: 1; }
.part-band .part-head-actions { margin-top: 0; }
.part-facts > div { padding: .7rem 1.3rem; }
.part-facts dt { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.part-facts dd { font-size: 1.03rem; margin-top: .15rem; }
.part-band .tabs { background: var(--label-bg); padding: .45rem 1rem; gap: .3rem; }
.part-band .tabs a { padding: .35rem .85rem; margin: 0; border: 1px solid transparent; border-radius: 7px; color: var(--ink-2); }
.part-band .tabs a:hover { text-decoration: none; color: var(--ink-head); }
.part-band .tabs a.on { background: var(--card); border-color: var(--panel-line); color: var(--ink-head); font-weight: 600; box-shadow: var(--sheet-shadow); }

/* ---- FAI report beside the sidebar: the 1.26 Type column needs room, so the columns are a little tighter, and on
        screens under 1500px the status panel moves under the report (the report keeps its printed shape) */
body.has-side .fai-sheet { padding: 22px 24px; overflow-x: auto; }
body.has-side .fai-dims .c-type { width: 112px; }
body.has-side .fai-dims .c-unit { width: 74px; }
body.has-side .fai-dims .c-type select, body.has-side .fai-dims .c-unit select { padding-left: 4px; padding-right: 14px; }
body.has-side .fai-dims .c-num { width: 76px; }
body.has-side .fai-dims .c-tol { width: 126px; }
body.has-side .fai-dims .c-tol input { width: 56px; }
@media (max-width: 1500px) {
  body.has-side .fai-layout { grid-template-columns: minmax(0, 1fr); }
  body.has-side .fai-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}

/* ---- narrow screens and phones: the sidebar becomes a bar across the top */
@media (max-width: 900px) {
  body.has-side { display: block; background: var(--bg); }
  .sidenav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .5rem .6rem .3rem; overflow: visible; }
  .sidenav .brand { padding: 0; flex: 1; min-width: 0; }
  .sidenav .brand-logo { width: 30px; height: 30px; }
  .sidenav .brand .brand-name { font-size: .76rem; max-width: 140px; }
  .side-user { order: 2; margin: 0; padding: 0; border: 0; flex: none; }
  .side-who { display: none; }
  .side-me .avatar { width: 28px; height: 28px; }
  .sidenav .mainnav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: .15rem; padding-bottom: .2rem; }
  .sidenav .mainnav::-webkit-scrollbar { display: none; }
  .sidenav .nav-group { display: none; }
  .sidenav .mainnav a { white-space: nowrap; padding: .4rem .7rem; font-size: .9rem; gap: .4rem; }
  .sidenav .mainnav a svg { width: 15px; height: 15px; }
  body.has-side > .topbar { height: auto; padding: .45rem .6rem; gap: .5rem; flex-wrap: nowrap; }
  .top-search { width: auto; flex: 1; }
  body.has-side > main.wrap { padding: .6rem .6rem 1rem; }
  body.has-side .jump { top: 50px; }
}
@media (max-width: 700px) {
  .part-band .part-head { padding: .75rem .8rem; }
  .part-band .part-head-img { width: 64px; height: 64px; }
  .part-band .part-title h1 { font-size: 1.25rem; }
  .part-band .part-head-nos { flex-direction: row; gap: .3rem; margin: .4rem 0 .5rem; }   /* chips wrap in a row (an older phone rule stacked them) */
  .part-band .part-head-cust { margin-left: 0; flex-basis: 100%; }
  .pn-chip { font-size: .8rem; padding: 0 6px; }
  .part-facts > div { padding: .45rem .8rem; }
  .part-band .tabs { padding: .35rem .4rem; overflow-x: auto; }
  .part-band .tabs a { padding: .3rem .6rem; white-space: nowrap; }
}
@media print {
  .sidenav { display: none !important; }
  body.has-side { display: block; }
}
/* ================================================ end of 1.26.0 Workbench look */

/* ================================================ 1.27.0
   - Part header: the assemblies the part is used in, on the part number / customer line.
   - FAI: shrinkage field in the header table; standards as one tag each (also in fai_print.css).
   - Parts list: category filter and column; Admin › Categories. */
.part-head-asm { display: inline-flex; align-items: center; gap: .3rem; color: var(--ink-2); }
.part-head-asm::before { content: "|"; color: var(--line); margin-right: .35rem; }
.part-head-asm svg { flex: none; color: var(--muted); }
#faiShrink { width: 100%; box-sizing: border-box; }
.std-tag { display: inline-block; white-space: nowrap; border: 1px solid var(--panel-line, var(--line)); border-radius: 4px; padding: 0 6px; margin: 1px 4px 1px 0; }
.cat-tag { display: inline-block; white-space: nowrap; background: var(--tag-bg); color: var(--ink-2); border-radius: 5px; padding: 1px 7px; font-size: .78rem; font-weight: 500; }
@media (max-width: 700px) { .part-head-asm { flex-basis: 100%; } .part-head-asm::before { display: none; } }
/* ================================================ end of 1.27.0 */
.cat-add { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cat-add input { flex: 1; min-width: 200px; max-width: 360px; }
.cat-rename { display: flex; align-items: center; gap: .5rem; margin: 0; }
.cat-rename input { flex: 1; max-width: 320px; }
.cat-table .num { text-align: right; width: 90px; }
.cat-table tfoot td { border-top: 1px solid var(--line); }
.parts-table col.c-cat { width: 11%; }
@media (min-width: 901px) {
  body.has-side .parts-table col.c-cat { width: 11%; }
  body.has-side .parts-table:has(col.c-cat) col.c-no { width: 10%; }
  body.has-side .parts-table:has(col.c-cat) col.c-cust { width: 13%; }
}
@media (max-width: 700px) { .parts-table td.col-cat, .parts-table th.col-cat { display: none; } }
.cat-add.form input, .cat-rename.form input { width: auto !important; padding: .4rem .6rem !important; }
.cat-add .lbl-strong { margin: 0; }
