/* PackOrb design system on Bootstrap 5.3.
   Tokens come from the PackOrb design system (project/ds/packorb/tokens.json, "light" product theme).
   Contrast notes are from the token file: orange (#D58545) is never used for text on white; orange-deep is. */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../lib/montserrat/montserrat-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../lib/montserrat/montserrat-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Brand */
  --po-navy: #10263E;
  --po-navy-raised: #163250;
  --po-navy-border: #37506A;
  --po-slate: #3B5069;
  --po-orange: #D58545;
  --po-orange-deep: #A85A1E;
  --po-peach: #F8BA8C;
  --po-sage: #A5C3B9;
  --po-blush: #E9C5BC;
  --po-mist: #9EB3C2;
  /* Light product theme */
  --po-surface: #F7F8FA;
  --po-surface-raised: #FFFFFF;
  --po-highlight: #FBE3D2;
  --po-border: #DDE3E9;
  --po-border-strong: #7D8B99;
  --po-ink: #10263E;
  --po-ink-muted: #4A5A6A;
  --po-on-dark: #F2F5F8;
  --po-success: #1F6B43;
  --po-success-bg: #E3F1E9;
  --po-warning: #6B4500;
  --po-warning-bg: #FFF3D6;
  --po-danger: #9B2C2C;
  --po-danger-bg: #FBE4E4;
  /* Shape */
  --po-radius-sm: 6px;
  --po-radius-md: 12px;
  --po-radius-lg: 20px;
  --po-shadow-card: 0 1px 2px rgba(16, 38, 62, 0.08);
  --po-sidebar-width: 264px;

  /* Bootstrap mapping */
  --bs-body-font-family: Montserrat, Arial, sans-serif;
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.5;
  --bs-body-color: var(--po-ink);
  --bs-body-color-rgb: 16, 38, 62;
  --bs-body-bg: var(--po-surface);
  --bs-secondary-color: var(--po-ink-muted);
  --bs-emphasis-color: var(--po-ink);
  --bs-border-color: var(--po-border);
  --bs-border-radius: var(--po-radius-md);
  --bs-border-radius-sm: var(--po-radius-sm);
  --bs-border-radius-lg: var(--po-radius-lg);
  --bs-primary: var(--po-orange-deep);
  --bs-primary-rgb: 168, 90, 30;
  --bs-link-color: var(--po-orange-deep);
  --bs-link-color-rgb: 168, 90, 30;
  --bs-link-hover-color: var(--po-navy);
  --bs-link-hover-color-rgb: 16, 38, 62;
  --bs-focus-ring-color: rgba(168, 90, 30, 0.45);
  --bs-success: var(--po-success);
  --bs-success-rgb: 31, 107, 67;
  --bs-heading-color: var(--po-ink);
}

body { background: var(--po-surface); color: var(--po-ink); min-height: 100vh; }

h1, .h1 { font-size: 2rem; line-height: 2.5rem; font-weight: 500; margin: 0; }
h2, .h2 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; }
h3, .h3 { font-size: 1.125rem; line-height: 1.625rem; font-weight: 600; }
.po-lead { font-size: 1.125rem; line-height: 1.75rem; color: var(--po-ink-muted); }
.po-label {
  font-size: 0.75rem; line-height: 1rem; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--po-ink-muted);
}
.text-muted, .po-muted { color: var(--po-ink-muted) !important; }
.small, small { font-size: 0.875rem; }

/* ---------- Focus: visible, 2px outside the control (WCAG 2.4.7) */
:focus-visible { outline: 2px solid var(--po-orange-deep); outline-offset: 2px; }
.po-sidebar :focus-visible { outline-color: var(--po-peach); }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: none; outline: 2px solid var(--po-orange-deep); outline-offset: 2px; border-color: var(--po-border-strong);
}

.po-skip {
  position: absolute; left: 16px; top: 8px; z-index: 2000; background: var(--po-surface-raised);
  padding: 8px 14px; border-radius: var(--po-radius-md); font-weight: 600;
}

/* ---------- App shell */
.po-app { display: flex; min-height: 100vh; }
.po-sidebar {
  background: var(--po-navy); color: var(--po-on-dark);
  width: var(--po-sidebar-width); flex: 0 0 var(--po-sidebar-width);
}
@media (min-width: 992px) {
  /* Bootstrap's .offcanvas-lg forces a transparent background on desktop; the sidebar must stay navy. */
  .po-sidebar.offcanvas-lg { background-color: var(--po-navy) !important; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; }
}
.po-sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--po-navy); --bs-offcanvas-color: var(--po-on-dark); --bs-offcanvas-width: 300px; }
.po-sidebar-inner { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; min-height: 100%; }
.po-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--po-on-dark); text-decoration: none; font-size: 1.125rem; font-weight: 600; }
.po-brand:hover { color: var(--po-on-dark); }
.po-brand img { width: 32px; height: 32px; }

.po-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.po-topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  padding: 12px 32px; border-bottom: 1px solid var(--po-border); background: var(--po-surface-raised);
}
.po-content { padding: 32px; display: flex; flex-direction: column; gap: 24px; max-width: 1600px; width: 100%; }
@media (max-width: 575.98px) {
  .po-content { padding: 20px 16px; }
  .po-topbar { padding: 10px 16px; }
  h1, .h1 { font-size: 1.625rem; line-height: 2.125rem; }
}

/* Scope chip in the top bar: always shows where you are working */
.po-scope-chip {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.875rem; color: var(--po-ink-muted);
}
.po-scope-chip strong { color: var(--po-ink); font-weight: 600; }
.po-scope-chip .po-role {
  font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 2px 10px;
  background: var(--po-highlight); color: var(--po-ink);
}
.po-scope-chip .po-role.po-role-super { background: var(--po-navy); color: var(--po-on-dark); }

/* Sidebar navigation */
.po-nav { display: flex; flex-direction: column; gap: 2px; font-size: 0.875rem; }
.po-nav a, .po-nav .po-nav-group-toggle {
  color: var(--po-on-dark); text-decoration: none; padding: 9px 12px; border-radius: var(--po-radius-md);
  display: flex; align-items: center; gap: 10px; background: transparent; border: 0; width: 100%; text-align: left; font: inherit;
}
.po-nav a:hover, .po-nav .po-nav-group-toggle:hover { background: var(--po-navy-raised); color: var(--po-on-dark); }
.po-nav a[aria-current="page"], .po-nav a.po-nav-pending { background: var(--po-peach); color: var(--po-navy); font-weight: 600; }
/* A clicked menu item takes the highlight at once (site.js), while its page loads. */
.po-nav.po-nav-moving a[aria-current="page"]:not(.po-nav-pending) { background: transparent; color: var(--po-on-dark); font-weight: inherit; }
.po-nav .bi { font-size: 1rem; width: 1.1rem; }
.po-nav-heading {
  margin: 14px 12px 4px; font-size: 0.75rem; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--po-mist);
}
.po-nav-sep { height: 1px; background: var(--po-navy-border); margin: 10px 4px 6px; }
.po-sidebar-footer { margin-top: auto; font-size: 0.75rem; color: var(--po-mist); padding: 0 12px; }

/* Scope switcher */
.po-scope-btn {
  width: 100%; font: inherit; font-size: 0.875rem; text-align: left; background: var(--po-navy-raised); color: var(--po-on-dark);
  border: 1px solid #6C829B; border-radius: var(--po-radius-md); padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.po-scope-btn:hover { background: #1c3c5f; color: var(--po-on-dark); }
.po-scope-btn .po-scope-org { display: block; font-size: 0.75rem; color: var(--po-mist); }
.po-scope-btn .po-scope-company { display: block; font-weight: 600; }
.po-scope-menu {
  width: 100%; min-width: 232px; max-height: 70vh; overflow-y: auto; padding: 8px;
  border-radius: var(--po-radius-md); border: 0; box-shadow: 0 16px 40px rgba(16, 38, 62, 0.35);
}
.po-scope-menu .dropdown-header { font-size: 0.75rem; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--po-ink-muted); padding: 10px 10px 4px; white-space: normal; }
.po-scope-menu .dropdown-item {
  border-radius: 10px; padding: 9px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; white-space: normal; color: var(--po-ink);
}
.po-scope-menu .dropdown-item:hover, .po-scope-menu .dropdown-item:focus { background: var(--po-surface); }
.po-scope-menu .dropdown-item.active, .po-scope-menu .dropdown-item[aria-current="true"] { background: var(--po-highlight); color: var(--po-ink); }
.po-scope-menu .po-scope-meta { display: block; font-size: 0.75rem; color: var(--po-ink-muted); }

/* ---------- Page header */
.po-page-header { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.po-page-header .po-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Cards and stats */
.po-card {
  background: var(--po-surface-raised); border: 1px solid var(--po-border); border-radius: var(--po-radius-lg);
  box-shadow: var(--po-shadow-card); padding: 24px;
}
.po-card-tight { padding: 16px 20px; }
.po-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
/* Whole card is one link: pair with a .stretched-link inside. */
.po-card-link { position: relative; transition: border-color .15s, box-shadow .15s; }
.po-card-link:hover, .po-card-link:focus-within { border-color: var(--po-border-strong); box-shadow: 0 4px 12px rgba(16, 38, 62, 0.12); }
.po-card-link:hover .bi-chevron-right { color: var(--po-ink) !important; }
/* A separate link inside a .po-card-link, clickable above the stretched link. */
.po-card-link .po-above-link { position: relative; z-index: 2; }
.po-card > h2:first-child, .po-card > h3:first-child { margin-top: 0; }
.po-stat { display: flex; flex-direction: column; gap: 6px; }
.po-stat-value { font-size: 2rem; font-weight: 600; line-height: 1.2; }
.po-grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
/* Several counts in one card (Producer/Products): one row per count, label left and value right. */
.po-stat-box { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.po-stat-box .po-stat { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 24px; }
.po-stat-box .po-stat-value { font-size: 1.25rem; }
/* Filters that share the row evenly instead of sizing to their longest option. */
.po-filters-even > :not(.form-check) { flex: 1 1 150px; min-width: 0; }

/* ---------- Buttons */
.btn { --bs-btn-border-radius: var(--po-radius-md); --bs-btn-font-weight: 600; --bs-btn-padding-x: 1.1rem; --bs-btn-padding-y: 0.65rem; }
.btn-sm { --bs-btn-padding-x: 0.75rem; --bs-btn-padding-y: 0.375rem; --bs-btn-border-radius: 10px; }
.btn-primary {
  --bs-btn-bg: var(--po-orange-deep); --bs-btn-border-color: var(--po-orange-deep); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #8E4B18; --bs-btn-hover-border-color: #8E4B18; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #7A4014; --bs-btn-active-border-color: #7A4014;
  --bs-btn-disabled-bg: var(--po-orange-deep); --bs-btn-disabled-border-color: var(--po-orange-deep);
}
.btn-outline-secondary, .btn-secondary {
  --bs-btn-bg: var(--po-surface-raised); --bs-btn-color: var(--po-ink); --bs-btn-border-color: var(--po-border-strong);
  --bs-btn-hover-bg: var(--po-surface); --bs-btn-hover-color: var(--po-ink); --bs-btn-hover-border-color: var(--po-ink);
  --bs-btn-active-bg: var(--po-border); --bs-btn-active-color: var(--po-ink); --bs-btn-font-weight: 500;
}
.btn-outline-primary {
  --bs-btn-color: var(--po-orange-deep); --bs-btn-border-color: var(--po-orange-deep);
  --bs-btn-hover-bg: var(--po-orange-deep); --bs-btn-hover-border-color: var(--po-orange-deep); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #8E4B18; --bs-btn-active-border-color: #8E4B18;
}
.btn-danger { --bs-btn-bg: var(--po-danger); --bs-btn-border-color: var(--po-danger); --bs-btn-hover-bg: #7d2222; --bs-btn-hover-border-color: #7d2222; }
.btn-outline-danger { --bs-btn-color: var(--po-danger); --bs-btn-border-color: var(--po-danger); --bs-btn-hover-bg: var(--po-danger); --bs-btn-hover-border-color: var(--po-danger); }
.btn-link { --bs-btn-font-weight: 600; text-decoration: none; }
.btn-on-dark { background: var(--po-peach); color: var(--po-navy); border: 0; }
.btn-on-dark:hover { background: #f5a86f; color: var(--po-navy); }

/* ---------- Forms */
.form-label { font-weight: 600; font-size: 0.875rem; margin-bottom: 6px; }
.form-control, .form-select {
  border-color: var(--po-border-strong); border-radius: var(--po-radius-md); padding: 0.6rem 0.85rem; color: var(--po-ink);
}
/* Keep room for the arrow, which the shorthand padding above would otherwise remove */
.form-select { padding-right: 2.5rem; }
.form-text { color: var(--po-ink-muted); }
.form-check-input { border-color: var(--po-border-strong); }
.form-check-input:checked { background-color: var(--po-orange-deep); border-color: var(--po-orange-deep); }
.field-validation-error, .text-danger { color: var(--po-danger) !important; font-size: 0.875rem; font-weight: 500; }
.input-validation-error { border-color: var(--po-danger) !important; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.po-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--po-border-strong); background: var(--po-surface-raised); border-radius: var(--po-radius-md); padding: 0 12px; }
.po-search input { border: 0; padding: 10px 0; flex: 1; min-width: 0; background: transparent; }
.po-search input:focus { outline: none; }
.po-search:focus-within { outline: 2px solid var(--po-orange-deep); outline-offset: 2px; }

/* ---------- Tables */
.po-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.po-table th {
  text-align: left; font-size: 0.75rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--po-ink-muted);
  font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--po-border); white-space: nowrap;
}
.po-table th.po-num { text-align: right; }
.po-table td { padding: 12px 10px; border-top: 1px solid var(--po-border); vertical-align: middle; }
.po-table tbody tr:first-child td { border-top: 0; }
.po-table tr.po-row-selected td { background: var(--po-highlight); }
/* A row linked to (e.g. a material layer from the completeness checks) stands out. */
.po-table tr:target td { background: var(--po-highlight); }
.po-table-wrap { overflow-x: auto; overflow-y: hidden; }
.po-table .po-sub { display: block; color: var(--po-ink-muted); font-size: 0.8125rem; }
/* Performance page: measuring point names (SQL tables, page paths) need room instead of breaking mid-word. */
.po-perf-table td.po-perf-name { min-width: 18rem; overflow-wrap: anywhere; }
.po-perf-table td.po-num { white-space: nowrap; }
/* What suppliers shared to answer a request: a grid (icon, name, status) so the status pills line up; several answers fold behind counts per status. */
.po-answers { margin-top: 4px; font-size: 0.8125rem; }
.po-answers > summary { list-style: none; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: pointer; border-radius: var(--po-radius-sm); }
.po-answers > summary::-webkit-details-marker { display: none; }
.po-answers-chevron { color: var(--po-ink-muted); transition: transform 0.15s; }
.po-answers[open] .po-answers-chevron { transform: rotate(180deg); }
.po-answers[open] > summary { margin-bottom: 6px; }
.po-answer-list { display: grid; grid-template-columns: auto minmax(0, max-content) auto; justify-content: start; align-items: center; gap: 4px 8px; }
.po-answer-list > a { overflow-wrap: anywhere; }
.po-answer-list > .po-pill { justify-self: start; }
/* A table row that is one link (SOF-55): pair with a .stretched-link in a cell; other controls use .po-above-link. */
.po-table tr.po-row-link { position: relative; cursor: pointer; }
.po-table tr.po-row-link .po-above-link { position: relative; z-index: 2; }
.po-table tr.po-row-link:hover td, .po-table tr.po-row-link:focus-within td { background: var(--po-surface); }
.po-table td.po-quick-cell { width: 36px; padding-right: 0; }
.po-quick-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: var(--po-radius-sm); background: transparent; color: var(--po-ink-muted);
}
.po-quick-toggle:hover, .po-quick-toggle:focus-visible { border-color: var(--po-border-strong); color: var(--po-ink); }
.po-quick-toggle .bi { transition: transform .15s; }
.po-quick-toggle[aria-expanded="true"] .bi { transform: rotate(180deg); }
.po-table tr.po-row-quick td { border-top: 0; background: var(--po-surface); padding-top: 4px; }
/* A table that scrolls sideways on a narrow screen: the open quick view keeps to the visible width and stays in view. */
.po-table-wrap:has(tr.po-row-quick:not([hidden])) { container-type: inline-size; }
.po-table tr.po-row-quick td > * { position: sticky; left: 10px; max-width: calc(100cqi - 20px); }
/* Quick view (SOF-60): what the article is made of, from the top down. One card per level with its packaging units and their
   components as a tree, and a dashed arrow with "6 × name" down to each contained article, like the supplier map (SOF-29). */
.po-qv-levels { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.po-qv-level { background: var(--po-surface-raised); border: 1px solid var(--po-border); border-radius: var(--po-radius-lg);
  box-shadow: var(--po-shadow-card); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; overflow-wrap: anywhere; }
.po-qv-head { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.po-qv-unit { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--po-ink-muted); }
.po-qv-pack { background: var(--po-surface); border: 1.5px solid var(--po-border-strong); border-radius: var(--po-radius-md);
  padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.po-qv-pack.po-missing { border-style: dashed; color: var(--po-ink-muted); }
/* Tree lines: a trunk from the box above down to the last item's tick, and a tick to each item. */
.po-qv-packs, .po-qv-comps { list-style: none; margin: 6px 0 0; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 6px; }
.po-qv-packs { margin-top: 0; }
.po-qv-comps { padding-left: 32px; }
.po-qv-packs > li, .po-qv-comps > li { position: relative; }
.po-qv-packs > li::before, .po-qv-comps > li::before { content: ""; position: absolute; left: -10px; width: 8px; border-top: 2px solid var(--po-border-strong); }
.po-qv-packs > li::after, .po-qv-comps > li::after { content: ""; position: absolute; left: -10px; top: -6px; bottom: 0; border-left: 2px solid var(--po-border-strong); }
.po-qv-packs > li::before { top: 16px; }
.po-qv-packs > li:last-child::after { bottom: auto; height: 23px; }
.po-qv-comps > li::before { top: 10px; }
.po-qv-comps > li:last-child::after { bottom: auto; height: 17px; }
/* Between two levels: a dashed arrow with what the next level is; with several contained articles each branch is indented. */
.po-qv-step { position: relative; min-height: 56px; display: flex; align-items: center; padding: 8px 0 16px 40px; }
.po-qv-step::before { content: ""; position: absolute; left: 23px; top: 0; bottom: 8px; border-left: 2px dashed var(--po-slate); }
.po-qv-step::after { content: ""; position: absolute; left: 17px; bottom: 0; border: 7px solid transparent; border-top: 9px solid var(--po-slate); border-bottom: 0; }
.po-qv-step span { background: var(--po-surface); color: var(--po-ink); border: 1.5px solid var(--po-slate); border-radius: 14px;
  padding: 2px 12px; font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }
.po-qv-branch { margin-left: 24px; }
/* An article inside another one in the quick view: its packaging and contents, indented under it. */

/* ---------- Pills, tags and status */
.po-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 3px 10px;
  border: 1px solid var(--po-border-strong); background: var(--po-surface); color: var(--po-ink); white-space: nowrap;
}
.po-pill-highlight { background: var(--po-highlight); border-color: transparent; }
.po-pill-success { color: var(--po-success); background: var(--po-success-bg); border-color: transparent; }
.po-pill-warning { color: var(--po-warning); background: var(--po-warning-bg); border-color: transparent; }
.po-pill-danger { color: var(--po-danger); background: var(--po-danger-bg); border-color: transparent; }
.po-pill-dark { background: var(--po-navy); color: var(--po-on-dark); border-color: var(--po-navy); }
.po-tag { font-size: 0.75rem; font-weight: 600; border-radius: var(--po-radius-sm); padding: 2px 7px; border: 1px solid var(--po-navy); background: var(--po-navy); color: var(--po-on-dark); }
.po-tag-kind { display: inline-flex; align-items: center; gap: 5px; background: var(--po-highlight); color: var(--po-ink); border-color: var(--po-orange); white-space: nowrap; }
.po-file-icon { font-size: 1.75rem; line-height: 1; }
.po-file-pdf { color: #D93025; }
.po-file-excel { color: #1D7A45; }
.po-file-word { color: #2B5DB9; }
.po-file-image { color: #8A4FBF; }
.po-file-other { color: var(--po-ink-muted); }
.po-tag-missing { background: var(--po-surface-raised); color: var(--po-ink-muted); border-color: var(--po-border-strong); }

/* ---------- Progress */
.po-progress { height: 8px; background: var(--po-border); border-radius: 999px; overflow: hidden; flex: 1; min-width: 60px; }
.po-progress > span { display: block; height: 100%; background: var(--po-orange); border-radius: 999px; }
.po-progress.po-complete > span { background: var(--po-sage); }

/* ---------- Lists, tasks, empty states */
.po-task { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--po-border); }
.po-task:first-of-type { border-top: 0; }
.po-task-text { flex: 1 1 260px; }
.po-empty {
  border: 1px dashed var(--po-border-strong); border-radius: var(--po-radius-md); padding: 24px; text-align: center; color: var(--po-ink-muted);
}
.po-empty .bi { font-size: 1.75rem; display: block; margin-bottom: 6px; color: var(--po-slate); }
.po-dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 16px; margin: 0; font-size: 0.875rem; }
.po-dl dt { color: var(--po-ink-muted); font-weight: 500; }
.po-dl dd { margin: 0; }

/* ---------- Alerts */
.alert { border-radius: var(--po-radius-md); border: 0; }
.alert-success { background: var(--po-success-bg); color: var(--po-success); }
.alert-warning { background: var(--po-warning-bg); color: var(--po-warning); }
.alert-danger { background: var(--po-danger-bg); color: var(--po-danger); }
.alert-info { background: var(--po-highlight); color: var(--po-ink); }
/* The message after an action (_Flash): top right, in view while scrolling, gone after 30 seconds or when closed. */
.po-flash-stack { position: fixed; top: 16px; right: 16px; z-index: 1060; width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.po-flash { pointer-events: auto; margin: 0; display: flex; gap: 8px; align-items: flex-start; box-shadow: 0 4px 14px rgba(16, 38, 62, 0.18); overflow-wrap: anywhere;
  transition: opacity .3s, transform .3s; }
.po-flash > span { flex: 1; }
.po-flash .btn-close { flex: none; font-size: 0.75rem; margin-top: 2px; }
.po-flash.po-flash-hiding { opacity: 0; transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) { .po-flash { transition: none; } }

/* ---------- Modal */
.modal-content { border-radius: var(--po-radius-lg); border: 0; }
.modal-header, .modal-footer { border-color: var(--po-border); }

/* ---------- Sign-in */
.po-auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.po-auth-brand {
  flex: 1 1 380px; background: var(--po-navy); color: var(--po-on-dark); padding: 48px; display: flex; flex-direction: column; gap: 24px; justify-content: center;
}
.po-auth-brand .po-eyebrow { color: var(--po-peach); font-size: 1rem; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 600; margin: 0; }
.po-auth-brand h1 { font-size: 2.5rem; line-height: 3rem; font-weight: 600; color: var(--po-on-dark); letter-spacing: -0.5px; }
.po-auth-brand p { color: var(--po-mist); font-size: 1.125rem; line-height: 1.75rem; max-width: 34rem; margin: 0; }
.po-auth-form { flex: 1 1 420px; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.po-auth-form > * { width: 100%; max-width: 440px; }
.po-quick-login .btn { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; }
.po-quick-login .btn small { font-weight: 500; color: var(--po-ink-muted); }
@media (max-width: 575.98px) { .po-auth-brand { padding: 32px 20px; } .po-auth-brand h1 { font-size: 1.75rem; line-height: 2.25rem; } }

/* A table wrapper only scrolls sideways. Bootstrap keeps a visually hidden caption in the flow under the table (1px), which
   would otherwise give the wrapper a vertical scrollbar, since overflow-x: auto makes it scroll in both directions. */
.table-responsive { overflow-y: hidden; }

/* ---------- Field help (regulatory context) */
.po-help { position: relative; }
.po-help > summary { list-style: none; cursor: pointer; color: var(--po-orange-deep); border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.po-help > summary::-webkit-details-marker { display: none; }
.po-help-body {
  position: absolute; right: 0; top: 28px; z-index: 20; width: min(360px, 80vw); background: var(--po-surface-raised);
  border: 1px solid var(--po-border-strong); border-radius: var(--po-radius-md); box-shadow: 0 12px 32px rgba(16, 38, 62, 0.2); padding: 14px; font-size: 0.8125rem;
}
.po-help-body .po-dl { grid-template-columns: max-content 1fr; }
/* Wide variant for a table: the icon sits next to its label and the panel opens from the start of the label row (.po-help-anchor). */
.po-help-anchor { position: relative; }
.po-help-wide { position: static; }
.po-help-wide > .po-help-body { left: 0; right: auto; width: min(640px, calc(100vw - 32px)); }
.po-help-wide .po-table { font-size: 0.8125rem; }
@media (max-width: 1199.98px) { .po-help-wide > .po-help-body { position: fixed; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); width: auto; max-width: 640px; margin: 0 auto; max-height: 80vh; overflow: auto; } }

/* ---------- Packaging editor */
.po-component { border: 1px solid var(--po-border); border-radius: var(--po-radius-md); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--po-surface-raised); }
.po-component-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.po-component-head h3 { margin: 0; font-size: 1rem; }
/* A component in a shared snapshot folds behind its name (and weight) in _Snapshot. */
.po-component-fold > summary { cursor: pointer; overflow-wrap: anywhere; }
.po-edit > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 0.875rem; color: var(--po-orange-deep); }
.po-edit[open] > summary { margin-bottom: 12px; }
.po-search { position: relative; }
.po-search-results { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; max-height: 320px; overflow-y: auto; background: var(--po-surface-raised); border: 1px solid var(--po-border); border-radius: var(--po-radius-md); box-shadow: var(--po-shadow-card); }
.po-search-results li { display: flex; flex-direction: column; padding: 6px 10px; border-radius: var(--po-radius-sm); cursor: pointer; }
.po-search-results li .po-sub { color: var(--po-ink-muted); font-size: 0.8125rem; }
.po-search-results li:hover { background: var(--po-surface); }
.po-search-results li.active { background: var(--po-highlight); color: var(--po-ink); }
/* What is picked in a search-and-pick list (data-po-pick): icon, name with detail, and Remove on the right. */
.po-pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.po-pick-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); background: var(--po-surface-raised); }
.po-pick-list li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.po-pick-list li .btn-link { flex: none; }
.po-pick-warning { display: block; margin-top: 2px; font-size: .875em; color: var(--po-warning); }
.po-pick-warning[hidden] { display: none; }
.po-layers td input, .po-layers td select { min-width: 90px; }
/* "Add new packaging" or "Update existing packaging" on the review page: the checked radio shows its part. */
.po-choice:has(#modeNew:checked) .po-choice-update, .po-choice:has(#modeUpdate:checked) .po-choice-new { display: none; }
.po-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.po-level-tile { border: 1px solid var(--po-border); border-radius: var(--po-radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.po-level-tile.po-missing { border-style: dashed; border-color: var(--po-border-strong); color: var(--po-ink-muted); }
.po-provenance { font-size: 0.75rem; color: var(--po-ink-muted); }
.po-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.po-filters .form-select, .po-filters .form-control { min-width: 140px; }
/* Buttons that take turns stacked in one cell, so the slot is as wide as the widest and keeps its room while they switch. */
.po-button-slot { display: inline-grid; }
.po-button-slot > * { grid-area: 1 / 1; }
/* A search field with its buttons on one row: when the row is too narrow for field and labels, the labels are hidden visually (still read out) and only the icons show. */
.po-search-row { container-type: inline-size; }
@container (max-width: 440px) {
    .po-search-row .po-btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.po-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.po-product-card { border: 1px solid var(--po-border); border-radius: var(--po-radius-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--po-surface-raised); }
.po-product-card.po-selected { border-color: var(--po-orange-deep); }
.po-seg { display: inline-flex; border: 1px solid var(--po-border-strong); border-radius: var(--po-radius-md); overflow: hidden; }
.po-seg a { padding: 7px 14px; font-size: 0.8125rem; font-weight: 600; color: var(--po-ink); text-decoration: none; background: var(--po-surface-raised); }
.po-seg a + a { border-left: 1px solid var(--po-border-strong); }
.po-seg a[aria-current="true"] { background: var(--po-navy); color: var(--po-on-dark); }
/* Select sized to match .po-seg buttons beside it */
.form-select.po-seg-select { padding-top: 7px; padding-bottom: 7px; font-size: 0.8125rem; line-height: 1.5; }

/* ---------- Review: source text */
.po-source { white-space: pre-wrap; font-size: 0.875rem; line-height: 1.6; background: var(--po-surface); border: 1px solid var(--po-border); border-radius: var(--po-radius-md); padding: 16px; max-height: 70vh; overflow: auto; }
.po-source mark { background: var(--po-highlight); outline: 1.5px solid var(--po-orange-deep); border-radius: 2px; padding: 0 2px; color: var(--po-ink); }
.po-preview-frame { height: 420px; overflow: auto; background: var(--po-mist); border: 1px solid var(--po-border); border-radius: var(--po-radius-md); }
.po-preview-stage { position: relative; margin: 0 auto; background: #fff; }
.po-preview-stage canvas { display: block; }
.po-preview-mark { position: absolute; background: rgba(213, 133, 69, 0.18); outline: 1.5px solid var(--po-orange); border-radius: 2px; pointer-events: none; }
.po-preview-mark.po-preview-value { background: rgba(213, 133, 69, 0.35); outline: 2.5px solid var(--po-orange-deep); }
.po-document-page canvas { display: block; max-width: 100%; border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); box-shadow: var(--po-shadow-card); }
.po-document-image { display: block; max-width: 100%; height: auto; border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); }
.po-import-row { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 10rem 18rem; gap: 16px; align-items: center; }
@media (max-width: 991.98px) {
  .po-import-row { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .po-import-uploaded, .po-import-actions { grid-column: 2; justify-content: flex-start !important; }
}
.po-component.border-primary { border-color: var(--po-orange-deep) !important; }

/* ---------- Code / diagnostics */
.po-change-body { white-space: pre-wrap; word-break: break-word; }
.po-stack { white-space: pre-wrap; word-break: break-word; font-size: 0.75rem; background: var(--po-surface); border: 1px solid var(--po-border); border-radius: var(--po-radius-md); padding: 12px; max-height: 360px; overflow: auto; }

/* ---------- Feedback widget (SOF-25) */
.po-feedback-fab { position: fixed; right: 24px; bottom: 24px; z-index: 1040; width: 52px; height: 52px; border-radius: 50%; padding: 0; font-size: 1.25rem; box-shadow: 0 4px 14px rgba(16, 38, 62, 0.25); }
.po-feedback-panel {
  position: fixed; right: 24px; bottom: 88px; z-index: 1040; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 112px); overflow-y: auto;
  background: var(--po-surface-raised); border: 1px solid var(--po-border); border-radius: var(--po-radius-lg); padding: 20px; box-shadow: 0 8px 28px rgba(16, 38, 62, 0.2);
}
.po-feedback-shots { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.po-feedback-shots:empty { display: none; }
.po-feedback-shots li { position: relative; }
.po-feedback-shots img { display: block; width: 96px; height: 64px; object-fit: cover; object-position: top left; border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); }
.po-feedback-remove { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; padding: 0; border-radius: 50%; font-size: 0.7rem; line-height: 1; border: 1px solid var(--po-border-strong); }
.po-feedback-overlay { position: fixed; inset: 0; z-index: 2100; cursor: crosshair; background: rgba(16, 38, 62, 0.25); touch-action: none; }
.po-feedback-overlay:focus { outline: none; }
.po-feedback-overlay-hint { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); background: var(--po-navy); color: #fff; padding: 8px 16px; border-radius: var(--po-radius-md); font-size: 0.875rem; }
.po-feedback-selection { position: fixed; border: 2px dashed #fff; outline: 1px solid var(--po-orange-deep); background: rgba(255, 255, 255, 0.15); }
@media (max-width: 575.98px) { .po-feedback-fab { right: 16px; bottom: 16px; } .po-feedback-panel { right: 16px; bottom: 80px; } }

/* Tabs on a page (the article page): one row that scrolls sideways when the tabs do not fit. Bootstrap's tab plugin switches the panes. */
.po-tabs { display: flex; gap: 4px; margin: 0 0 24px; box-shadow: inset 0 -1px 0 var(--po-border); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.po-tab { flex: 0 0 auto; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--po-ink-muted); font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.po-tab:hover { color: var(--po-ink); border-bottom-color: var(--po-border-strong); }
.po-tab.active { color: var(--po-ink); border-bottom-color: var(--po-orange); }
.po-tab:focus-visible { outline: 2px solid var(--po-orange-deep); outline-offset: -2px; border-radius: var(--po-radius-sm) var(--po-radius-sm) 0 0; }

/* Read-only field laid out like a form field: a muted label above a clear value (the article page's Article tab). */
.po-field-label { margin-bottom: 2px; color: var(--po-ink-muted); font-size: 0.8125rem; }
.po-field-value { color: var(--po-ink); font-size: 1rem; font-weight: 500; overflow-wrap: anywhere; }
/* Fields without a value are left out until "Show empty fields too" is ticked (a checkbox marked data-po-show-empty in the card). */
.po-fields .po-field-empty { display: none; }
.po-card:has([data-po-show-empty]:checked) .po-fields .po-field-empty { display: block; }
.po-field-empty .po-field-value { color: var(--po-ink-muted); font-weight: 400; }
/* The article's images on its Article tab, in a row before the name (main image first): the size and cropping of .po-thumb. */
.po-article-images { display: flex; flex-wrap: wrap; gap: 6px; max-width: 50%; margin: 0; padding: 0; }
.po-article-image { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 40px; height: 40px; overflow: hidden; background: var(--po-surface); border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); color: var(--po-border-strong); }
.po-article-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.po-article-image-empty:hover { color: var(--po-ink-muted); border-color: var(--po-border-strong); }

/* Image gallery (_ImageGallery) and list thumbnails */
.po-gallery-main { display: block; background: var(--po-surface); border: 1px solid var(--po-border); border-radius: var(--po-radius-md); overflow: hidden; }
.po-gallery-main img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.po-gallery-strip { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 0; padding: 0; }
.po-gallery-strip li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 96px; }
.po-gallery-strip img { display: block; width: 96px; height: 96px; object-fit: cover; background: var(--po-surface); border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); }
.po-gallery-strip li.is-primary img { border-color: var(--po-orange); box-shadow: 0 0 0 1px var(--po-orange); }
.po-gallery-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.po-gallery-tools .btn { padding: 2px 6px; line-height: 1.2; }
.po-thumb { display: block; width: 40px; height: 40px; object-fit: cover; background: var(--po-surface); border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); }
.po-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--po-border-strong); }

/* ---------- Packaging suppliers of an article (SOF-29), level by level: one card per level (article → packaging unit → components →
   supplier the data comes from at the foot of the box it is connected to, with elbow lines) and an arrow between the levels. The
   diagram has a minimum width and scrolls inside its box on narrow screens. */
.po-sm-scroll { overflow-x: auto; }
/* Three equally wide columns (article, packaging unit, components) with room for the elbow lines between them (24px, 40px). */
.po-sm-grid { min-width: 1020px; }
/* The column heads line up with the columns inside the cards (17px = the card's padding and border). */
.po-sm-heads { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 40px minmax(0, 1fr); padding: 0 17px 8px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--po-ink-muted); }
.po-sm-heads span:nth-child(2) { grid-column: 3; }
.po-sm-heads span:nth-child(3) { grid-column: 5; }
.po-sm-levels { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.po-sm-level { background: var(--po-surface-raised); border: 1px solid var(--po-border); border-radius: var(--po-radius-lg);
  box-shadow: var(--po-shadow-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
/* The chosen article's level stands out with a stronger frame (the others are articles inside it or carrying it). */
.po-sm-level[aria-current="true"] { border: 2px solid var(--po-orange-deep); padding: 13px 15px; box-shadow: 0 0 0 4px var(--po-highlight), var(--po-shadow-card);
  scroll-margin: 16px; }
.po-sm-level-head { margin: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; }
.po-sm-level-head strong { font-size: 1.0625rem; }
.po-sm-level-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; color: var(--po-orange-deep); }
/* Between two levels: a dashed arrow under the article column with what the next level holds; a long name wraps. */
.po-sm-step { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 40px minmax(0, 1fr); padding: 0 17px; }
.po-sm-step-arrow { position: relative; min-height: 64px; display: flex; justify-content: center; align-items: flex-start; padding: 14px 0 22px; }
.po-sm-step-arrow::before { content: ""; position: absolute; left: calc(50% - 1px); top: 0; bottom: 8px; border-left: 2px dashed var(--po-slate); }
.po-sm-step-arrow::after { content: ""; position: absolute; left: calc(50% - 7px); bottom: 0; border: 7px solid transparent; border-top: 9px solid var(--po-slate); border-bottom: 0; }
.po-sm-step-arrow span { position: relative; background: var(--po-surface); color: var(--po-ink); border: 1.5px solid var(--po-slate); border-radius: 14px;
  padding: 2px 12px; font-size: 0.8125rem; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
/* One row: the article, then its packaging units, each centred against its own components; the units and their components
   share the row's columns (subgrid). */
.po-sm-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 40px minmax(0, 1fr); align-items: center; }
.po-sm-article { position: relative; display: flex; min-height: 112px; background: var(--po-surface-raised); border: 1.5px solid var(--po-border-strong);
  border-radius: var(--po-radius-md); }
.po-sm-article::after { content: ""; position: absolute; right: -13.5px; top: calc(50% - 1px); width: 12px; border-top: 2px solid var(--po-border-strong); }
.po-sm-article-img { flex: none; width: 72px; display: flex; align-items: center; justify-content: center; background: var(--po-surface);
  border-right: 1px solid var(--po-border); border-radius: var(--po-radius-md) 0 0 var(--po-radius-md); overflow: hidden; color: var(--po-border-strong); font-size: 1.75rem; }
/* The whole image shows (contain, not cover): a tall box would otherwise crop it to a narrow slice. */
.po-sm-article-img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.po-sm-article-text { min-width: 0; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow-wrap: anywhere; }
/* The groups' trunk runs from the first unit's middle to the last one's (12px between units). */
.po-sm-groups { grid-column: 3 / 6; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: subgrid; row-gap: 12px; }
.po-sm-group { grid-column: 1 / -1; position: relative; display: grid; grid-template-columns: subgrid; align-items: center; }
.po-sm-group::before { content: ""; position: absolute; left: -12px; top: calc(50% - 1px); width: 12px; border-top: 2px solid var(--po-border-strong); }
.po-sm-group::after { content: ""; position: absolute; left: -13px; top: -12px; bottom: 0; border-left: 2px solid var(--po-border-strong); }
.po-sm-group:first-child::after { top: 50%; }
.po-sm-group:last-child::after { bottom: calc(50% - 1px); }
.po-sm-group:only-child::after { display: none; }
.po-sm-pack { grid-column: 1; position: relative; background: var(--po-surface); }
.po-sm-group-whole .po-sm-pack::after { display: none; }
.po-sm-pack::after { content: ""; position: absolute; right: -21.5px; top: calc(50% - 1px); width: 20px; border-top: 2px solid var(--po-border-strong); }
.po-sm-pack-level { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--po-ink-muted); }
/* The components' trunk, likewise from the first component's middle to the last one's (8px between components). */
.po-sm-nodes { grid-column: 3; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.po-sm-node { position: relative; }
.po-sm-node::before { content: ""; position: absolute; left: -20px; top: calc(50% - 1px); width: 20px; border-top: 2px solid var(--po-border-strong); }
.po-sm-node::after { content: ""; position: absolute; left: -21px; top: -8px; bottom: 0; border-left: 2px solid var(--po-border-strong); }
.po-sm-node:first-child::after { top: 50%; }
.po-sm-node:last-child::after { bottom: calc(50% - 1px); }
.po-sm-node:only-child::after { display: none; }
.po-sm-component { background: var(--po-surface-raised); }
/* A unit's or component's box: its image (or an icon) at the left, like the article's, then its text. */
.po-sm-box { display: flex; min-height: 56px; border: 1.5px solid var(--po-border-strong); border-radius: var(--po-radius-md); }
.po-sm-box.po-sm-missing { border: 2px solid var(--po-orange-deep); }
.po-sm-thumb { flex: none; width: 64px; display: flex; align-items: center; justify-content: center; background: var(--po-surface);
  border-right: 1px solid var(--po-border); border-radius: var(--po-radius-md) 0 0 var(--po-radius-md); overflow: hidden; color: var(--po-border-strong); font-size: 1.5rem; }
.po-sm-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.po-sm-body { flex: 1; min-width: 0; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow-wrap: anywhere; }
.po-sm-sub { font-size: 0.8125rem; color: var(--po-ink-muted); }
/* Where the box's data comes from: the supplier, its share or request and the status, under a line at the foot of the box. */
.po-sm-source { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--po-border); display: flex; gap: 8px;
  justify-content: space-between; align-items: center; }
.po-sm-source > span:first-child { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.po-sm-connect { border-top: 1px dashed var(--po-orange-deep); }
.po-sm-connect a[aria-current="true"] { font-weight: 600; }
.po-sm-panel { border: 2px solid var(--po-orange-deep); }
/* The packaging hierarchy (packaging → components → material layers): a packaging without components has no line to the right,
   and a material layer is a plain box without an image. */
.po-sm-article.po-sm-alone::after { display: none; }
.po-sm-layer { background: var(--po-surface-raised); min-height: 48px; }
/* An article's hierarchy has a fourth column (article → packaging unit → components → material layers): each component is a row of
   its own with its layers to the right, sharing the columns (subgrid), and the components' trunk runs as between nodes. */
.po-sm-four { min-width: 1360px; }
.po-sm-four :is(.po-sm-heads, .po-sm-step, .po-sm-row) { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 40px minmax(0, 1fr) 40px minmax(0, 1fr); }
.po-sm-four .po-sm-heads span:nth-child(4) { grid-column: 7; }
.po-sm-four .po-sm-groups { grid-column: 3 / 8; }
.po-sm-comps { grid-column: 3 / 6; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: subgrid; row-gap: 8px; }
.po-sm-comp { grid-column: 1 / -1; position: relative; display: grid; grid-template-columns: subgrid; align-items: center; }
.po-sm-comp::before { content: ""; position: absolute; left: -20px; top: calc(50% - 1px); width: 20px; border-top: 2px solid var(--po-border-strong); }
.po-sm-comp::after { content: ""; position: absolute; left: -21px; top: -8px; bottom: 0; border-left: 2px solid var(--po-border-strong); }
.po-sm-comp:first-child::after { top: 50%; }
.po-sm-comp:last-child::after { bottom: calc(50% - 1px); }
.po-sm-comp:only-child::after { display: none; }
.po-sm-comp > .po-sm-component { grid-column: 1; position: relative; }
.po-sm-comp > .po-sm-component::after { content: ""; position: absolute; right: -21.5px; top: calc(50% - 1px); width: 20px; border-top: 2px solid var(--po-border-strong); }
.po-sm-comp-whole > .po-sm-component::after { display: none; }
/* A component the article holds as its goods (the labels on a roll): a line straight from the article through the packaging column,
   marked "Contents", to a dashed box (not packaging). */
.po-sm-direct { grid-column: 1; position: relative; height: 0; margin-right: -20px; border-top: 2px dashed var(--po-border-strong);
  display: flex; align-items: center; justify-content: center; }
.po-sm-direct span { background: var(--po-surface-raised); border: 1.5px solid var(--po-border-strong); border-radius: 12px; padding: 1px 10px;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--po-ink-muted); white-space: nowrap; }
.po-sm-box.po-sm-content, .po-sm-group-direct .po-sm-layer { border-style: dashed; }
/* The lines that lead to the contents and on to their layers are dashed too. */
.po-sm-group-direct::before, .po-sm-group-direct .po-sm-comp::before, .po-sm-group-direct .po-sm-component::after,
.po-sm-group-direct .po-sm-node::before { border-top-style: dashed; }
.po-sm-group-direct::after, .po-sm-group-direct .po-sm-comp::after, .po-sm-group-direct .po-sm-node::after { border-left-style: dashed; }
/* Under the diagram: what a dashed frame means. */
.po-sm-legend { margin: 12px 0 0; display: flex; gap: 8px; align-items: center; font-size: 0.8125rem; color: var(--po-ink-muted); }
.po-sm-legend-swatch { flex: none; width: 28px; height: 16px; border: 1.5px dashed var(--po-border-strong); border-radius: 4px; }

/* Busy feedback (site.js): spinner in the clicked button, and a "Please wait…" card after 500 ms.
   The card floats over the page without dimming it or catching clicks. */
.po-busy-spinner { width: 1em; height: 1em; border-width: .15em; vertical-align: -.125em; }
.po-busy-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 120ms ease, visibility 120ms ease; }
.po-busy-overlay.is-visible { opacity: 1; visibility: visible; }
.po-busy-card { display: inline-flex; align-items: center; justify-content: center; gap: .9rem; min-width: min(90vw, 20rem); padding: 1rem 1.25rem;
  border: 1px solid var(--po-border); border-radius: .75rem; background: var(--po-surface-raised); color: var(--po-ink); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
/* The spinners are the only sign that work is going on, so keep them turning, slowly (as Bootstrap does). */
@media (prefers-reduced-motion: reduce) { .spinner-border { animation: spinner-border 1.5s linear infinite !important; } }

/* ---------- Public page of a packaging unit and its QR labels */
body.po-public { background: var(--po-surface); }
.po-public-top .po-brand, .po-public-top .po-brand span { color: var(--po-ink); font-weight: 700; }
.po-public-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--po-border); background: var(--po-surface-raised); }
.po-public-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.po-public-sort { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.po-public-sort li { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--po-border); border-radius: var(--po-radius-md); overflow-wrap: anywhere; }
.po-public-fraction { align-self: flex-start; font-weight: 600; font-size: 0.875rem; padding: 2px 10px; border-radius: 14px; background: var(--po-navy); color: var(--po-on-dark); }
.po-public-fraction-other { background: var(--po-surface); color: var(--po-ink); border: 1px solid var(--po-border-strong); }
.po-public-facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.po-public-facts dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--po-ink-muted); }
.po-public-facts dd { margin: 0; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.po-qr-preview { width: 180px; max-width: 100%; }
.po-qr-preview svg, .po-qr-label-code svg { display: block; width: 100%; height: auto; }
/* Labels: one large one, or a sheet of 3 × 4 per A4 page. */
.po-qr-label { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 12px; border: 1px dashed var(--po-border-strong); border-radius: var(--po-radius-md); background: #fff; color: #000; break-inside: avoid; overflow-wrap: anywhere; }
.po-qr-label-level { font-size: 0.75rem; color: #444; }
.po-qr-label-url { font-size: 0.6875rem; color: #444; word-break: break-all; }
.po-label-single { display: flex; justify-content: center; }
.po-label-single .po-qr-label { width: 320px; max-width: 100%; }
.po-label-single .po-qr-label-code { width: 260px; max-width: 100%; }
.po-label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.po-label-sheet .po-qr-label-code { width: 140px; max-width: 100%; }
@media print {
  @page { size: A4; margin: 10mm; }
  .po-sidebar, .po-topbar, .po-no-print, .po-skip, .po-feedback, [data-po-busy] { display: none !important; }
  body, .po-main, .po-content { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  .po-app { display: block !important; }
  .po-label-sheet { grid-template-columns: repeat(3, 1fr); gap: 6mm; }
  .po-label-sheet .po-qr-label { height: 62mm; justify-content: center; }
  .po-label-sheet .po-qr-label-code { width: 38mm; }
}

/* ---------- Empty space (PPWR Art. 24): a bar for the ratio; outer levels show the 50 % limit as a line. */
.po-es-gauge { position: relative; height: 12px; border-radius: 6px; background: var(--po-surface); border: 1px solid var(--po-border); overflow: hidden; }
.po-es-fill { display: block; height: 100%; background: var(--po-navy); }
.po-es-fill.po-es-bad { background: var(--po-danger); }
.po-es-gauge.po-es-limit::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; border-left: 2px dashed var(--po-ink); }
/* The sketch of how the empty space is calculated: outline, product or sales units, hatched empty space, labels. */
.po-es-how > summary { cursor: pointer; font-weight: 600; font-size: 0.875rem; color: var(--po-orange-deep); }
.po-es-how[open] > summary { margin-bottom: 8px; }
.po-es-sketch svg { display: block; width: 100%; max-width: 420px; height: auto; }
.po-es-outline { fill: none; stroke: var(--po-ink); stroke-width: 3; stroke-linejoin: round; }
.po-es-product { fill: var(--po-navy); opacity: 0.8; }
.po-es-unit { fill: var(--po-surface-raised); stroke: var(--po-navy); stroke-width: 2; }
.po-es-hatch-line { stroke: var(--po-border-strong); stroke-width: 1.5; }
.po-es-bracket, .po-es-leader { fill: none; stroke: var(--po-ink-muted); stroke-width: 1.5; }
.po-es-label { font-size: 13px; font-weight: 600; fill: var(--po-ink); }
.po-es-note { font-size: 11px; fill: var(--po-ink-muted); }

/* ---------- Integrations (Pages/Organization/Integrations) */
.po-integration-systems { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.po-integration-system { display: flex; gap: 14px; align-items: flex-start; }
.po-integration-system .po-kb-area-icon { font-weight: 700; font-size: 1rem; }
.po-integration-logo { background: transparent; padding: 2px; }
.po-integration-logo img { width: 100%; height: 100%; object-fit: contain; }
.po-integration-url { min-width: 120px; }
.po-integration-progress { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; min-width: 150px; }

/* ---------- Knowledge base (Pages/Knowledge) */
.po-kb-areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.po-kb-area { display: flex; flex-direction: column; gap: 10px; padding-right: 48px; }
.po-kb-area-go { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.25rem; }
.po-kb-area-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--po-radius-md);
  background: var(--po-highlight); color: var(--po-orange-deep); font-size: 1.5rem; flex: none;
}
.po-kb-area-icon-sm { width: 36px; height: 36px; font-size: 1.1rem; border-radius: var(--po-radius-sm); }
.po-kb-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.po-kb-help { padding-top: 10px; border-top: 1px solid var(--po-border); color: var(--po-ink-muted); }
.po-kb-steps { display: flex; flex-direction: column; gap: 10px; margin: 0; padding-left: 1.4rem; }
.po-kb-steps > li::marker { font-weight: 700; color: var(--po-orange-deep); }
.po-kb-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.po-kb-timeline > li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--po-border); }
.po-kb-timeline > li:last-child { border-bottom: 0; }
.po-kb-when { font-weight: 700; color: var(--po-orange-deep); }
.po-kb-gloss dt { font-weight: 600; }
.po-kb-gloss dd { font-size: 0.875rem; color: var(--po-ink-muted); margin-bottom: 10px; }
.po-kb-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: flow; }
.po-kb-flow > li {
  counter-increment: flow; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 0.875rem;
  border: 1px solid var(--po-border); border-radius: 999px; background: var(--po-surface);
}
.po-kb-flow > li::before {
  content: counter(flow); display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--po-navy); color: var(--po-on-dark); font-size: 0.75rem; font-weight: 700;
}

/* The data model: one row per level (node, linkable documents, outputs), joined by labelled connectors. */
.po-model { display: flex; flex-direction: column; }
.po-model-head { display: none; }
.po-model-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.po-model-node {
  --tone: var(--po-mist); border: 1px solid var(--po-border); border-left: 6px solid var(--tone); border-radius: var(--po-radius-md);
  background: var(--po-surface-raised); padding: 16px;
}
.po-model-article { --tone: var(--po-peach); }
.po-model-packaging { --tone: var(--po-sage); }
.po-model-version { --tone: var(--po-mist); }
.po-model-component { --tone: var(--po-blush); }
.po-model-layer { --tone: var(--po-orange); }
.po-model-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--po-radius-sm);
  background: var(--tone); color: var(--po-navy); font-size: 1rem;
}
.po-model-example { border-top: 1px dashed var(--po-border); padding-top: 10px; }
.po-model-example-label { display: block; font-size: 0.6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--po-ink-muted); margin-bottom: 6px; }
.po-model-nest { border: 1px solid var(--po-border-strong); border-radius: var(--po-radius-sm); padding: 4px 8px 8px; font-size: 0.8125rem; background: var(--po-surface-raised); }
.po-model-nest > span { display: block; font-weight: 600; margin-bottom: 4px; }
.po-model-nest .po-model-nest { background: var(--po-surface); }
.po-model-nest .po-model-nest .po-model-nest { background: var(--po-highlight); border-style: dashed; padding-bottom: 4px; }
.po-model-nest .po-model-nest .po-model-nest > span { margin-bottom: 0; }
.po-model-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8125rem; }
.po-model-tags > li { border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); padding: 2px 8px; background: var(--po-surface); }
.po-model-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.8125rem; }
.po-model-versions > li { border: 1px solid var(--po-border); border-radius: 999px; padding: 2px 10px; color: var(--po-ink-muted); }
.po-model-versions > li > span { font-weight: 700; color: var(--po-ink); margin-right: 2px; }
.po-model-versions { column-gap: 22px; }
.po-model-versions > li { position: relative; }
.po-model-versions > li + li::before { content: "→"; position: absolute; left: -17px; top: 50%; transform: translateY(-50%); color: var(--po-ink-muted); }
.po-model-versions > li.is-current { background: var(--po-navy); border-color: var(--po-navy); color: var(--po-on-dark); }
.po-model-versions > li.is-current > span { color: var(--po-on-dark); }
.po-model-layers { display: flex; height: 26px; border-radius: var(--po-radius-sm); overflow: hidden; font-size: 0.75rem; font-weight: 600; }
.po-model-layers > span { display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; min-width: 8px; }
.po-layer-board { background: #C9A27A; color: var(--po-navy); }
.po-layer-pe { background: var(--po-mist); color: var(--po-navy); }
.po-layer-alu { background: var(--po-border-strong); padding: 0 !important; }
.po-model-side { display: flex; flex-direction: column; gap: 6px; }
.po-model-side-label { font-size: 0.6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--po-ink-muted); margin: 0; }
.po-model-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.po-model-chips > li {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; font-size: 0.8125rem; line-height: 1.35;
  border: 1px solid var(--po-border); border-radius: var(--po-radius-sm); background: var(--po-surface);
}
.po-model-chips > li > .bi { color: var(--po-ink-muted); }
.po-model-chips-out > li { background: var(--po-highlight); border-color: transparent; }
.po-model-chips-out > li > .bi { color: var(--po-orange-deep); }
.po-model-link { position: relative; padding: 10px 0 10px 40px; min-height: 52px; display: flex; align-items: center; }
.po-model-link::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 8px; border-left: 2px solid var(--po-border-strong); }
.po-model-link::after {
  content: ""; position: absolute; left: 17px; bottom: 2px; border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 8px solid var(--po-border-strong);
}
.po-model-link > span { font-size: 0.8125rem; color: var(--po-ink-muted); font-style: italic; }
@media (min-width: 992px) {
  .po-model-head, .po-model-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
  .po-model-head { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--po-border); }
  .po-model-head > span { font-size: 0.75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--po-ink-muted); }
  .po-model-side { padding-top: 16px; }
  .po-model-side-label { display: none; }
  .po-model-link { max-width: calc((100% - 48px) * 1.4 / 3.4); }
}
