/* Laird Layout — navy enterprise AppLayout shell.
   The shell owns the dark end of the palette; page content owns the paper side.
   All values are local tokens so the shell does not depend on Lumo variables
   (the application runs Aura). */

/* Article graph position. ONE palette for the article grid and the detail
   header; the Kotlin side refers to these tokens, never to hex values. */
:root {
  --article-kind-raw: #64748B;
  --article-kind-intermediate: #B45309;
  --article-kind-final: #2C6A4A;
  --article-kind-tool: #1F4E79;
  --article-kind-other: #64748B;

  /* Tag-panel width for the article overviews, the quotation Items layout and
     the newP picking stage. Change 17% to retune all of them; 210px is the
     floor on narrow screens. */
  --tag-panel-width: minmax(210px, 17%);

  /* Fallback worksheet tokens: pages that use `.newp-chip` / `.newp-card`
     without a `.newp-page` root must not silently lose their borders and
     fills. Page-local `.newp-page` values still win where present. */
  --newp-surface: #FFFFFF;
  --newp-surface-muted: #F6F9FC;
  --newp-rule: #D4DEE8;
  --newp-rule-soft: #E5ECF3;
  --newp-rule-strong: #B8C7D6;
  --newp-ink: #14212F;
  --newp-ink-2: #4E5F71;
  --newp-ink-3: #6B7C8D;
  --newp-accent: #1F4E79;
  --newp-accent-soft: #EAF1F7;
  --newp-accent-ink: #173E60;
  --newp-accent-border: #B9CFE2;
  --newp-warn: #8A5A12;
  --newp-warn-rule: #E6D3A8;
  --newp-warn-soft: #FDF6E7;
  --newp-radius: 4px;
}

.laird-layout {
  --laird-navy: #0B2239;
  --laird-navy-deep: #071829;
  --laird-steel: #1F4E79;
  --laird-azure: #8FC0E6;
  --laird-paper: #F1F5F9;
  --laird-drawer: #F7F9FC;
  --laird-rule: #D4DEE8;
  --laird-rule-strong: #B8C7D6;
  --laird-ink: #14212F;
  --laird-muted: #5C6C7C;
  --laird-nav-text: #E6EEF5;
  --laird-nav-muted: #A9BDD1;
  background: var(--laird-paper);
}

/* ── Navbar: the one dark band in the application ── */
.laird-layout::part(navbar) {
  min-height: 52px;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--laird-navy);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 -1px 0 0 var(--laird-steel);
}

.laird-layout vaadin-drawer-toggle {
  color: var(--laird-nav-text);
  --vaadin-button-text-color: var(--laird-nav-text);
  --vaadin-button-background: transparent;
  --vaadin-button-shadow: none;
}

.laird-layout vaadin-drawer-toggle:hover {
  --vaadin-button-text-color: #FFFFFF;
}

/* Navbar brand — the logo is a RouterLink back to the Dashboard. */
.laird-layout .navbar-brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  cursor: pointer;
}

.laird-layout .navbar-brand:focus-visible {
  outline: 2px solid var(--laird-azure);
  outline-offset: 3px;
  border-radius: 3px;
}

.laird-layout .navbar-brand-logo {
  display: block;
  height: 34px;
  width: auto;
  aspect-ratio: 1040 / 352;
  user-select: none;
  -webkit-user-drag: none;
}

/* Navbar tools: quiet until hovered. */
.laird-layout .navbar-icon-button {
  color: var(--laird-nav-muted);
  --vaadin-button-text-color: var(--laird-nav-muted);
  --vaadin-button-background: transparent;
  --vaadin-button-border-color: transparent;
  --vaadin-button-shadow: none;
}

.laird-layout .navbar-icon-button:hover {
  --vaadin-button-text-color: #FFFFFF;
  --vaadin-button-background: rgba(255, 255, 255, 0.08);
}

.laird-layout .logout-button {
  margin-right: 8px;
  color: var(--laird-nav-muted);
  --vaadin-button-text-color: var(--laird-nav-muted);
  --vaadin-button-background: transparent;
  --vaadin-button-border-color: transparent;
  --vaadin-button-shadow: none;
}

.laird-layout .logout-button:hover {
  --vaadin-button-text-color: #FFFFFF;
  --vaadin-button-background: rgba(255, 255, 255, 0.08);
}

.laird-layout .navbar-status {
  font-size: 11px;
  color: #F1B9B6;
  white-space: nowrap;
}

/* Catalogue picker in the navbar: light field, quiet label. */
.laird-layout .laird-pmc {
  gap: 8px;
}

.laird-layout .laird-pmc__label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--laird-nav-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.laird-layout .laird-pmc__combo {
  --vaadin-input-field-value-font-size: 12px;
  --vaadin-input-field-value-font-weight: 500;
}

.laird-layout .laird-pmc__error {
  font-size: 11px;
  color: #F1B9B6;
  white-space: nowrap;
}

/* ── Drawer: light paper beside the dark bar ── */
.laird-layout::part(drawer) {
  background: var(--laird-drawer);
  border-right: 1px solid var(--laird-rule);
}

.laird-layout [slot="drawer"] {
  background: var(--laird-drawer);
  border-right: 1px solid var(--laird-rule);
}

.laird-layout [slot="drawer"] vaadin-scroller {
  --vaadin-scroller-padding-inline: 0;
  --vaadin-scroller-padding-block: 10px;
}

.laird-layout .drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--laird-rule);
}

.laird-layout .drawer-header-icon {
  color: var(--laird-steel);
  font-size: 24px;
}

.laird-layout .drawer-header-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--laird-ink);
}

.laird-layout .drawer-nav {
  padding: 8px 0;
}

.laird-layout .drawer-nav-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--laird-muted);
  letter-spacing: 0.03em;
}

.laird-layout .drawer-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  margin: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--laird-ink);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
  cursor: pointer;
}

.laird-layout .drawer-nav-link:hover {
  background: #EDF2F7;
  color: var(--laird-steel);
}

.laird-layout .drawer-nav-link[highlight] {
  background: #E8F0F7;
  color: var(--laird-steel);
  font-weight: 600;
}

.laird-layout .drawer-nav-link[highlight]::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 5px;
  bottom: 5px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--laird-steel);
}

.laird-layout .drawer-nav-link vaadin-icon {
  font-size: 18px;
  min-width: 20px;
  color: var(--laird-steel);
}

.laird-layout .drawer-nav-link[highlight] vaadin-icon {
  color: var(--laird-steel);
}

.laird-layout .drawer-nav hr {
  margin: 10px 16px;
  border: 0;
  border-top: 1px solid var(--laird-rule);
}

/* Drawer footer */
.laird-layout .drawer-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--laird-rule);
}

.laird-layout .drawer-footer-text {
  font-size: 12px;
  color: var(--laird-muted);
}

/* Full logo on the sign-in screen. LoginRoute is outside .laird-layout,
   so this rule is deliberately global. */
.login-logo {
  display: block;
  width: min(340px, 86vw);
  height: auto;
  aspect-ratio: 1240 / 400;
  margin-bottom: 24px;
  user-select: none;
  -webkit-user-drag: none;
}

.big-text {
  font-weight: bold;
  font-size: xxx-large;
}

/* ── Materials grid — rows with unsaved edits (the update batch) ── */
vaadin-grid::part(dirty-row) {
  background-color: rgba(245, 158, 11, 0.15);
}

/* ── Mix & Match — the row that is the cross-filter source (owning grid) ── */
vaadin-grid::part(cross-selected-row) {
  background-color: rgba(132, 204, 22, 0.5);
}

/* ── Mix & Match — 3-column view locked to the viewport ── */
.mix-match-view {
  height: 100%;
  overflow: hidden;
} /* kills page scroll */
.mix-match-content {
  min-height: 0;
  overflow: hidden;
} /* row shrinks -> grids scroll */
.mix-match-column {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.mix-match-column > vaadin-grid {
  min-height: 0;
} /* definite height -> internal scroll */
.mix-match-status {
  height: 20px;
  line-height: 20px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Mix & Match — title-bar actions ──
   "Reset Filters" is the one command, the Hide/Show buttons are view state — a
   hairline rule between the two so the reset never reads as another toggle.

   Everything goes through Lumo's own --vaadin-button-tertiary-* knobs. Setting
   `background`/`border` on the host would NOT work: Lumo declares
   `background: var(--vaadin-button-tertiary-background, transparent) !important`
   on :host([theme~=tertiary]), so a plain background rule is silently dropped.
   Custom properties inherit into the shadow tree, so they win *and* the
   :hover / [active] / [focus-ring] states keep working. No box-shadow either —
   an outer-document box-shadow outranks Lumo's :host([focus-ring]) ring and
   would kill the keyboard focus outline. */
.mix-match-title-divider {
  width: 1px;
  height: 22px;
  flex: 0 0 auto;
  background: var(--lumo-contrast-15pct);
}

/* Hide/Show column toggles — neutral outline, reads as view state */
.mix-match-toggle {
  --vaadin-button-border-radius: 999px;
  --vaadin-button-tertiary-padding: 0 14px;
  --vaadin-button-tertiary-background: transparent;
  --vaadin-button-tertiary-text-color: var(--lumo-body-text-color);
  --vaadin-button-tertiary-border: 1px solid var(--lumo-contrast-20pct);
  transition: background 0.15s, border-color 0.15s;
}
.mix-match-toggle:hover {
  --vaadin-button-tertiary-background: var(--lumo-contrast-5pct);
  --vaadin-button-tertiary-border-color: var(--lumo-contrast-30pct);
}
.mix-match-toggle[active] {
  --vaadin-button-tertiary-background: var(--lumo-contrast-10pct);
}

/* Reset Filters — the accented action, without stealing the bin's primary Load */
.mix-match-reset {
  --vaadin-button-border-radius: 999px;
  --vaadin-button-tertiary-padding: 0 14px;
  --vaadin-button-tertiary-background: transparent;
  --vaadin-button-tertiary-text-color: var(--lumo-primary-text-color);
  --vaadin-button-tertiary-border: 1px solid var(--lumo-primary-color-50pct);
  transition: background 0.15s, border-color 0.15s;
}
.mix-match-reset:hover {
  --vaadin-button-tertiary-background: var(--lumo-primary-color-10pct);
  --vaadin-button-tertiary-border-color: var(--lumo-primary-color);
}
.mix-match-reset[active] {
  --vaadin-button-tertiary-background: var(--lumo-primary-color-20pct);
}

/* ── Mix & Match — reserved filter area ──
   One fixed height for all three columns (2 x 64px field decks + 8px gap) so the
   Materials (5 filters) and Products (3) columns cannot wrap and the three
   grids still start on the same line. `justify-content: flex-end` drops the
   filter-free PCS column's Load to the bottom row, same as the others. */
.mix-match-filters {
  width: 100%;
  height: 136px;
  flex-shrink: 0;
  padding: 0;
  justify-content: flex-end;
  gap: 8px;
}
.mix-match-filter-row {
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
}

/* ── Mix & Match — the top bin, styled as an AI prompt/search bar ──
   One rounded shell holding the staged-row chips; a soft border that warms up
   on hover/focus is the whole "AI bar" cue — no gradients over the chips.
   Padding and gaps are set inline in the DSL (isPadding/isSpacing also write
   inline styles, which would otherwise win over this file). */
.mix-match-bin {
  width: 100%;
  flex-shrink: 0;
  min-height: 52px;
  border: 1px solid var(--lumo-contrast-15pct);
  border-radius: 26px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 24px -18px rgba(15, 23, 42, 0.45);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mix-match-bin:hover {
  border-color: var(--lumo-primary-color-50pct);
}
.mix-match-bin:focus-within {
  border-color: var(--lumo-primary-color);
  box-shadow: 0 0 0 3px var(--lumo-primary-color-10pct);
}

/* Single line of chips — crowded bins scroll sideways instead of growing the bar */
.mix-match-bin-chips {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}
.mix-match-bin-icon {
  flex: 0 0 auto;
  color: var(--lumo-primary-color);
}
.mix-match-bin-empty {
  color: var(--lumo-secondary-text-color);
  font-size: 0.85rem;
}

/* ── Staged-row chips — one color per catalog ──
   Teal is deliberately left free: it is reserved for the derived-value
   highlighting that is still to come. */
.mix-match-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}
.mix-match-chip-type {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.7;
}
.mix-match-chip-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mix-match-chip-close {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.6;
}
.mix-match-chip-close:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.12);
}
.mix-match-chip--material {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.mix-match-chip--pcs {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}
.mix-match-chip--product {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}
/* Pill Load button — via Lumo's own custom property so the default padding
   (and therefore the height) is kept; raw vertical padding would grow the bar. */
.mix-match-bin-load {
  --vaadin-button-border-radius: 999px;
  padding: 0 18px;
}

/* ── Danger-outline action button ("Clear") ──
   Sizing is handled in the component exactly like the Combine button
   (`large` theme + inline padding/font). Only the danger-outline look lives
   here, driven through the public --vaadin-button-* custom properties Lumo's
   base vaadin-button style consumes — no theme-name fights, no !important. */
vaadin-button.clearActionButton {
  --vaadin-button-background: transparent;
  --vaadin-button-text-color: #dc2626;
  --vaadin-button-border: 8px solid #dc2626;
  --vaadin-button-border-radius: var(--lumo-border-radius-m);
}

vaadin-button.clearActionButton:hover {
  --vaadin-button-background: #dc2626;
  --vaadin-button-text-color: #ffffff;
}

/* Vaadin sets the [active] attribute while the button is pressed */
vaadin-button.clearActionButton[active] {
  --vaadin-button-background: #b91c1c;
  --vaadin-button-text-color: #ffffff;
}

vaadin-button.clearActionButton[disabled] {
  opacity: 0.5;
}

/* ── Responsive ── */
/* When drawer is closed (mobile), the brand shows in navbar */
@media (max-width: 800px) {
  .laird-layout .navbar-brand-logo {
    height: 28px;
  }
}

/* ── Quotation views: fill the app content and scroll INSIDE ───────────
   The AppLayout content part is the only definite-height parent. Each
   quotation view owns the full height and hides overflow; exactly one
   inner region is allowed to scroll. */
.quotation-view {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.quotation-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

/* Let the app-layout content slot shrink instead of scrolling the page.
   Pages that own their full-bleed shell (the newp worksheet, SBD) keep the
   content edge; the rest get the enterprise gutter the old Aura inset used to
   provide. AppLayout 25.1 exposes the content wrapper as an internal `content`
   attribute, not a shadow part, so the gutter is applied to the routed root
   element itself. */
.laird-layout > :not([slot]) {
  min-height: 0;
}

.laird-layout > :not([slot]):not(.newp-page--editor):not(.sbd-page) {
  padding: 14px 16px;
  box-sizing: border-box;
  background: var(--laird-paper);
}

/* Long customer names/descriptions must wrap, never widen the page. */
.quotation-view .quotation-wrap-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ===========================================================================
   NEW PRODUCT — worksheet
   ===========================================================================
   One page, one instrument: a pricing specialist walks PCS -> geometry ->
   price. The look is a technical worksheet, not a card dashboard: hairline
   rules, a single deep-steel accent, numbers in tabular monospace, and the
   only elevation is a 1px rule. Everything below is a class, so the Kotlin
   carries no colours.

   Aura is the theme (see AppShell @StyleSheet). Its own tokens are used for
   text, background and focus; the semantic set below pins the surfaces this
   page needs so a theme update cannot repaint the worksheet.
   =========================================================================== */
.newp-page,
.sbd-page {
  --newp-canvas: #F1F5F9;
  --newp-surface: #FFFFFF;
  --newp-surface-muted: #F6F9FC;
  --newp-rule: #D4DEE8;
  --newp-rule-soft: #E5ECF3;
  --newp-rule-strong: #B8C7D6;
  --newp-ink: #14212F;
  --newp-ink-2: #4E5F71;
  --newp-ink-3: #6B7C8D;
  --newp-navy: #0B2239;
  --newp-navy-deep: #071829;
  --newp-accent: #1F4E79;
  --newp-accent-soft: #EAF1F7;
  --newp-accent-ink: #173E60;
  --newp-azure: #4C86B8;
  /* Border of a completed step: the accent mixed toward the surface. */
  --newp-accent-border: #B9CFE2;
  --newp-danger: #A12622;
  --newp-danger-soft: #FDF3F2;
  --newp-danger-rule: #ECC9C6;
  --newp-warn: #8A5A12;
  /* Amber surfaces for notices (overhang, "already exists"): the rule and the
     fill are tokens so no screen invents its own amber. */
  --newp-warn-rule: #E6D3A8;
  --newp-warn-soft: #FDF6E7;
  --newp-ok: #2C6A4A;
  --newp-ok-rule: #C3DCCB;
  --newp-ok-soft: #F0F7F2;
  /* Cost anatomy: four separate hues, not four tints of one blue, so the
     material / labour / burden / overhead split reads at a glance. */
  --newp-anatomy-material: #2F6F8F;
  --newp-anatomy-labor: #3F8F6B;
  --newp-anatomy-burden: #C08A2E;
  --newp-anatomy-overhead: #8C6BB1;
  --newp-radius: 4px;
  --newp-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  background: var(--newp-canvas);
  color: var(--newp-ink);
}

/* ── Masthead: the worksheet's title block ──
   The app navbar is the dark chrome; the masthead stays on paper. A 3px navy
   rule at its top ties it to the shell without creating a second dark band. */
.newp-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 12px;
  border-bottom: 1px solid var(--newp-rule);
  flex-shrink: 0;
}

.newp-header__row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 32px;
}

.newp-header__steps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.newp-header__titles {
  gap: 1px;
}

/* A failed request is read next to the step that produced it, not at the
   bottom of the page where the calculate button sits. */
.newp-header__error {
  flex: 0 1 420px;
  min-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--newp-danger-rule);
  border-left: 3px solid var(--newp-danger);
  border-radius: var(--newp-radius);
  background: var(--newp-danger-soft);
  color: var(--newp-danger);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.newp-title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--newp-navy);
}

/* Shared page heading for the list screens (articles, quotations, PCS). */
.page-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.2;
}

.newp-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--newp-ink-2);
  max-width: 78ch;
}

/* ── Two-column body: working column + fixed context rail ── */
.newp-body {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.newp-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.newp-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
}

/* Stage 3 is read, not filled: one column, capped at a readable measure. */
.newp-main--read {
  max-width: 1180px;
  width: 100%;
  align-self: center;
}

.newp-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.newp-columns > * {
  flex: 1 1 420px;
  min-width: 0;
}

/* ── Card: a section of the worksheet, not a floating panel ── */
.newp-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--newp-surface);
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  box-shadow: none;
}

/* The stage's main working surface. One 3px navy rule is enough to say
   "this is the instrument"; the other cards stay quiet. */
.newp-card--primary {
  border-top: 0;
}

/* The price-law card. Its equation plaque is the dark content signature. */
.newp-card--memo {
  border-top: 0;
  background: #FBFDFF;
}

.newp-card--muted {
  background: var(--newp-surface-muted);
  border-color: var(--newp-rule-soft);
}

/* Section label with a rule running to the edge: the worksheet's only
   decoration, and it carries the grouping. */
.newp-section {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 16px;
}

.newp-section__title {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--newp-navy);
  white-space: nowrap;
}

.newp-section__hint {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--newp-ink-3);
  white-space: nowrap;
}

.newp-section::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--newp-rule-soft);
}

/* ── Rows, stacks, grids ── */
.newp-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.newp-stack--tight {
  gap: 6px;
}

.newp-grid-2 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-start;
}

.newp-grid-2 > * {
  flex: 1 1 130px;
  min-width: 0;
}

/* ── Exchange-rate editor ──
   One row is From / To / Ratio / Remove. It wraps to one field per line on
   narrow screens; the remove action never stretches with the fields. */
.newp-fx {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.newp-fx__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  width: 100%;
  min-width: 0;
}

.newp-fx__row > * {
  flex: 1 1 130px;
  min-width: 0;
}

.newp-fx__row > vaadin-button {
  flex: 0 0 auto;
}

.newp-fx__meta {
  flex-wrap: wrap;
}

/* ── Text ── */
.newp-note {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--newp-ink-3);
}

.newp-note--warn {
  color: var(--newp-warn);
}

/* ── Article-number field (the one editable thing on the preview card) ──
   It replaces the read-only heading, so it carries the heading's weight and
   stays visually quiet until it is invalid or focused. */
.newp-item-field {
  --vaadin-input-field-value-font-size: 15px;
  --vaadin-input-field-value-font-weight: 600;
  font-family: var(--newp-mono);
  width: 100%;
  min-width: 180px;
  max-width: 340px;
}

.newp-item-field::part(input-field) {
  font-family: var(--newp-mono);
}

.newp-product-title {
  margin: 0;
  font-family: var(--newp-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--newp-navy);
  overflow-wrap: anywhere;
}

/* Orange, not red: the code is missing, not wrong. */
.newp-item-field[invalid] {
  --vaadin-input-field-border-color: var(--newp-warn);
  --vaadin-input-field-error-color: var(--newp-warn);
}

.newp-warn-triangle {
  display: inline-flex;
  align-items: center;
  color: var(--newp-warn);
  flex: 0 0 auto;
}

.newp-warn-triangle svg {
  display: block;
}

.newp-strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--newp-ink);
}

.newp-value {
  font-family: var(--newp-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--newp-ink);
}

/* ── Key/value rows (price law, batch, intermediates) ── */
.newp-kv {
  display: grid;
  grid-template-columns: 92px minmax(110px, max-content) minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 12px;
  font-size: 12.5px;
}

.newp-kv__label {
  color: var(--newp-ink-2);
}

.newp-kv__value {
  font-family: var(--newp-mono);
  font-variant-numeric: tabular-nums;
  color: var(--newp-ink);
}

.newp-kv__note {
  color: var(--newp-ink-3);
  font-size: 11.5px;
}

/* ── Price law: the identity of the item ──
   An item is not a number; it is a law. The plaque is the one dark element
   inside the worksheet, repeated on Stage 2 and Stage 3. */
.newp-law-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--newp-navy);
  border-radius: var(--newp-radius);
  border: 1px solid var(--newp-navy-deep);
}

.newp-law {
  font-family: var(--aura-font-family,inherit);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.newp-law__caption {
  font-size: 10.5px;
  line-height: 1.4;
  color: #A9BDD1;
  font-family: var(--newp-sans, inherit);
}

.newp-price-result {
  padding-top: 8px;
  border-top: 1px solid var(--newp-rule-soft);
  font-family: var(--aura-font-family, inherit);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--newp-navy);
}

/* Group inside the rail: a caption line, then its fields. */
.newp-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--newp-rule-soft);
}

.newp-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.newp-group__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--newp-ink-3);
}

/* ── Command bar ── */
.newp-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid var(--newp-rule);
  flex-shrink: 0;
  min-height: 44px;
}

.newp-footer__spacer {
  flex: 1 1 auto;
}

.newp-footer__trailing {
  gap: 10px;
}

/* Adopt-to-MT opt-in: a mode flag beside Save, with the (?) hint naming the
   manufacturing technology it will link the new article to. */
.newp-page .newp-adopt-check {
  font-size: 12.5px;
  color: var(--newp-ink-2);
  white-space: nowrap;
}

.newp-page .newp-hint {
  width: 15px;
  height: 15px;
  color: var(--newp-ink-3);
  cursor: help;
  flex: 0 0 auto;
}

.newp-page .newp-footer__back {
  --vaadin-button-background: var(--newp-surface);
  --vaadin-button-text-color: var(--newp-accent-ink);
  --vaadin-button-border-color: var(--newp-rule);
  --vaadin-button-shadow: none;
  --vaadin-button-padding: 7px 14px;
  --vaadin-button-font-weight: 600;
  font-size: 12.5px;
}

.newp-footer__back::before {
  content: "‹";
  margin-right: 7px;
  font-size: 16px;
  line-height: 1;
  color: var(--newp-accent);
}

.newp-footer__next {
  --vaadin-button-background: var(--newp-accent);
  --vaadin-button-text-color: #FFFFFF;
  --vaadin-button-border-color: var(--newp-accent);
  --vaadin-button-shadow: none;
  --vaadin-button-padding: 8px 18px;
  --vaadin-button-font-weight: 600;
  font-size: 12.5px;
}

.newp-footer__next::after {
  content: "›";
  margin-left: 8px;
  font-size: 16px;
  line-height: 1;
}

.newp-footer__next:hover {
  --vaadin-button-background: var(--newp-accent-ink);
  --vaadin-button-border-color: var(--newp-accent-ink);
}

.newp-footer__next[disabled] {
  --vaadin-button-background: #C9D8E5;
  --vaadin-button-text-color: #6B7C8D;
  --vaadin-button-border-color: #C9D8E5;
}

/* ── Save article: a commit action, not another "go forward" ──
   Deep green reads as "write the record" and stays quiet next to the blue
   primary navigation action. */
.newp-page .newp-save-button {
  --vaadin-button-background: #1E6B4E;
  --vaadin-button-text-color: #FFFFFF;
  --vaadin-button-border-color: #18563F;
  --vaadin-button-shadow: none;
  --vaadin-button-font-weight: 600;
  background: #1E6B4E;
  color: #FFFFFF;
  border: 1px solid #18563F;
  border-radius: var(--newp-radius);
  box-shadow: none;
}

.newp-page .newp-save-button:hover {
  --vaadin-button-background: #18563F;
  background: #18563F;
  border-color: #124532;
}

.newp-page .newp-save-button:focus-visible {
  outline: 2px solid #1E6B4E;
  outline-offset: 2px;
}

.newp-page .newp-save-button[disabled] {
  --vaadin-button-background: #D5E4DC;
  --vaadin-button-text-color: #6B7C8D;
  background: #D5E4DC;
  border-color: #C4D7CD;
  box-shadow: none;
  cursor: default;
}

/* Real download link styled like the top-right action buttons. */
.pdf-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--lumo-border-radius-m);
  color: var(--lumo-body-text-color, #111);
  background: var(--lumo-contrast-5pct);
  border-color: var(--newp-rule);
  font-family: inherit;
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.pdf-download-link:hover {
  background: var(--lumo-contrast-10pct);
  border-color: var(--newp-rule-strong);
  color: var(--lumo-body-text-color, #111);
  box-shadow: none;
}

.pdf-download-link:focus-visible {
  outline: 2px solid var(--lumo-primary-color);
  outline-offset: 2px;
}

.pdf-download-link vaadin-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Generate PDF uses the same tonal action look as the download link. */
.pdf-action-button {
  --vaadin-button-background: var(--lumo-primary-color-10pct);
  --vaadin-button-text-color: var(--lumo-body-text-color, #111);
  --vaadin-button-border: 1px solid transparent;
  --vaadin-button-border-color: transparent;
  --vaadin-button-shadow: none;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--lumo-border-radius-m);
  font-family: inherit;
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
  transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.pdf-action-button:hover {
  --vaadin-button-background: var(--lumo-primary-color);
  --vaadin-button-text-color: var(--lumo-body-text-color, #111);
  --vaadin-button-border-color: var(--lumo-primary-color);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.18);
}

/* ── Stage 3: reading layout ── */
.newp-proto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 14px;
  padding: 12px 14px;
  background: var(--newp-surface-muted);
  border: 1px solid var(--newp-rule-soft);
  border-radius: var(--newp-radius);
}

.newp-attr__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--newp-ink-3);
}

.newp-attr__value {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

.newp-attr__value--accent {
  color: var(--newp-accent-ink);
}

.newp-attr__value--mono {
  font-family: var(--newp-mono);
  font-size: 12px;
  font-weight: 500;
}

/* Metric readout: a labelled stop on the cost ladder. */
.newp-metric {
  min-width: 0;
  padding: 7px 8px 6px;
  border-top: 2px solid var(--newp-rule-soft);
  background: #FBFDFF;
}

.newp-metric--accent {
  border-top-color: var(--newp-accent);
  background: var(--newp-accent-soft);
}

/* The model-output readouts stay in two columns; a wide metric can claim the
   full row (the minimum order is the gate, not another rung). */
.newp-metrics > * {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
}

.newp-metrics > .newp-metric--wide {
  flex: 1 1 100%;
}

.newp-metric__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--newp-ink-3);
}

.newp-metric__value {
  font-family: var(--newp-mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--newp-ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.newp-metric__value--accent {
  color: var(--newp-accent-ink);
}

/* Long model prose: capped measure, generous leading, no wall of text. */
.newp-prose {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--newp-ink-2);
  white-space: pre-wrap;
  max-width: 82ch;
}

.newp-prose__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--newp-ink-3);
  margin-bottom: 2px;
}

/* ── Fold: a reading card that keeps pace with the card beside it ──
   COLLAPSED: the body is clipped at the partner card's height, so the two
   columns end on the same edge and the text is cut mid-line.
   OPEN: the body scrolls INSIDE the card (same height, arrow always in view).
   The height is not a guess — `--newp-fold-h` is measured from the client card
   in the browser (SummarizationStage.bindHeightTo). 240 px is the fallback
   before the first measurement and when the columns are stacked. */
.newp-fold {
    --newp-fold-h: 240px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    /* one frame for both states: the frame is the partner's height */
    height: var(--newp-fold-h);
    max-height: var(--newp-fold-h);
    overflow: hidden;
}

/* Same surface, padding and radius as .newp-card: the fold is one of the two
   columns, not a floating overlay on the page. */
.newp-fold.newp-card {
    padding: 14px 16px;
}

/* The whole card is bounded; only the body changes between clipping and
   scrolling. */
.newp-fold__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.newp-fold--open .newp-fold__body {
    overflow-y: auto;
    /* keep the scrollbar off the text */
    padding-right: 6px;
    margin-right: -6px;
}

/* Header: never scrolls, so the arrow stays put while the text moves. */
.newp-fold__head {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    background: var(--newp-surface);
    border-bottom: 1px solid var(--newp-rule-soft);
    cursor: pointer;
    user-select: none;
}

.newp-fold__head:focus-visible {
    outline: 2px solid var(--newp-accent);
    outline-offset: -2px;
}

.newp-fold__head:hover .newp-fold__chevron {
    color: var(--newp-accent-ink);
}

.newp-fold__titles {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Chevron points RIGHT when folded (there is more below) and DOWN when open. */
.newp-fold__chevron {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: var(--newp-ink-3);
    transform: rotate(0deg);
    transition: transform 180ms ease, color 120ms ease;
}

.newp-fold__chevron svg {
    display: block;
    overflow: visible;
}

/* The titles use the section caption's type, so the fold's header lines up with
   "Model outputs" across the column gap. */
.newp-fold .newp-prose__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--newp-ink);
    margin-bottom: 0;
}

.newp-fold--open .newp-fold__chevron {
    transform: rotate(90deg);
}

/* One part of the explanation: title, then body. */
.newp-fold__part {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.newp-fold__rule {
    height: 1px;
    background: var(--newp-rule-soft);
    margin: 0;
}

/* VALUES: the backend's declaration list, read as data. Each line is
   `label = value unit`; the mono face is what keeps the '=' and the units
   aligned without turning it into a table. */
.newp-vals {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: var(--newp-surface-muted);
    border: 1px solid var(--newp-rule-soft);
    border-radius: var(--newp-radius);
    font-family: var(--newp-mono);
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--newp-ink-2);
}

.newp-vals__term {
    color: var(--newp-ink-3);
    /* The backend indents its declarations; keep the indent, but let a long
       label wrap rather than run under the value. */
    white-space: pre-wrap;
}

/* One declaration = one line. The term and its value live in the same row, so
   they never get split into two lines by the column container. */
.newp-vals__line {
    display: block;
}

.newp-vals__row {
    font-variant-numeric: tabular-nums;
    color: var(--newp-ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* REASONING reads as prose; the first line is the conclusion, so it keeps the
   same measure as the rest but is not set apart by colour. */
.newp-reasoning {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--newp-ink-2);
    max-width: 82ch;
    white-space: pre-wrap;
}

/* ── Error banner (inline, not a floating alert) ── */
.newp-error {
  padding: 8px 10px;
  border: 1px solid var(--newp-danger-rule);
  border-left: 3px solid var(--newp-danger);
  border-radius: var(--newp-radius);
  background: var(--newp-danger-soft);
  color: var(--newp-danger);
  font-size: 12px;
  white-space: pre-wrap;
}

/* ── Responsive ──
   The rail stays on the right down to 900px: below that the two columns would
   each be too narrow to use. When it does drop, the work column needs an
   explicit height or the stage's own scroll container (height: 100%) collapses
   to zero. */
@media (max-width: 900px) {
  .newp-body {
    flex-direction: column;
  }

  .newp-main {
    height: 68vh;
    flex: 0 0 auto;
  }

  .newp-rail {
    flex: 0 0 auto;
    width: 100%;
  }

  .newp-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .newp-grid-2,
  .newp-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .newp-kv {
    grid-template-columns: 88px minmax(90px, max-content) minmax(0, 1fr);
  }
}

/* ── Stepper: a station track, not four buttons ──
   The Kotlin sets `data-step` and the state attributes (`active` /
   `completed` / `locked`); the mark inside the station is pure CSS. The button
   text is the plain stage name, and the accessible name is set in Kotlin. */
.newp-page .newp-step {
  margin: 0;
  min-height: 34px;
  padding: 4px 12px 4px 8px;
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-surface);
  color: var(--newp-ink);
  --vaadin-button-background: var(--newp-surface);
  --vaadin-button-text-color: var(--newp-ink);
  --vaadin-button-border-color: var(--newp-rule);
  --vaadin-button-shadow: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  box-shadow: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 120ms ease, background-color 120ms ease,
    color 120ms ease;
}

.newp-page .newp-step::before {
  content: attr(data-step);
  position: static;
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--newp-rule-strong);
  border-radius: 50%;
  background: var(--newp-surface-muted);
  color: var(--newp-ink-3);
  font-family: var(--newp-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  opacity: 1;
  pointer-events: none;
}

.newp-page .newp-step:hover {
  border-color: var(--newp-rule-strong);
  background: var(--newp-surface-muted);
  color: var(--newp-ink);
}

.newp-page .newp-step[active] {
  border-color: var(--newp-accent);
  background: var(--newp-accent);
  color: #FFFFFF;
  --vaadin-button-background: var(--newp-accent);
  --vaadin-button-text-color: #FFFFFF;
  --vaadin-button-border-color: var(--newp-accent);
  font-weight: 600;
  cursor: default;
}

.newp-page .newp-step[active]::before {
  border-color: #FFFFFF;
  background: #FFFFFF;
  color: var(--newp-accent);
}

/* The active step must not lighten under the pointer: it is not a link. */
.newp-page .newp-step[active]:hover {
  border-color: var(--newp-accent);
  background: var(--newp-accent);
  color: #FFFFFF;
}

.newp-page .newp-step[completed] {
  border-color: var(--newp-accent-border);
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
  --vaadin-button-background: var(--newp-accent-soft);
  --vaadin-button-text-color: var(--newp-accent-ink);
  --vaadin-button-border-color: var(--newp-accent-border);
  font-weight: 600;
}

.newp-page .newp-step[completed]::before {
  content: "✓";
  border-color: var(--newp-accent);
  background: var(--newp-accent);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 11px;
}

.newp-page .newp-step[locked] {
  border-color: var(--newp-rule-soft);
  background: var(--newp-surface-muted);
  color: var(--newp-ink-3);
  --vaadin-button-background: var(--newp-surface-muted);
  --vaadin-button-text-color: var(--newp-ink-3);
  --vaadin-button-border-color: var(--newp-rule-soft);
  cursor: not-allowed;
}

.newp-page .newp-step[locked]::before {
  content: "";
  position: static;
  inset: auto;
  border: 0;
  background: currentColor;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M4.5 7V5a3.5 3.5 0 1 1 7 0v2h.5A1.5 1.5 0 0 1 13.5 8.5v5A1.5 1.5 0 0 1 12 15H4a1.5 1.5 0 0 1-1.5-1.5v-5A1.5 1.5 0 0 1 4 7h.5Zm1.5 0h4V5a2 2 0 1 0-4 0v2Z'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M4.5 7V5a3.5 3.5 0 1 1 7 0v2h.5A1.5 1.5 0 0 1 13.5 8.5v5A1.5 1.5 0 0 1 12 15H4a1.5 1.5 0 0 1-1.5-1.5v-5A1.5 1.5 0 0 1 4 7h.5Zm1.5 0h4V5a2 2 0 1 0-4 0v2Z'/%3E%3C/svg%3E") center / 12px 12px no-repeat;
}

/* Connector: a hairline, not a text arrow. */
.newp-arrow {
  width: 16px;
  height: 1px;
  flex: 0 0 16px;
  display: block;
  background: var(--newp-rule);
  font-size: 0;
}

/* Quotation wizard stepper: the emoji + ordinal already identify the step, so
   drop the station circle. Scoped to `.quotation-view`; the New Product wizard
   keeps its marks. Must stay after the `.newp-step::before` rules above. */
.quotation-view .newp-step::before {
  display: none;
}

/* Icons replaced both the emoji and the numbered station circle. */
.newp-page .newp-step::before {
  display: none;
}

.newp-step vaadin-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: inherit;
}

.quotation-view .newp-step {
  padding-left: 12px;
  gap: 6px;
}

.newp-arrow[passed] {
  background: var(--newp-accent);
}

/* ── Filter deck: a narrow, quiet column beside the result table ── */
.newp-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
}

.newp-filter {
  flex: 1 1 220px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Stage 3 tables of intermediate values ── */
.newp-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.newp-line {
  display: grid;
  grid-template-columns: 140px minmax(72px, max-content) minmax(0, 1fr);
  align-items: baseline;
  gap: 4px 12px;
  min-width: 0;
  padding: 5px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.newp-line:last-child {
  border-bottom: 0;
}

.newp-line__label {
  font-size: 11.5px;
  color: var(--newp-ink-2);
}

.newp-line__value {
  font-family: var(--newp-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--newp-ink);
  white-space: nowrap;
}

/* The material table gets a definite height inside the scrolling worksheet;
   the grid then scrolls its own rows instead of growing the page. */
.newp-grid-host {
  flex: 1 1 340px;
  min-width: 300px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

/* Filling variant: used where the card itself takes the leftover viewport
   height (picking stage), so only the table scrolls. */
.newp-grid-host--fill {
  flex: 1 1 0;
  min-width: 0;
  min-height: 120px;
  height: auto;
}

/* One-row filter strip above a table (four short filters). */
.newp-grid-4 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

.newp-grid-4 > * {
  flex: 1 1 150px;
  min-width: 0;
}

/* The filter deck is an inset tool tray, not another card. */
.newp-filter-strip {
  padding: 8px 10px 10px;
  border: 1px solid var(--newp-rule-soft);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
}

/* Selected count in the materials card header. */
.newp-selected-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--newp-accent-border);
  border-radius: 999px;
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
  font-family: var(--newp-mono);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Materials table ──
   A data table, not a set of cards: steel-tinted header, compact rows, mono
   codes and dimensions, navy selection. */
.newp-materials-grid::part(header-cell) {
  background: #EDF3F9;
  color: var(--newp-navy);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--newp-rule);
}

.newp-materials-grid::part(cell) {
  font-size: 12px;
}

.newp-materials-grid::part(body-cell) {
  font-size: 12px;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.newp-materials-grid::part(row):hover {
  background: #F4F8FC;
}

/* ── Overview grids: actionable rows ──
   The catalogue overviews (materials, intermediates, products, PCS) navigate on
   row click, so their rows get a pointer and a stronger hover tint. Grids
   without row actions stay pointer-free; add the `overview-grid` class to a
   grid to opt INTO the affordance, never to all grids blindly. */
.overview-grid::part(row):hover {
  background: #F4F8FC;
  cursor: pointer;
}

.newp-materials-grid::part(selected-row) {
  background: #E8F1FA;
  color: var(--newp-navy);
  font-weight: 500;
}

/* Material name cell: category icon before the article key. */
.material-name-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.material-name-cell .cat-icon {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
}

.material-name-cell .cat-icon svg {
  display: block;
}

.material-name-cell .material-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Category dropdown option: icon + short label. */
.category-option {
  gap: 7px;
  min-width: 0;
}

.cat-icon {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
  vertical-align: middle;
}

.cat-icon svg {
  display: block;
}

.category-option .cat-icon {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
}

.category-option .cat-icon svg {
  display: block;
}

@media (max-width: 760px) {
  .newp-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Chips (category / kind / asylum / margin) ──
   Neutral by default; only the asylum state carries colour, because it is the
   one fact a reader must not miss. */
.newp-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--newp-rule);
  border-radius: 3px;
  background: var(--newp-surface);
  color: var(--newp-ink-2);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

/* Tag-panel chips: real pills, not small technical labels. */
.tag-chip {
  cursor: pointer;
  user-select: none;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-color: var(--newp-rule-strong);
  background: var(--newp-surface-muted);
  color: var(--newp-ink);
}

.tag-chip__icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  line-height: 0;
}

.tag-chip__icon svg {
  display: block;
}

.tag-chip:hover {
  border-color: var(--newp-accent);
  background: var(--newp-accent-soft);
}

.tag-chip[active] {
  border-color: var(--newp-accent);
  background: var(--newp-accent);
  color: #FFFFFF;
}

.tag-chip[active]:hover {
  border-color: var(--newp-accent);
  background: var(--newp-accent);
  color: #FFFFFF;
}

.tag-filter {
  padding: 2px 0;
  gap: 10px;
}

/* Tag labels get a fixed column so preset/tag rows read as a block. */
.tag-filter__label {
  min-width: 52px;
  flex: 0 0 auto;
}

.tag-filter .tag-chip {
  padding: 5px 12px;
  font-size: 12px;
}

.tag-chip--offer {
  color: var(--newp-ink);
  background: var(--newp-surface-muted);
}

/* Article-list pages: tags and filters are two visible worksheet cards. */
.article-tag-panel .tag-filter {
  padding: 12px 14px;
  background: var(--newp-surface);
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
}

.article-filters {
  padding: 12px 14px;
  background: var(--newp-surface);
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
}

/* Preset tree: breadcrumb path + one row per revealed level. */
.tag-tree__path {
  min-height: 24px;
}

.tag-tree__crumb {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--newp-ink-3);
}

.tag-tree__crumb:hover {
  color: var(--newp-ink);
}

.tag-tree__crumb--active {
  cursor: default;
  color: var(--newp-ink);
  font-weight: 600;
}

.tag-tree__separator {
  color: var(--newp-ink-3);
}

.tag-tree__level {
  padding: 2px 0;
}

.newp-chip--accent {
  border-color: var(--newp-accent-border);
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
}

.newp-chip--warn {
  border-color: var(--newp-warn-rule);
  background: var(--newp-warn-soft);
  color: var(--newp-warn);
}

/* Contact editor: one clickable pill per offered person, plus "Add new". */
.contact-pills {
  align-items: center;
}

.contact-pill--add {
  border-style: dashed;
  border-color: var(--newp-accent-border);
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
}

/* Inset block holding the dimension inputs of the selected form/shape. */
.newp-fields {
  padding: 12px 14px;
  border: 1px solid var(--newp-rule-soft);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
}

/* ── Stored document / uploaded file ──
   A file is evidence, not a byte count: badge, name, size and state sit on one
   quiet inset row, with the actions at the trailing edge. */
.newp-file {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  box-sizing: border-box;
  border: 1px solid var(--newp-rule-soft);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
}

.newp-file--empty {
  border-style: dashed;
  background: transparent;
}

.newp-file__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 46px;
  border: 1px solid var(--newp-accent-border);
  border-radius: var(--newp-radius);
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
  font-family: var(--newp-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.newp-file__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.newp-file__name {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--newp-ink);
}

.newp-file__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--newp-ink-3);
}

.newp-file__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
}

/* The browser's own viewer lives inside this frame; keep the frame quiet so
   the document is the only thing that reads as content. */
.newp-pdf-preview {
  display: block;
  width: 100%;
  height: clamp(280px, 42vh, 420px);
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
}

.newp-pdf-preview[hidden] {
  display: none;
}

@media (max-width: 640px) {
  .newp-file {
    flex-wrap: wrap;
  }

  .newp-file__actions {
    width: 100%;
    margin-left: 0;
  }
}

/* A section caption whose rule stops at a trailing control (card header
   actions). The pseudo-element rule is replaced by an explicit span so it
   never runs underneath the control. */
.newp-section--trailing {
  flex-wrap: wrap;
  row-gap: 4px;
}

.newp-section--trailing::after {
  content: none;
}

.newp-section__rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--newp-rule-soft);
}

/* ── Shape / form option cards ── */
/* A WRAPPING FLEX ROW: the container is a `HorizontalLayout`, which writes
   `display: flex` inline — so the stylesheet describes the flex behaviour and
   never tries to override `display`.
   Equal heights come from `align-items: stretch` plus the fixed drawing slot
   below: a card with a placeholder instead of an SVG then occupies exactly the
   same vertical space as one with a drawing, so its title cannot drop. */
.newp-option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

/* Grow to share the row, but never narrower than a usable card. */
.newp-option-grid > * {
  flex: 1 1 150px;
  min-width: 0;
}

.newp-option {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 112px;
  padding: 8px;
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-surface);
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease,
    box-shadow 0.12s ease;
}

.newp-option:hover {
  border-color: var(--newp-rule-strong);
  background: #FBFDFF;
}

.newp-option[selected] {
  border-color: var(--newp-accent);
  background: var(--newp-accent-soft);
  box-shadow: inset 0 0 0 1px var(--newp-accent);
}

.newp-option[selected]::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--newp-accent);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* The drawing slot is a FIXED box, whatever is inside it. Height, min and max
   are all pinned because the slot is a flex child of the card: without this a
   taller child (or `min-height: auto`) could grow it, which is what pushed the
   title of a card with a placeholder down relative to the SVG cards.
   `flex: 0 0 84px` keeps the basis fixed when the card is stretched by the grid. */
.newp-option__drawing {
  flex: 0 0 76px;
  height: 76px;
  min-height: 76px;
  max-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--newp-ink-2);
}

.newp-option__placeholder {
  padding: 8px 12px;
  border: 1px dashed var(--newp-rule);
  border-radius: 4px;
  color: var(--newp-ink-3);
  font-size: 12px;
  font-weight: 600;
}

.newp-option__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--newp-ink);
  text-align: center;
  line-height: 1.25;
}

.newp-option__caption {
  font-size: 11px;
  color: var(--newp-ink-3);
  text-align: center;
  line-height: 1.25;
}

/* Drawing of the priced product: the fmodel's own figure with the concrete
   dimensions applied (`outputs.articleHeaders.svg`). A RESULT, so it sits in
   the result card under the price law, not among the inputs. The fragment
   paints with `currentColor`, so the ink must be explicit. */
.newp-drawing {
  display: flex;
  justify-content: center;
  padding: 4px 0 2px;
  color: var(--newp-ink);
}

.newp-drawing svg {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
}

/* Vertical hairline used between two columns (replaces an empty Div). */
.newp-rule-vertical {
  display: block;
  width: 1px;
  align-self: stretch;
  background: var(--newp-rule-soft);
}

/* ── Context rail: collapses left-to-right ──
   The body is a fixed-width column; collapsing hides it and leaves a narrow
   vertical handle at the right edge. The rail itself is width-auto, so the
   working column takes the freed space instead of the page growing taller. */
.newp-context {
  width: auto;
  max-width: 100%;
}

.newp-context__body {
  width: 336px;
  flex: 0 0 336px;
  padding: 0 14px 14px;
  background: var(--newp-surface);
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
}

.newp-context__head {
  margin: 0 -14px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--newp-rule);
  background: #FBFDFF;
  border-radius: var(--newp-radius) var(--newp-radius) 0 0;
}

.newp-context__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--newp-navy);
}

.newp-context__collapse,
.newp-context__handle {
  --vaadin-button-background: transparent;
  --vaadin-button-border-radius: 3px;
  --vaadin-button-text-color: var(--newp-ink-2);
  --vaadin-button-border: 1px solid var(--newp-rule);
  --vaadin-button-border-radius: 4px;
  --vaadin-button-padding: 0 8px;
  min-width: 26px;
  min-height: 26px;
  font-size: 13px;
  line-height: 1;
}

.newp-context__collapse:hover,
.newp-context__handle:hover {
  --vaadin-button-background: var(--newp-surface-muted);
  --vaadin-button-text-color: var(--newp-ink);
  --vaadin-button-border-color: var(--newp-rule-strong);
}

/* Vertical strip: the collapsed state of the rail. */
.newp-page .newp-context__handle {
  --vaadin-button-padding: 0;
  --vaadin-button-background: var(--newp-navy);
  --vaadin-button-text-color: #FFFFFF;
  --vaadin-button-border-color: var(--newp-navy);
  background: var(--newp-navy);
  color: #FFFFFF;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  min-width: 30px;
  width: 30px;
  align-self: flex-start;
  min-height: 168px;
  letter-spacing: 0.02em;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.newp-page .newp-context__handle:hover {
  background: var(--newp-navy-deep);
  border-color: var(--newp-navy-deep);
  color: #FFFFFF;
  --vaadin-button-background: var(--newp-navy-deep);
  --vaadin-button-text-color: #FFFFFF;
}

/* ── Collapsible variant pickers (form / cross-section) ── */
.newp-variant {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.newp-variant__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 24px;
}

.newp-variant__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--newp-ink-3);
}

.newp-variant__value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--newp-ink);
}

.newp-variant__toggle {
  --vaadin-button-background: transparent;
  --vaadin-button-text-color: var(--newp-accent-ink);
  --vaadin-button-border: 1px solid var(--newp-rule);
  --vaadin-button-border-radius: 3px;
  --vaadin-button-padding: 0 8px;
  min-height: 22px;
  font-size: 11.5px;
}

.newp-variant__toggle:hover {
  --vaadin-button-background: var(--newp-accent-soft);
  --vaadin-button-border-color: var(--newp-accent-border);
}

/* Skeleton state: the card exists before pricing, so the layout does not jump
   when the numbers arrive and the eye can see what is still empty. */
.newp-skeleton {
  color: var(--newp-ink-3);
  opacity: 0.55;
}

/* ── Model badge: a status chip, not a sentence ── */
.newp-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--newp-accent-border);
  border-radius: 3px;
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
  font-family: var(--newp-mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.newp-model-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--newp-accent);
}

.newp-model-chip--warn {
  border-color: var(--newp-warn-rule);
  background: var(--newp-warn-soft);
  color: var(--newp-warn);
}

.newp-model-chip--warn::before {
  background: var(--newp-warn);
}

/* ── Cost anatomy: the VC vector as one bar ──
   Four components, four distinct hues (see the --newp-anatomy-* tokens) so
   the split is legible at a glance. This is a reading of numbers the engine
   already returned, not a new calculation. */
.newp-anatomy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}

.newp-anatomy__bar {
  display: flex;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--newp-rule-soft);
}

.newp-anatomy__seg {
  height: 100%;
  min-width: 0;
}

.newp-anatomy__seg--material { background: var(--newp-anatomy-material); }
.newp-anatomy__seg--labor { background: var(--newp-anatomy-labor); }
.newp-anatomy__seg--burden { background: var(--newp-anatomy-burden); }
.newp-anatomy__seg--overhead { background: var(--newp-anatomy-overhead); }

.newp-anatomy__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
}

.newp-anatomy__key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--newp-ink-2);
  white-space: nowrap;
}

.newp-anatomy__dot {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  flex: 0 0 7px;
}

.newp-anatomy__dot--material { background: var(--newp-anatomy-material); }
.newp-anatomy__dot--labor { background: var(--newp-anatomy-labor); }
.newp-anatomy__dot--burden { background: var(--newp-anatomy-burden); }
.newp-anatomy__dot--overhead { background: var(--newp-anatomy-overhead); }

.newp-anatomy__value {
  font-family: var(--newp-mono);
  font-size: 10.5px;
  color: var(--newp-ink);
}

/* ── Generated rationale: a report inside the worksheet ── */
.newp-document {
  max-width: 82ch;
  padding: 2px 2px 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--newp-ink-2);
}

.newp-document h1,
.newp-document h2,
.newp-document h3,
.newp-document h4 {
  color: var(--newp-navy);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.newp-document h1 { font-size: 19px; margin: 4px 0 10px; }
.newp-document h2 { font-size: 16px; margin: 18px 0 8px; }
.newp-document h3 { font-size: 14px; margin: 14px 0 6px; }
.newp-document h4 { font-size: 13px; margin: 12px 0 4px; }

.newp-document p { margin: 0 0 10px; }

.newp-document ul,
.newp-document ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.newp-document li { margin-bottom: 3px; }

.newp-document table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 12px;
}

.newp-document th {
  background: #EDF3F9;
  color: var(--newp-navy);
  font-weight: 600;
  text-align: left;
}

.newp-document th,
.newp-document td {
  padding: 6px 8px;
  border: 1px solid var(--newp-rule-soft);
}

.newp-document strong { color: var(--newp-ink); }

@media (prefers-reduced-motion: reduce) {
  .newp-step,
  .newp-option,
  .newp-fold__chevron {
    transition: none;
  }
}

/* Stage 2: the geometry gets the wider column; the price memo is a fixed
   reading rail. */
.newp-calc {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.newp-calc > .newp-card {
  flex: 1.15 1 420px;
  min-width: 0;
}

.newp-calc > .newp-card--memo {
  flex: 0.85 1 340px;
}

.newp-grid-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.newp-grid-pair > * {
  flex: 1 1 200px;
  min-width: 0;
}

/* ── Quotation wizard — worksheet chrome ──────────────────────────────
   The quotation wizard reuses the new-product worksheet tokens (`.newp-page`)
   and its stepper (`.newp-step`, defined once in the worksheet section — a
   second definition here used to outrank it and repaint the active state). */
.newp-card--fill {
  flex: 1 1 auto;
  min-height: 0;
}

/* ── Quotation item rows ────────────────────────────────────────────── */
.quotation-item-row {
  padding-top: 10px;
}

.quotation-item-row + .quotation-item-row {
  border-top: 1px solid var(--newp-rule-soft);
}

/* Inside the Items step each selected row is a clearly separated block; the
   read-only quotation detail uses the same blocks so row boundaries are
   obvious without relying on a hairline. */
.quotation-items-scroll .quotation-item-row,
.quotation-items-list .quotation-item-row {
  padding: 10px 12px;
  background: var(--newp-surface-muted);
  border: 1px solid var(--newp-rule-soft);
  border-top: 0;
  border-radius: var(--newp-radius);
}

.quotation-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Detail/Review item cards: white surface on the worksheet, so they read as
   documents; the field boxes carry the filled look instead of the card. */
.quotation-items-list .quotation-item-row {
  padding: 14px 16px;
  background: var(--newp-surface);
  border: 1px solid var(--newp-rule);
  border-top: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
}

/* Read-only quotation detail: a stronger item card with a clear head. */
.quotation-items-list .quotation-item-row--detail {
  padding: 16px 18px;
  gap: 10px;
}

.quotation-item-row--detail .quotation-item-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.quotation-item-row--detail .quotation-item-title {
  font-size: 16px;
}

.quotation-item-row--detail .quotation-item-desc {
  margin-top: -4px;
}

.quotation-detail-document {
  padding-bottom: 2px;
}

.quotation-item-row--detail .quotation-review-prices {
  margin-top: 2px;
}

/* Document data inside an item: two columns of label/value fact rows, divided
   by a hairline. The label is muted, the value bold. */
.quotation-item-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 24px;
}

.quotation-item-fact {
  min-width: 0;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.quotation-item-fact:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.quotation-item-fact__label {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--newp-ink-3);
}

.quotation-item-fact__value {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

.quotation-item-fact__value--warn {
  color: var(--newp-warn);
}

/* Divider caption between quantity levels. */
.quotation-item-level {
  grid-column: 1 / -1;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--newp-rule);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--newp-ink-3);
}

.quotation-item-title {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--newp-ink);
}

.quotation-item-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--newp-ink-2);
}

/* Read-only item numbers: the worksheet mono face is hard to read at this
   size, so the detail facts use the page's normal typography. */
.quotation-items-list .newp-value {
  font-family: inherit;
  font-variant-numeric: normal;
}

/* Validity countdown on the quotation overview. */
.quotation-expiry {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--newp-ink);
}

.quotation-expiry--warn {
  color: var(--newp-warn);
}

.quotation-ladder {
  display: grid;
  grid-template-columns: 80px repeat(4, minmax(70px, 1fr));
  gap: 2px 12px;
  align-items: baseline;
}

.quotation-ladder__head {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--newp-ink-3);
}

/* Compact variant for the selected-customer summary. */
.newp-card--compact {
  padding: 10px 12px;
  gap: 8px;
}

/* ── Quotation step: summary row and total ──
   The subject is one priced product, so the row is an inset of the card, not a
   table: name/description on the left, the sold quantity on the right. */
.newp-summary-row {
  padding: 9px 12px;
  border: 1px solid var(--newp-rule-soft);
  border-left: 3px solid var(--newp-navy);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
}

/* The only number that closes the quotation. Sits on the baseline of the
   Notes field, aligned with the card edge. */
.newp-qtotal {
  flex: 0 0 auto;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--newp-accent-border);
  border-radius: var(--newp-radius);
  background: var(--newp-accent-soft);
}

.newp-qtotal__label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--newp-accent-ink);
}

.newp-qtotal__value {
  font-family: var(--newp-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--newp-navy);
  font-variant-numeric: tabular-nums;
}

/* Selected-item rows are the only page-level scroll region in the Items step. */
.quotation-items-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

/* Compact added-row list in the Items step. */
.quotation-items-scroll {
  gap: 6px;
}

.quotation-items-scroll .quotation-item-row {
  padding: 8px 10px;
}

.quotation-items-scroll .quotation-item-row .newp-strong {
  font-size: 13px;
}

.quotation-items-scroll .quotation-item-row .newp-value {
  font-size: 12px;
}

.quotation-items-scroll .quotation-item-row .newp-chip {
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.5;
}

.quotation-items-scroll .quotation-ladder {
  grid-template-columns: minmax(58px, 0.9fr) repeat(4, minmax(0, 1fr));
  gap: 2px 6px;
  min-width: 0;
  align-items: center;
}

.quotation-items-scroll .quotation-ladder__head {
  font-size: 9.5px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quotation-items-scroll .quotation-ladder__head:first-child {
  text-align: left;
}

.quotation-items-scroll .quotation-ladder__qty {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.quotation-items-scroll .quotation-ladder__cell {
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.quotation-items-scroll .quotation-ladder__remove {
  flex: 0 0 auto;
  padding: 0 2px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: var(--newp-ink-3);
}

.quotation-items-scroll .quotation-ladder__remove:hover {
  color: var(--newp-warn);
  background: var(--newp-warn-soft);
}

/* ── Items step: newP-style columns ──────────────────────────────────────
   Tags on the left (structured column mode like newP), filters above the
   catalogue in the middle, and the added quotation rows on the right. */
.quotation-items-layout {
  display: grid;
  grid-template-columns: var(--tag-panel-width) minmax(0, 2fr) minmax(340px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "tags work items";
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.quotation-items-layout > .quotation-items-tags,
.quotation-items-layout > .quotation-items-work,
.quotation-items-layout > .quotation-items-rows {
  min-width: 0;
  min-height: 0;
  align-self: stretch;
}

.quotation-items-layout > .quotation-items-tags {
  grid-area: tags;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* newP column mode, reused inside the quotation tag card. */
.quotation-items-tags .picking-tag-host {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.quotation-items-tags .picking-tags--column .tag-filter {
  height: 100%;
}

.quotation-items-layout > .quotation-items-work {
  grid-area: work;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.quotation-items-layout > .quotation-items-work > .quotation-items-filters {
  flex: 0 0 auto;
}

.quotation-items-layout > .quotation-items-work > .quotation-items-catalogue {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quotation-items-layout > .quotation-items-rows {
  grid-area: items;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* The quotation currency, stated once for every row below it. Full-width
   band with a green rule so the unit of the price ladder is unmissable. */
.quotation-items-currency {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--newp-ok);
  border-radius: var(--newp-radius);
  background: var(--newp-ok-soft);
  color: var(--newp-ok);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

.quotation-items-currency--unset {
  border-color: var(--newp-warn);
  background: var(--newp-warn-soft);
  color: var(--newp-warn);
  letter-spacing: normal;
}

@media (max-width: 1000px) {
  .quotation-items-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) minmax(220px, 1fr);
    grid-template-areas:
      "tags"
      "work"
      "items";
    overflow-y: auto;
  }
}

/* ── Quotation Review: summary left, articles right ───────────────────── */
.quotation-review-columns {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

/* Quotation detail: summary cards side by side, everything else full width. */
.quotation-detail-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.quotation-detail-top > * {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.quotation-detail-top > * > .newp-card {
  flex: 1 1 auto;
  height: 100%;
  box-sizing: border-box;
}

@media (max-width: 1000px) {
  .quotation-detail-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

.quotation-review-side,
.quotation-review-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* One compact two-line contact block inside the Contacts card. */
.quotation-review-contact + .quotation-review-contact {
  padding-top: 8px;
  border-top: 1px solid var(--newp-rule-soft);
}

/* Review article prices: one styled row per quantity, three columns. */
.quotation-review-prices {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quotation-review-prices__head-row,
.quotation-review-prices__row {
  display: grid;
  grid-template-columns: minmax(72px, 0.9fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.quotation-review-prices--with-cost .quotation-review-prices__head-row,
.quotation-review-prices--with-cost .quotation-review-prices__row {
  grid-template-columns: minmax(72px, 0.8fr) repeat(3, minmax(0, 1fr));
}

.quotation-review-prices__head-row {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--newp-rule);
}

.quotation-review-prices__row {
  padding: 5px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.quotation-review-prices__row:last-child {
  border-bottom: 0;
}

.quotation-review-prices__head {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--newp-ink-3);
  text-align: center;
  white-space: nowrap;
}

.quotation-review-prices__head:first-child {
  text-align: left;
}

.quotation-review-prices__qty-cell {
  justify-self: start;
  display: flex;
  align-items: center;
  min-width: 0;
}

.quotation-review-prices__qty {
  justify-self: start;
  padding: 1px 8px;
  border: 1px solid var(--newp-rule-soft);
  border-radius: 999px;
  background: var(--newp-surface-muted);
  color: var(--newp-ink);
  font-family: var(--newp-mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quotation-items-qty-remove {
  padding: 0 2px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  color: var(--newp-ink-3);
}

.quotation-items-qty-remove:hover {
  color: var(--newp-warn);
  background: var(--newp-warn-soft);
}

.quotation-review-prices__cell {
  font-size: 12.5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* ── Pricing extract card ─────────────────────────────────────────────── */
.pricing-extract__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}

.pricing-extract__fact {
  min-width: 0;
  padding: 5px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.pricing-extract__table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pricing-extract__head,
.pricing-extract__row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(90px, 0.8fr) minmax(110px, 1fr);
  gap: 12px;
  align-items: center;
}

.pricing-extract__head {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--newp-rule);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--newp-ink-3);
}

.pricing-extract__row {
  padding: 4px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
  font-size: 12.5px;
}

.pricing-extract__row:last-child {
  border-bottom: 0;
}

.pricing-extract__item {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pricing-extract__number {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pricing-extract__sub {
  padding-left: 10px;
  border-left: 2px solid var(--newp-rule-soft);
}

/* Pricing extract PDF download: a link that reads as a secondary button. */
.article-pdf-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--newp-rule);
  border-radius: var(--lumo-border-radius-m);
  background: var(--lumo-contrast-5pct);
  color: var(--lumo-body-text-color, #111);
  font-family: inherit;
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 120ms ease;
}

.article-pdf-download:hover {
  background: var(--lumo-contrast-10pct);
}

/* Shared look for Open/Download/Preview PDF actions: gray, no border. */
.pdf-gray-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: var(--lumo-border-radius-m);
  background: var(--lumo-contrast-5pct);
  color: var(--lumo-body-text-color, #111);
  font-family: inherit;
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  --vaadin-button-background: var(--lumo-contrast-5pct);
  --vaadin-button-text-color: var(--lumo-body-text-color, #111);
  --vaadin-button-border: none;
  --vaadin-button-border-color: transparent;
  --vaadin-button-shadow: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.pdf-gray-button:hover {
  background: var(--lumo-contrast-10pct);
  --vaadin-button-background: var(--lumo-contrast-10pct);
  color: var(--lumo-body-text-color, #111);
}

.pdf-hidden-download {
  display: none;
}

/* Documents list: the grid itself carries the frame. */
.documents-grid {
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  overflow: hidden;
}

/* Documents page: text preview inside the open-document dialog. */
.document-preview {
  display: block;
  max-height: 55vh;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--newp-rule-soft);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
  font-family: var(--newp-mono);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1000px) {
  .quotation-review-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Articles first when the columns collapse: the user must not scroll past
     the whole summary to reach them. */
  .quotation-review-main {
    order: -1;
  }
}

/* ===========================================================================
   SBD — catalogue bench
   ===========================================================================
   The SBD page reuses the worksheet tokens above, but has its own shell: a
   scope card, a four-channel core, a policy rail and a report manifest. The
   manifest is the page's signature element; no stat cards, no chips, no
   elevation. Numbers are tabular mono, status is words.
   =========================================================================== */
.sbd-page {
  height: 100%;
  overflow: hidden;
}

.sbd-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
  padding: 14px 18px 12px;
  box-sizing: border-box;
}

.sbd-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
  width: 100%;
}

.sbd-top-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0%;
  min-width: 0;
}

.sbd-top-left .newp-title {
  flex-shrink: 0;
  white-space: nowrap;
}

.sbd-derived-card {
  flex: 0 0 380px;
  width: 380px !important;
  align-self: flex-start;
}

.sbd-derived-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.sbd-derived-state {
  display: block;
  min-height: 16px;
  max-width: 72ch;
  font-size: 11px;
  line-height: 1.4;
  color: var(--newp-ink-3);
  text-align: left;
}

.sbd-status {
  display: block;
  min-height: 18px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--newp-ink-2);
  white-space: pre-wrap;
}

.sbd-status--error {
  padding: 8px 10px;
  border: 1px solid var(--newp-danger-rule);
  border-left: 3px solid var(--newp-danger);
  border-radius: var(--newp-radius);
  background: var(--newp-danger-soft);
  color: var(--newp-danger);
  white-space: pre-wrap;
}

.sbd-body {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.sbd-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.sbd-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 380px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

/* Rail cards keep their natural height; the rail is the scroll container. */
.sbd-rail > .newp-card {
  flex: 0 0 auto;
}

.sbd-policy-card {
  /* Raw mode makes this card taller than the rail; let it size to its content
     and let the rail scroll instead of shrinking the card under its children. */
  flex: 0 0 auto;
}

.sbd-policy-decision {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--newp-rule-soft);
}

.sbd-footer {
  flex-shrink: 0;
  flex-wrap: wrap;
  row-gap: 8px;
}

.sbd-footer__note {
  max-width: 70ch;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--newp-ink-3);
}

.sbd-footer__note--warn {
  color: var(--newp-warn);
}

.sbd-footer__note--error {
  color: var(--newp-danger);
}

.sbd-mode-tabs {
  align-self: flex-start;
}

.sbd-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 2px 0;
}

.sbd-filter-summary {
  font-size: 11.5px;
  color: var(--newp-ink-3);
}

.sbd-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
  width: 100%;
}

.sbd-filter-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sbd-filter-group {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--newp-ink-3);
}

.sbd-json {
  height: calc(100vh - 30rem);
  min-height: 16rem;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.sbd-editor-tabs {
  align-self: flex-start;
}

.sbd-editor-panel {
  width: 100%;
  min-height: 0;
}

.sbd-editor-panel .sbd-grid {
  height: calc(100vh - 30rem);
  min-height: 16rem;
}

.sbd-grid {
  width: 100%;
}

.sbd-field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--newp-ink-2);
}

.sbd-fixed-fields {
  display: block;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--newp-ink-2);
  overflow-wrap: anywhere;
}

.sbd-policy-shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sbd-policy-hint {
  display: block;
  min-height: 16px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--newp-ink-3);
}

.sbd-policy-hint--warn {
  color: var(--newp-warn);
}

.sbd-report-state {
  display: block;
  min-height: 17px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--newp-ink-2);
}

.sbd-report-state--warn {
  color: var(--newp-warn);
}

.sbd-report-state--error {
  color: var(--newp-danger);
}

.sbd-report-kv {
  display: flex;
  flex-direction: column;
  width: 100%;
  border-top: 1px solid var(--newp-rule);
}

.sbd-report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: baseline;
  width: 100%;
  padding: 4px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
  box-sizing: border-box;
}

.sbd-report-label {
  font-size: 11.5px;
  color: var(--newp-ink-2);
}

.sbd-report-value {
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  text-align: right;
  color: var(--newp-ink);
}

.sbd-report-note {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: var(--newp-ink-3);
}

.sbd-report-note--warn {
  color: var(--newp-warn);
}

.sbd-derived-detail {
  display: block;
  max-width: 72ch;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--newp-ink-2);
  text-align: left;
}

@media (max-width: 1100px) {
  .sbd-page {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  .sbd-shell {
    height: auto;
    min-height: 100%;
  }

  .sbd-body {
    flex-direction: column;
    flex: 0 0 auto;
  }

  .sbd-main,
  .sbd-rail {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    overflow: visible;
    padding-right: 0;
  }

  .sbd-top {
    flex-direction: column;
  }

  .sbd-top-left,
  .sbd-derived-card {
    flex: 0 0 auto;
    width: 100% !important;
  }

  .sbd-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sbd-editor-panel {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .sbd-shell {
    padding: 12px;
  }

  .sbd-filter-grid,
  .sbd-filter-grid--two {
    grid-template-columns: minmax(0, 1fr);
  }

  .sbd-filter-bar {
    flex-wrap: wrap;
  }

  .sbd-json,
  .sbd-editor-panel .sbd-grid {
    height: 20rem;
  }
}

/* ===========================================================================
   PCS DETAIL — technology setup sheet
   ===========================================================================
   The detail reuses the worksheet tokens from `.newp-page` (the root carries
   both classes). It adds a model strip, a parameter ledger and a quiet context
   rail. No new colours, elevation or decorative gradients. */

.pcs-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pcs-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--newp-rule);
}

.pcs-header__titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pcs-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

.pcs-subtitle {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--newp-ink-2);
}

.pcs-status {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--newp-ink-3);
  white-space: nowrap;
}

/* Recompute messages sit under the action row and may be longer than it. */
.pcs-status--wrap {
  white-space: normal;
  line-height: 1.45;
}

.pcs-status--header {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-surface);
}

.pcs-status--dirty {
  color: var(--newp-warn);
  border-color: var(--newp-warn-rule);
  background: var(--newp-warn-soft);
}

.pcs-status--ok {
  color: var(--newp-ok);
  border-color: var(--newp-ok-rule);
  background: var(--newp-ok-soft);
}

/* The action-row status is a badge, not a bare line of text. */
.pcs-actions .pcs-status--ok {
  padding: 3px 9px;
  border: 1px solid var(--newp-ok-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-ok-soft);
}

.pcs-status--error {
  color: var(--newp-danger);
}

.pcs-state {
  width: 100%;
}

.pcs-state .newp-card {
  padding: 18px 20px;
  gap: 8px;
}

.pcs-state__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--newp-ink);
}

.pcs-state__error {
  max-width: 82ch;
  color: var(--newp-danger);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pcs-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
}

.pcs-main,
.pcs-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pcs-main > .newp-card {
  gap: 12px;
}

/* ── members: full-width section + article-grid C layout ──────────────── */

.pcs-members-section {
  grid-column: 1 / -1;
  min-width: 0;
}

.pcs-members-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
  gap: 12px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.pcs-members-tags {
  align-self: stretch;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.pcs-members-tags .tag-filter {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.pcs-members-tags .tag-filter__presets,
.pcs-members-tags .tag-filter__active {
  flex: 0 0 auto;
}

.pcs-members-tags .tag-filter__tags {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.pcs-members-tags .tag-filter__offers {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.pcs-members-work {
  min-width: 0;
}

@media (max-width: 900px) {
  .pcs-members-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .pcs-members-tags {
    height: auto;
    max-height: 240px;
  }
}

/* ── model picker: constant top bar, dynamic sheet below ──────────────── */

.pcs-model-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.pcs-model-bar__label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--newp-ink-2);
}

.pcs-model-picker {
  width: min(100%, 430px);
  flex: 0 1 430px;
}

.pcs-tech-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding-top: 14px;
  border-top: 2px solid var(--newp-rule-strong);
}

/* MinQty thresholds: part of the constant model block, separated from both
   the model picker above and the generated sheet below by the same rule. */
.pcs-minqty {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-top: 14px;
  border-top: 2px solid var(--newp-rule-strong);
}

.pcs-model__summary {
  max-width: 82ch;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--newp-ink);
}

.pcs-model__detail {
  max-width: 82ch;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--newp-ink-2);
}

.pcs-model__slot {
  font-size: 11px;
  color: var(--newp-ink-3);
}

/* ── generated parameter ledger ───────────────────────────────────────── */

.pcs-tech-form,
.pcs-tech-form__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 760px;
}

.pcs-tech__section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--newp-rule-soft);
}

.pcs-tech__section:first-child {
  padding-top: 0;
  border-top: 0;
}

.pcs-field {
  display: grid;
  grid-template-columns: 210px 180px minmax(160px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.pcs-field:last-child {
  border-bottom: 0;
}

.pcs-field__label {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.pcs-field__name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

.pcs-field__help {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--lumo-primary-color);
  cursor: help;
}

.pcs-field__help:hover {
  color: var(--lumo-primary-color-strong);
}

.pcs-field__note {
  font-size: 11px;
  color: var(--newp-ink-3);
  overflow-wrap: anywhere;
}

.pcs-field vaadin-number-field,
.pcs-field vaadin-integer-field,
.pcs-field vaadin-text-field,
.pcs-field vaadin-combo-box {
  width: 100%;
}

/* ── action rows ───────────────────────────────────────────────────────── */

.pcs-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--newp-rule);
}

/* The technology row carries four actions; wrap instead of clipping them. */
.pcs-actions--wrap {
  flex-wrap: wrap;
  row-gap: 8px;
}

.pcs-actions .pcs-status {
  margin-right: auto;
}

/* The worksheet's one strong action: the same deep steel used by newp. */
.pcs-page vaadin-button[theme~="primary"] {
  --vaadin-button-background: var(--newp-accent);
  --vaadin-button-text-color: var(--newp-surface);
  --vaadin-button-border-color: var(--newp-accent);
  --vaadin-button-font-weight: 600;
}

.pcs-page vaadin-button[theme~="primary"]:hover {
  --vaadin-button-background: var(--newp-accent-ink);
  --vaadin-button-border-color: var(--newp-accent-ink);
}

/* ── identity / reach / notes rail ─────────────────────────────────────── */

.pcs-kv__row,
.article-kv__row {
  display: grid;
  grid-template-columns: minmax(96px, 130px) minmax(0, 1fr);
  gap: 8px 10px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.pcs-kv__row:last-child,
.article-kv__row:last-child {
  border-bottom: 0;
}

.pcs-kv__label,
.article-kv__label {
  font-size: 11.5px;
  color: var(--newp-ink-3);
}

.pcs-kv__value,
.article-kv__value {
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

.pcs-kv__value--wrap,
.article-kv__value--wrap {
  font-weight: 400;
  line-height: 1.5;
  color: var(--newp-ink-2);
}

.pcs-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

/* Reach: one channel at a time (articles / product lines), local search and
   a compact pager. The card stays in the rail; the rows carry the grouping,
   not a second set of nested cards. */
.pcs-reach-tabs {
  width: 100%;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.pcs-reach-tabs vaadin-tab {
  flex: 1 1 0;
  justify-content: center;
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--newp-ink-3);
}

.pcs-reach-tabs vaadin-tab[selected] {
  color: var(--newp-accent-ink);
}

.pcs-reach-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.pcs-reach-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.pcs-reach-row:last-child {
  border-bottom: 0;
}

.pcs-reach-row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pcs-reach-row__label {
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

.pcs-reach-row__meta {
  font-size: 11.5px;
  color: var(--newp-ink-3);
  overflow-wrap: anywhere;
}

.pcs-reach-margin {
  flex: 0 0 auto;
  padding: 1px 7px;
  border: 1px solid var(--newp-accent-border);
  border-radius: 999px;
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
  font-family: var(--newp-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.pcs-reach-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 1px;
}

.pcs-reach-desc {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--newp-ink-2);
  overflow-wrap: anywhere;
}

.pcs-reach-link {
  font-size: 12.5px;
}

.pcs-reach-empty {
  padding: 8px 0;
  font-size: 12px;
  color: var(--newp-ink-3);
}

.pcs-reach-pager {
  align-items: center;
  gap: 2px;
  padding-top: 4px;
  border-top: 1px solid var(--newp-rule-soft);
}

.pcs-reach-pager__text {
  margin-right: auto;
  font-family: var(--newp-mono);
  font-size: 11px;
  color: var(--newp-ink-3);
  font-variant-numeric: tabular-nums;
}

.pcs-reach-pager__button {
  width: 26px;
  min-width: 26px;
  height: 26px;
}

.pcs-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.pcs-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--newp-rule);
  border-radius: 999px;
  background: var(--newp-surface-muted);
  color: var(--newp-ink-2);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.pcs-tag--fm {
  border-color: var(--newp-accent-border);
  background: var(--newp-accent-soft);
  color: var(--newp-accent-ink);
}

.pcs-link,
.article-link {
  width: fit-content;
  max-width: 100%;
  color: var(--newp-accent-ink);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  overflow-wrap: anywhere;
}

.pcs-link:hover,
.article-link:hover {
  border-bottom-color: var(--newp-accent);
}

.pcs-list__item {
  font-size: 11.5px;
  color: var(--newp-ink-2);
  overflow-wrap: anywhere;
}

.pcs-empty,
.article-empty {
  font-size: 12px;
  color: var(--newp-ink-3);
}

/* ── responsive ────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .pcs-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .pcs-rail {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .pcs-header {
    flex-wrap: wrap;
  }

  .pcs-status--header {
    margin-left: 0;
  }

  .pcs-field {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    align-items: start;
  }

  .pcs-field__note {
    text-align: left;
  }
}

/* ===========================================================================
   ARTICLE DETAIL — one catalogue record
   ===========================================================================
   One route serves raw materials, intermediate products and final products.
   The skeleton is identical for all three; the graph position only moves the
   accent (`--article-kind`, set per `.article-page--*`) on the header rule and
   the badge. Tokens come from `.newp-page`, so no new palette is introduced. */

.article-page {
  --article-kind: var(--article-kind-other);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.article-page--raw { --article-kind: var(--article-kind-raw); }
.article-page--intermediate { --article-kind: var(--article-kind-intermediate); }
.article-page--final { --article-kind: var(--article-kind-final); }
.article-page--tool { --article-kind: var(--article-kind-tool); }
.article-page--other { --article-kind: var(--article-kind-other); }

/* The article page reads as a record, not a terminal: use the app face even
   for values and the shared pricing classes, without changing the wizard. */
.article-page .newp-law,
.article-page .newp-kv__value,
.article-page .newp-line__value,
.article-page .newp-anatomy__value {
  font-family: inherit;
}

/* ── Masthead ─────────────────────────────────────────────────────────── */

.article-header {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  padding: 12px 0;
  border-bottom: 1px solid var(--newp-rule);
}

.article-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.article-header__spacer {
  flex: 1 1 auto;
}

.article-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--newp-navy);
  overflow-wrap: anywhere;
}

.article-subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: var(--newp-ink-2);
  overflow-wrap: anywhere;
}

.article-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--article-kind);
  border-radius: var(--newp-radius);
  background: var(--newp-surface);
  color: var(--article-kind);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.article-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.article-chip {
  padding: 2px 9px;
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-surface);
  color: var(--newp-ink-3);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.article-chip--priced {
  color: var(--newp-ok);
  border-color: var(--newp-ok-rule);
  background: var(--newp-ok-soft);
}

.article-chip--unpriced {
  color: var(--newp-ink-3);
  background: var(--newp-surface-muted);
}

/* ── Content column ───────────────────────────────────────────────────── */

.article-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

/* ── Fact strip: one compact row, not seven floating metric cards ─────── */

.article-facts-card {
  padding: 12px 16px;
}

.article-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px 18px;
  width: 100%;
}

.article-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.article-fact__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--newp-ink-3);
}

.article-fact__value {
  min-width: 0;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--newp-ink);
  overflow-wrap: anywhere;
}

/* ── Body: main record | reference rail ───────────────────────────────── */

.article-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
}

.article-main,
.article-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Backend cross-section drawing (article-detail `sizeSvg`).
   The SVG paints with `currentColor`; the card is hard-coded white, so the
   ink must be explicit or the drawing disappears in a dark page palette.
   Inside the Shape card it sits on the right of the axis legend. */
.article-shape-svg {
  flex: 0 0 220px;
  min-width: 160px;
  padding: 4px 0 2px;
  color: var(--newp-ink);
}

.article-shape-svg svg {
  display: block;
  width: 100%;
  height: auto;
}

.article-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* ── Links and tags ───────────────────────────────────────────────────── */

.article-link-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid var(--newp-rule-soft);
}

.article-link-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.article-link-group__label {
  font-size: 11.5px;
  color: var(--newp-ink-3);
}

.article-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  width: 100%;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

/* Compact tag trigger in the article grid: one line, no button chrome. */
.article-tags-button {
  --vaadin-button-background: transparent;
  --vaadin-button-text-color: var(--newp-accent);
  min-height: 0;
  padding: 0;
  font-size: 11.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.article-tags-button:hover {
  --vaadin-button-text-color: var(--newp-accent-ink);
  text-decoration: underline;
}

/* Category names are long ("Thermal: part cut from a sheet"); the cell keeps a
   fixed width and clips, identically on every article list. Full text on hover. */
.article-cat-cell {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--newp-rule);
  border-radius: var(--newp-radius);
  background: var(--newp-surface-muted);
  color: var(--newp-ink-2);
  font-size: 10.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ── Pricing card (summarization-stage price law) ─────────────────────── */

.article-price {
  gap: 10px;
}

.article-price .newp-kv {
  padding: 2px 0;
  border-bottom: 1px solid var(--newp-rule-soft);
}

.article-price .newp-kv:last-of-type {
  border-bottom: 0;
}

.article-price .newp-line {
  grid-template-columns: 140px minmax(72px, max-content);
}

/* ── State card (loading / not found / no selection / error) ──────────── */

.article-state {
  gap: 8px;
  padding: 18px 20px;
}

.article-state__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--newp-ink);
}

.article-state__message {
  max-width: 82ch;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--newp-ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.article-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.article-state__loading {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .article-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .article-facts {
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  }

  .article-header__row {
    align-items: flex-start;
  }

  .article-header__spacer {
    display: none;
  }
}

/* ===========================================================================
   PICKING STAGE — columns layout
   ===========================================================================
   The stage is a full-height workspace: the tags own a left column and the
   material grid owns the leftover height. The page itself never scrolls.
   =========================================================================== */

.picking-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.picking-stage__host {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

.picking-tag-host,
.picking-filter-host,
.picking-materials-grid-host {
  min-height: 0;
}

/* ── Structured tag panel: presets and tags as separate blocks ── */
.tag-filter__presets,
.tag-filter__tags,
.tag-filter__offers {
  min-width: 0;
}

.tag-filter__active {
  min-height: 24px;
}

.tag-group {
  min-width: 0;
}

.tag-group__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--newp-ink-3);
}

.tag-group__chips {
  gap: 6px;
  flex-wrap: wrap;
}

/* Column mode: the offers are the only scrolling part. */
.picking-tags--column .tag-filter {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.picking-tags--column .tag-filter__presets {
  flex: 0 0 auto;
}

.picking-tags--column .tag-filter__tags {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.picking-tags--column .tag-filter__offers {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.newp-body--rail-quarter .newp-rail {
  flex: 0 0 25%;
  max-width: 380px;
  align-self: stretch;
  max-height: 100%;
}

.newp-body--rail-quarter .newp-context {
  width: 100%;
  height: 100%;
  align-items: stretch;
}

.newp-body--rail-quarter .newp-context__body {
  width: 100%;
  flex: 1 1 auto;
  max-height: 100%;
  overflow-y: auto;
}

/* ===========================================================================
   DASHBOARD — catalogue ledger
   ===========================================================================
   The front page of the picked catalogue: identity, scale, pricing readiness,
   composition, the commercial settings, and (for admins) the two
   catalogue-wide maintenance runs.

   One bold element: the navy readiness band. Everything around it is paper,
   white surfaces, hairline rules and mono numbers. No shadows, no gradients,
   no entrance animation. The shell's --laird-* tokens are inherited; only the
   semantic warning/danger pair is added here.
   =========================================================================== */
.dash-page {
  --dash-warn: #8a5a12;
  --dash-warn-soft: #fdf6e7;
  --dash-warn-rule: #e6d3a8;
  --dash-danger: #a12622;
  --dash-danger-soft: #fdf3f2;
  --dash-danger-rule: #ecc9c6;
  --dash-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  box-sizing: border-box;
}

.dash-sheet {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  padding-bottom: 30px;
}

/* ── Masthead: the title block ── */
.dash-masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--laird-rule);
  flex-wrap: wrap;
}

.dash-masthead__titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dash-title {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--laird-navy);
}

.dash-subline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.dash-sub {
  font-size: 12.5px;
  color: var(--laird-muted);
}

.dash-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--laird-rule-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--laird-ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.dash-masthead__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.dash-stamp {
  font-family: var(--dash-mono);
  font-size: 11px;
  color: var(--laird-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Vitals strip: one surface, rules instead of four cards ── */
.dash-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #ffffff;
  border: 1px solid var(--laird-rule);
  border-radius: 4px;
}

.dash-fact {
  padding: 12px 16px 13px;
  border-left: 1px solid var(--laird-rule-soft);
  min-width: 0;
}

.dash-fact:first-child {
  border-left: 0;
}

.dash-fact__value {
  display: block;
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--laird-navy);
}

.dash-fact__label {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--laird-muted);
}

/* ── Pricing readiness: the one dark band ── */
.dash-readiness {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 26px;
  padding: 18px 20px 19px;
  background: var(--laird-navy);
  border: 1px solid #071829;
  border-radius: 4px;
  color: #ffffff;
}

.dash-readiness__main {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.dash-readiness__headline {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: #ffffff;
}

.dash-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.dash-progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--laird-azure);
}

.dash-progress__meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-readiness__pct {
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.dash-readiness__sub {
  font-size: 11.5px;
  color: #c9d8e5;
}

.dash-attention {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dash-attention__label {
  font-size: 11.5px;
  font-weight: 600;
  color: #a9bdd1;
}

.dash-attention__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dash-attention__num {
  min-width: 34px;
  text-align: right;
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  color: #f2c879;
}

.dash-attention__text {
  font-size: 11.5px;
  line-height: 1.4;
  color: #dce7f1;
}

.dash-attention__none {
  font-size: 11.5px;
  color: #a9bdd1;
}

/* ── Section captions ── */
.dash-section {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 18px;
  flex-wrap: wrap;
}

.dash-section__title {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--laird-navy);
  white-space: nowrap;
}

.dash-section__hint {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11.5px;
  color: var(--laird-muted);
  white-space: nowrap;
}

.dash-section__rule {
  flex: 1 1 auto;
  min-width: 20px;
  height: 1px;
  background: var(--laird-rule-soft);
}

.dash-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Panels: one ledger surface, internal hairlines ── */
.dash-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px 15px;
  background: #ffffff;
  border: 1px solid var(--laird-rule);
  border-radius: 4px;
}

.dash-list-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dash-list-block + .dash-list-block {
  margin-top: 2px;
  padding-top: 14px;
  border-top: 1px solid var(--laird-rule-soft);
}

.dash-subhead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-subhead__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--laird-ink);
}

.dash-subhead__hint {
  font-size: 11px;
  color: var(--laird-muted);
}

/* The pricing-input captions carry more weight than a supporting subhead,
   but stay sentence case and below the panel caption in hierarchy. */
.dash-subhead--strong .dash-subhead__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--laird-navy);
}

/* ── Pricing-input columns ── */
.dash-pair {
  display: grid;
  gap: 26px;
  align-items: start;
}

.dash-pair--inputs {
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
}

.dash-pair__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Vertical divider between margins and exchange rates. The second column
   stretches to the taller one so the rule runs the full panel height. */
.dash-pair--inputs > .dash-pair__col + .dash-pair__col {
  align-self: stretch;
  border-left: 1px solid var(--laird-rule);
  padding-left: 26px;
}

/* A quiet outlined action: visible without competing with the page's
   primary buttons. */
.dash-edit-button {
  --vaadin-button-background: var(--laird-drawer);
  --vaadin-button-text-color: var(--laird-steel);
  --vaadin-button-border-color: var(--laird-steel);
  --vaadin-button-border-width: 1px;
  --vaadin-button-gap: 6px;
  --vaadin-button-font-weight: 600;
  --vaadin-button-shadow: none;
}

/* ── Ranked bars ── */
.dash-bars {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.dash-bar {
  display: grid;
  grid-template-columns: minmax(140px, 50%) minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  min-width: 0;
}

.dash-bar__label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-width: 0;
  overflow: hidden;
  white-space: normal;
  line-height: 1.35;
  font-size: 12px;
  color: var(--laird-ink);
}

.dash-bar__track {
  display: block;
  height: 7px;
  min-width: 0;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.dash-bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--laird-steel);
}

.dash-bar__count {
  text-align: right;
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: var(--laird-ink);
}

.dash-bar--warn .dash-bar__label {
  color: var(--dash-warn);
}

.dash-bar--warn .dash-bar__fill {
  background: var(--dash-warn);
}

/* ── Margin ladder: fixed 0–100 scale, 50% tick ── */
.dash-margins {
  display: flex;
  flex-direction: column;
  max-height: 372px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 4px;
  margin-right: -4px;
}

.dash-margin {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) minmax(96px, 170px) 44px;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  padding: 1px 0;
}

.dash-margin__code {
  font-family: var(--dash-mono);
  font-size: 11px;
  color: var(--laird-muted);
  white-space: nowrap;
}

.dash-margin__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--laird-ink);
}

.dash-margin__track {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.dash-margin__track::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--laird-rule);
}

.dash-margin__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--laird-steel);
}

.dash-margin__value {
  text-align: right;
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--laird-ink);
}

/* ── Exchange rates ── */
.dash-fx {
  display: flex;
  flex-direction: column;
}

.dash-fx__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--laird-rule-soft);
}

.dash-fx__row:last-child {
  border-bottom: 0;
}

.dash-fx__pair {
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--laird-ink);
}

/* ── Maintenance ── */
.dash-maintenance {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--laird-rule-strong);
}

.dash-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--laird-rule-soft);
}

.dash-action:last-of-type {
  border-bottom: 0;
}

.dash-action__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dash-action__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--laird-ink);
}

.dash-action__hint {
  max-width: 78ch;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--laird-muted);
}

.dash-action vaadin-button {
  flex: 0 0 auto;
}

/* ── Receipt of a maintenance run ── */
.dash-receipt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  border: 1px solid var(--laird-rule);
  border-radius: 4px;
  background: #fbfdff;
}

.dash-receipt__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.dash-receipt__title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--laird-navy);
}

.dash-receipt__stamp {
  font-family: var(--dash-mono);
  font-size: 11px;
  color: var(--laird-muted);
}

.dash-receipt__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 16px;
}

.dash-receipt__stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.dash-receipt__value {
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--laird-ink);
}

.dash-receipt__label {
  font-size: 11px;
  color: var(--laird-muted);
}

.dash-receipt__stat--warn .dash-receipt__value {
  color: var(--dash-warn);
}

/* ── Per-technology report ── */
.dash-report {
  display: flex;
  flex-direction: column;
  min-width: 680px;
}

.dash-report__row {
  display: grid;
  grid-template-columns:
    minmax(90px, 1fr) minmax(90px, 0.9fr) 56px 56px 50px 58px minmax(160px, 2fr);
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--laird-rule-soft);
  font-size: 11.5px;
}

.dash-report__row:last-child {
  border-bottom: 0;
}

.dash-report__row--head {
  border-bottom: 1px solid var(--laird-rule);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--laird-muted);
}

.dash-report__mono {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--dash-mono);
  font-size: 11px;
  color: var(--laird-ink);
}

.dash-report__num {
  text-align: right;
  font-family: var(--dash-mono);
  font-variant-numeric: tabular-nums;
  color: var(--laird-ink);
}

.dash-report__num--warn {
  color: var(--dash-warn);
}

.dash-report__problem {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--laird-muted);
}

/* The narrow panel owns a horizontally scrollable table. */
.dash-receipt vaadin-details {
  min-width: 0;
}

.dash-receipt vaadin-details > div {
  overflow-x: auto;
}

/* ── Empty / loading / error ── */
.dash-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px 20px;
  border: 1px solid var(--laird-rule);
  border-radius: 4px;
  background: #ffffff;
}

.dash-empty__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--laird-navy);
}

.dash-empty__text {
  max-width: 78ch;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--laird-muted);
}

.dash-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border: 1px solid var(--dash-danger-rule);
  border-left: 3px solid var(--dash-danger);
  border-radius: 4px;
  background: var(--dash-danger-soft);
  color: var(--dash-danger);
}

.dash-error__text {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.45;
}

.dash-state {
  padding: 20px 2px;
  font-size: 12.5px;
  color: var(--laird-muted);
}

.dash-note {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--laird-muted);
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .dash-readiness {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .dash-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .dash-pair--inputs > .dash-pair__col + .dash-pair__col {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--laird-rule);
    padding-top: 18px;
  }
}

@media (max-width: 720px) {
  .dash-sheet {
    gap: 18px;
  }

  .dash-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-fact:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--laird-rule-soft);
  }

  .dash-fact:nth-child(4) {
    border-top: 1px solid var(--laird-rule-soft);
  }

  .dash-masthead {
    align-items: flex-start;
  }

  .dash-masthead__aside {
    align-items: flex-start;
  }

  .dash-bar {
    grid-template-columns: minmax(90px, 40%) minmax(0, 1fr) 40px;
    gap: 8px;
  }

  .dash-margin {
    grid-template-columns: 48px minmax(0, 1fr) minmax(60px, 90px) 40px;
    gap: 8px;
  }

  .dash-action {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

/* ===========================================================================
   PICKING STAGE — columns layout engine
   ---------------------------------------------------------------------------
   The stage host always contains the same direct children:

     .picking-tag-card        tag panel (left column)
     .picking-control-rail    selection card + filter card
     .picking-work            materials card (header + grid)

   The layout is fixed; nothing is rebuilt or re-parented.
   =========================================================================== */

.picking-stage__host > .picking-tag-card,
.picking-stage__host > .picking-control-rail,
.picking-stage__host > .picking-work {
  min-width: 0;
  min-height: 0;
  /* The DSL writes `align-items: flex-start` inline on the host; align-self
     keeps grid items filling their track without fighting that value. */
  align-self: stretch;
}

.picking-control-rail,
.picking-work {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.picking-materials-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.picking-materials-card .newp-grid-host--fill {
  min-height: 0;
}

/* ── COLUMNS: tags 17% · work rest ── */
.picking-layout--columns {
  display: grid;
  grid-template-columns: var(--tag-panel-width) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "tags rail"
    "tags work";
  gap: 10px;
  overflow: hidden;
}

.picking-layout--columns > .picking-tag-card {
  grid-area: tags;
  overflow: hidden;
}

.picking-layout--columns > .picking-control-rail {
  grid-area: rail;
  overflow: hidden;
}

.picking-layout--columns > .picking-work {
  grid-area: work;
  overflow: hidden;
}

.picking-layout--columns .picking-tag-host {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ── Compact masthead for the working stages ──
   The step run already says where the user is; the 21px title and its
   description only repeated the stage name and cost vertical grid space. */
.newp-header--compact {
  gap: 0;
  padding: 6px 0 8px;
}

.newp-header--compact .newp-header__titles {
  display: none;
}

/* ── Product-info rail: quarter column ── */
.newp-body--rail-quarter .newp-rail {
  flex: 0 0 25%;
  max-width: none;
}

.newp-body--rail-collapsed .newp-rail {
  flex: 0 0 auto;
}

.newp-body--rail-collapsed .newp-context {
  width: auto;
}

@media (max-width: 1100px) {
  .newp-body--rail-quarter .newp-rail {
    flex-basis: 300px;
  }
}

@media (max-width: 900px) {
  .picking-layout--columns {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(180px, 38vh) auto minmax(0, 1fr);
    grid-template-areas:
      "tags"
      "rail"
      "work";
  }

  .newp-body--rail-quarter .newp-rail {
    flex-basis: 100%;
    max-width: none;
  }
}

/* ===========================================================================
   ARTICLE OVERVIEWS — columns layout
   ---------------------------------------------------------------------------
   The tag panel owns the left column (about a fifth); the work column takes
   the rest. The filters keep their place above the grid; no third column is
   created because these pages have no product-info context.
   =========================================================================== */

.article-overview--columns {
  display: grid;
  grid-template-columns: var(--tag-panel-width) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "title   title"
    "tags    filters"
    "tags    grid"
    "tags    status";
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.article-overview--columns > .article-overview__title {
  grid-area: title;
  align-self: start;
  min-width: 0;
}

.article-overview--columns > .article-overview__title h1 {
  font-size: 1.4rem;
  line-height: 1.2;
}

/* Page-level Actions dropdown + the generated CSV download. */
.article-overview__title .article-actions,
.article-overview__title .article-actions__download {
  flex: 0 0 auto;
  align-self: center;
}

.article-overview__title .article-actions__download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--lumo-border-radius-m);
  background: var(--lumo-contrast-5pct);
  color: var(--lumo-body-text-color, #111);
  font-size: var(--lumo-font-size-s);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.article-overview__title .article-actions__download:hover {
  background: var(--lumo-contrast-10pct);
  color: var(--lumo-body-text-color, #111);
}

.article-overview--columns > .article-overview__tags {
  grid-area: tags;
  align-self: stretch;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* The tag card owns the column height; only the offers scroll. */
.article-overview--columns > .article-overview__tags .tag-filter {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

.article-overview--columns > .article-overview__tags .tag-filter__presets,
.article-overview--columns > .article-overview__tags .tag-filter__active {
  flex: 0 0 auto;
}

.article-overview--columns > .article-overview__tags .tag-filter__tags {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.article-overview--columns > .article-overview__tags .tag-filter__offers {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.article-overview--columns > .article-overview__filters {
  grid-area: filters;
  align-self: start;
  min-width: 0;
  min-height: 0;
}

.article-overview--columns > .article-overview__grid {
  grid-area: grid;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.article-overview--columns > .article-overview__status {
  grid-area: status;
  align-self: start;
  min-width: 0;
}

@media (max-width: 900px) {
  .article-overview--columns {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(160px, 24vh) auto minmax(320px, 1fr) auto;
    grid-template-areas:
      "title"
      "tags"
      "filters"
      "grid"
      "status";
    overflow-y: auto;
  }

  .article-overview--columns > .article-overview__tags {
    height: auto;
    max-height: 240px;
  }

  .article-overview--columns > .article-overview__grid {
    height: auto;
    min-height: 320px;
  }
}
