/* Procurement EA2 surfaces — Kanban board (ProcEa2Board.tsx), case renderer
   (ProcEa2Renderer.tsx) and DoA matrix workbench (DoaMatrixWorkbench.tsx).
   Every rule here is a mechanical port of a former inline `style={{...}}` (or,
   for the paper-dossier wrapper, the former ProcEa2Renderer.module.css CSS
   Module) onto a semantic `pe2-` class — same selectors, same values, no
   redesign. Where a `pe2-` class is layered on top of an existing central
   component class (bd-*, ds-*), its declarations carry `!important` only
   because the original inline style used to win the cascade unconditionally;
   `!important` here reproduces that same unconditional win regardless of
   this file's <link> position relative to components.css. Where a `pe2-`
   class is the ONLY styling on a plain wrapper div, no `!important` is used.
   No new hex colours: every colour value below is copied verbatim from the
   inline style (or the deleted module.css) it replaces, in each case reusing
   an existing var(--token, #hexFallback) pattern already established
   elsewhere in components.css/portal-core.css for the identical token. */

/* =====================================================================
   ProcEa2Renderer.tsx — paper-dossier wrapper
   Ported 1:1 from ProcEa2Renderer.module.css (deleted). The module's only
   locally-scoped class was .paperWrapper; every other rule inside it was
   already :global(...), i.e. plain global selectors nested under
   .paperWrapper. Converting to a plain stylesheet just means dropping the
   :global() wrapper syntax — the selectors and values are unchanged.
   ===================================================================== */
.pe2-paper-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.pe2-paper-wrapper .ds-paper-desk {
  width: 100%;
  max-width: 100%;
  padding: 24px 14px 64px 14px !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: center !important;
  min-height: min(100vh, 1080px);
  box-sizing: border-box;
}

.pe2-paper-wrapper .ds-paper-file {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: unset !important;
  height: auto !important;
  margin: 0 auto;
  perspective: none !important;
}

/* Sheets behind the active sheet remain fanned backdrop layers matching the active sheet height */
.pe2-paper-wrapper .ds-paper-sheet {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: var(--paper-sheet);
  border: 1px solid rgba(26, 26, 26, 0.12);
  border-radius: var(--ds-radius-sm, 2px);
  padding: calc(var(--ds-space-30, 30px) + var(--ds-space-8, 8px)) calc(var(--ds-space-30, 30px) * 4) var(--ds-space-24, 24px) var(--ds-space-20, 20px);
  box-sizing: border-box;
  overflow: visible !important;
  max-height: none !important;
  transition: transform var(--ds-motion-fast, 0.15s) ease, filter var(--ds-motion-fast, 0.15s) ease;
}

/* Active raised top sheet drives the height of the entire paper document for any form length */
.pe2-paper-wrapper .ds-paper-sheet[data-raised="true"],
.pe2-paper-wrapper .ds-paper-sheet[data-depth="0"] {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  min-height: 480px !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  background: var(--paper-sheet) !important;
  border: 1px solid rgba(26, 26, 26, 0.13) !important;
  border-radius: var(--ds-radius-sm, 2px) !important;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.04), 0 6px 24px -4px rgba(26, 26, 26, 0.10) !important;
  padding: calc(var(--ds-space-30, 30px) + var(--ds-space-8, 8px)) calc(var(--ds-space-30, 30px) * 4) var(--ds-space-24, 24px) var(--ds-space-20, 20px) !important;
  z-index: 5;
  isolation: isolate;
  display: block !important;
}

/* Slanted stacked physical paper edges peeking underneath (matching board cards & ds-paper-folder) */
.pe2-paper-wrapper .ds-paper-sheet[data-depth="0"]::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  border-radius: var(--ds-radius-sm, 2px) !important;
  background: var(--rp-silver) !important;
  border: 1px solid rgba(26, 26, 26, 0.11) !important;
  z-index: -1 !important;
  transform: translate(-4px, 6px) rotate(-0.35deg) !important;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.04), 0 4px 10px -2px rgba(26, 26, 26, 0.06) !important;
  pointer-events: none !important;
}

.pe2-paper-wrapper .ds-paper-sheet[data-depth="0"]::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  border-radius: var(--ds-radius-sm, 2px) !important;
  background: var(--ds-c-yellow-10) !important;
  border: 1px solid rgba(26, 26, 26, 0.10) !important;
  z-index: -2 !important;
  transform: translate(-8px, 12px) rotate(0.45deg) !important;
  box-shadow: -3px 5px 0 0 var(--ds-c-amber-06), -3px 5px 0 1px rgba(26, 26, 26, 0.09), 0 8px 20px -2px rgba(26, 26, 26, 0.08), 0 1px 4px rgba(26, 26, 26, 0.04) !important;
  pointer-events: none !important;
}

/* Tab rail anchored flush along the top-right of the paper sheet */
.pe2-paper-wrapper .ds-paper-tabrail {
  position: absolute;
  top: var(--ds-space-30, 30px);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--ds-space-8, 8px);
  z-index: 15;
  max-width: calc(var(--ds-space-30, 30px) * 4);
}

.pe2-paper-wrapper .ds-paper-tab {
  font-size: 11px;
  padding: var(--ds-space-6, 6px) var(--ds-space-12, 12px);
  min-height: 36px;
  letter-spacing: 0.05em;
  background: var(--paper-2);
  color: var(--ink-mute, var(--ds-c-neutral-11));
  border: 1px solid var(--ink-faint, rgba(26, 26, 26, 0.15));
  border-radius: var(--ds-radius-sm, 2px) 0 0 var(--ds-radius-sm, 2px);
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.08);
  cursor: pointer;
  transition: all var(--ds-motion-fast, 0.15s) ease;
}

.pe2-paper-wrapper .ds-paper-tab:hover {
  color: var(--ink, var(--ds-c-neutral-27));
  border-color: var(--ink-mute, var(--ds-c-neutral-11));
  background: var(--paper);
}

.pe2-paper-wrapper .ds-paper-tab--on {
  background: var(--ink, var(--ds-c-neutral-27)) !important;
  border-color: var(--ink, var(--ds-c-neutral-27)) !important;
  color: var(--paper) !important;
  font-weight: 600;
  box-shadow: -2px 2px 6px rgba(0, 0, 0, 0.15);
}

/* Floating bottom controls positioned cleanly below the sheet */
.pe2-paper-wrapper .ds-paper-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(-1 * var(--ds-space-30, 30px) * 2 + 6px);
  display: flex;
  justify-content: center;
  gap: var(--ds-space-8, 8px);
  z-index: 15;
}

.pe2-paper-wrapper .ds-paper-ctl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  font-weight: 600;
  text-transform: uppercase;
  height: 26px;
  padding: 0 var(--ds-space-12, 12px);
  background: var(--paper-2);
  color: var(--ink-soft, var(--ds-c-neutral-28));
  border: 1px solid var(--ink-faint, rgba(26, 26, 26, 0.15));
  border-radius: var(--ds-radius-sm, 2px);
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.08);
  transition: all var(--ds-motion-fast, 0.15s) ease;
  cursor: pointer;
}

.pe2-paper-wrapper .ds-paper-ctl:hover {
  background: var(--paper);
  color: var(--ink, var(--ds-c-neutral-27));
  border-color: var(--ink-mute, var(--ds-c-neutral-11));
}

/* Line-item table & box — no dead overflow gaps, cleanly bounded */
.pe2-paper-wrapper .ds-pf-linebox {
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  background: var(--paper-sheet) !important;
  border: 1px solid var(--hairline, rgba(26, 26, 26, 0.12)) !important;
}

/* =====================================================================
   ProcEa2Board.tsx
   ===================================================================== */

/* Full-bleed sizing guard, reused on .board / .bd-head / .bd-scroll / .bd-col
   so none of them can be pushed past the shell's content width. */
.pe2-board--bleed {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Board heading clips to one line instead of the base .bd-title h1's
   wrap-normal behaviour (process names run long). */
.pe2-board-title--clip {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Lets the country-picker + New-case action cluster shrink below its content
   width inside the flex header instead of forcing the header to overflow. */
.pe2-board-actions--shrink {
  min-width: 0 !important;
}

/* 4-up card grid instead of the base .bd-scroll's horizontal-scroll flex row. */
.pe2-board-scroll--grid {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px !important;
}

/* Column may shrink to 0 instead of the base .bd-col's 220px floor, so four
   columns always fit the grid track above. */
.pe2-board-col--fluid {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Column body: taller scroll well with denser padding than the base .bd-col-b. */
.pe2-board-col-body {
  max-height: calc(100vh - 215px) !important;
  min-height: 180px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 6px 16px 24px 16px !important;
  display: flex !important;
  flex-direction: column !important;
  scrollbar-width: thin !important;
  scrollbar-color: var(--hairline) transparent !important;
}

/* Compact-tier card header row: id tag + title on one line. */
.pe2-board-card-toprow {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  overflow: hidden;
}

/* Compact-tier id tag: smaller than the base .ds-paper-folder-tab (15px/8px). */
.pe2-board-tag--compact {
  height: 13px !important;
  font-size: 7.5px !important;
  margin: 0 !important;
  flex-shrink: 0;
}

/* Compact-tier card title: smaller + shrinkable, overrides base .ds-link-row-title. */
.pe2-board-title--compact {
  font-size: 12px !important;
  font-weight: 600 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1 1 auto;
  min-width: 0;
}

/* Compact-tier age / subtitle baseline row. */
.pe2-board-agerow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  margin: 1px 0;
}

/* Compact-tier "active Nm/h/d" age readout — display-italic, matches the
   spacious-tier age treatment at a smaller size. */
.pe2-board-age--compact {
  font-family: var(--font-display, Georgia, serif);
  font-style: italic;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

/* Compact-tier subtitle: clipped to 60% of the row so it never crowds the age. */
.pe2-board-subtitle--compact {
  font-size: 10px !important;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

/* Compact-tier status / stage / updated footer row, hairline-topped. */
.pe2-board-statusrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 1px;
  padding-top: 2px;
  border-top: 1px solid rgba(26, 26, 26, 0.06);
}

/* Compact-tier status badge: smaller than the base .bd-badge default (10px). */
.pe2-board-badge--compact {
  font-size: 9px !important;
  padding: 1px 5px !important;
  line-height: 1.1 !important;
  white-space: nowrap;
}

.pe2-board-stage--compact {
  color: var(--ink-mute);
  font-size: 10px;
  text-transform: capitalize;
  white-space: nowrap;
}

.pe2-board-updated--compact {
  color: var(--ink-mute);
  font-size: 10px;
  white-space: nowrap;
}

/* Spacious-tier card title (<=4 cards/column): base size, ellipsis-clipped;
   the --dense modifier drops one step for the 3-4 card density. */
.pe2-board-title--spacious {
  font-size: 13.5px !important;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  max-width: 100%;
}
.pe2-board-title--spacious.pe2-board-title--dense {
  font-size: 13px !important;
}

.pe2-board-subtitle--spacious {
  font-size: 11px !important;
  margin: 1px 0 !important;
}

/* Spacious-tier age readout; --dense modifier matches the title's density step. */
.pe2-board-age--spacious {
  font-family: var(--font-display, Georgia, serif);
  font-style: italic;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 1px 0;
}
.pe2-board-age--spacious.pe2-board-age--dense {
  font-size: 13px;
}

/* Spacious-tier review strip: tighter top gap and column gap than the base
   .ds-paper-folder .ds-review-strip (4px 16px). */
.pe2-board-review-strip--tight {
  margin-top: 2px !important;
  padding-top: 2px;
  gap: 4px 14px !important;
}

/* Review label/value at the size the board's spacious card uses, smaller
   than the base .ds-paper-folder .ds-review-label/-value defaults (8.5px/12px). */
.pe2-board-review-label--sm {
  font-size: 8px !important;
}
.pe2-board-review-value--sm {
  font-size: 11.5px !important;
}
.pe2-board-review-value--sm.pe2-board-review-value--nowrap {
  white-space: nowrap;
}

.pe2-board-badge--nowrap {
  white-space: nowrap;
}

/* =====================================================================
   ProcEa2Renderer.tsx
   ===================================================================== */

/* Toggles the gap above the line-items section / a readonly array section
   depending on whether a plain-fields block already rendered above it. */
.pe2-section--spaced {
  margin-top: 16px;
}
.pe2-section--flush {
  margin-top: 0;
}

/* Line-item table column widths (proc-ea2-lines). */
.pe2-th-idx {
  width: 36px !important;
  text-align: center !important;
}
.pe2-th-itemcode {
  min-width: 110px !important;
}
.pe2-th-desc {
  min-width: 200px !important;
}
.pe2-th-asset {
  min-width: 130px !important;
}
.pe2-th-qty {
  min-width: 75px !important;
}
.pe2-th-uom {
  min-width: 65px !important;
}
.pe2-th-brand {
  min-width: 100px !important;
}
.pe2-th-crit {
  min-width: 95px !important;
}
.pe2-th-rowaction {
  width: 32px !important;
}
/* Centers the line-no cell (td.ds-mono) and the row-remove-button cell. */
.pe2-td-center {
  text-align: center !important;
}

/* Field-control shell for the textarea/input variants of FieldControl —
   plain wrapper div, no base class to override. */
.pe2-field-shell {
  width: 100%;
}

/* Field description hint under a textarea/input — base .ds-hint has no
   display/spacing of its own. */
.pe2-hint--block {
  display: block;
  margin-top: 2px;
}

/* =====================================================================
   DoaMatrixWorkbench.tsx
   ===================================================================== */

.pe2-doa-root--bleed {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.pe2-doa-header--gap {
  margin-bottom: 12px !important;
}

.pe2-doa-err {
  margin-bottom: 12px !important;
}

.pe2-doa-filterbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 14px !important;
  width: 100% !important;
}

/* Search-box slot — plain wrapper div, no base class to override. */
.pe2-doa-search-slot {
  flex: 1 1 260px;
  min-width: 200px;
}

.pe2-doa-filter-group--wrap {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px !important;
}

.pe2-doa-table-section--flush {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.pe2-doa-table-header--tight {
  margin-bottom: 8px !important;
}

/* Rule-card list — plain wrapper div, no base class to override. */
.pe2-doa-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 6px 16px 26px 16px;
  box-sizing: border-box;
}

/* Entity value in the rule card's review strip reads bold; base .ds-review-value
   default weight is 500. */
.pe2-doa-value--strong {
  font-weight: 600 !important;
}
