/* 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;
}

/* =====================================================================
   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;
}
