/* proc-letterpress.css — the procurement2 LETTERPRESS chrome.
   Black window title bars and black table header rows for all screens.
   The category/screen tab strips (row 1 / row 2 of ProcDesktop.tsx) are
   structural only here -- their colour is Red Plate's tab language, bound
   in red-plate.css section 7b, not this file's black skin (Ben, 2026-08-31:
   "align w/ other pages").
*/

.plp {
  --plp-paper: var(--rp-white);
  --plp-paper-2: var(--rp-silver-2);
  --plp-paper-3: var(--rp-silver);
  --plp-hairline: var(--rp-line);
  --plp-hairline-dark: var(--rp-border-strong);
  --plp-ink: var(--rp-ink);
  --plp-ink-mute: var(--rp-ink-mute);
  --plp-acc: var(--rp-black);
  /* section accents — one hue per functional area, printed flat */
  --plp-purchasing: var(--rp-red);  /* was a duplicate literal, byte-identical to --rp-red */
  --plp-demand: #8f6a00;
  --plp-sourcing: #1f4e79;
  --plp-suppliers: #3f6b2a;
  --plp-agreements: #5e4b8b;
  --plp-reference: #2f6f6a;
}

/* ------------------------------------------------------------------ */
/* app ground + type: paper and ink, UI face from the portal tokens    */
.plp .gsp-app {
  font-family: var(--font-ui, "PP Neue Machina", "Segoe UI", sans-serif);
  font-size: 12px;
  color: var(--plp-ink);
  background: var(--plp-paper);
}
.plp .gsp-window { border: 1px solid var(--plp-hairline-dark); background: var(--plp-paper); }
/* Ben, 2026-08-30 hand-annotation ("turn these into tabs" / "abandon the
   always floating windows"): a screen no longer floats at all -- it is a
   `.gsp-tabpane` (gsp-structural.css owns its position/display, scoped by
   `data-eid="proc-desktop"` there), filling the work area through CSS
   alone, current one only. This replaces the 2026-08-24 rules-3-and-9
   regime (windows absolutely positioned via --win-x/y/w/h custom
   properties, kept off the menubar/taskbar by the work area's own bounds)
   for SCREENS specifically -- a record/detail popup would still use that
   `.gsp-app--floating` geometry if procurement2 ever declares one through
   the shared WindowManager, but today its own popups (suppliers-local/
   _popup.tsx, demand-consolidation-group/popup.tsx) are plain gsp-dialog
   modals outside it, unaffected by any of this either way. */
.plp .proc-matrix-area .gsp-tabpane > .gsp-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
/* the screen's own body is the only scroller inside a tab */
.plp .proc-matrix-area .gsp-tabpane .gsp-pane-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Root desktop layout: full space background */
.plp.proc-desktop-root,
.plp .proc-desktop-root {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.plp .proc-bg-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  border: 1px solid var(--ds-c-neutral-18);
  background: var(--plp-paper);
}

/* ------------------------------------------------------------------ */
/* MANDATORY: Black Title Bars / Header Bars for ALL Windows          */
/* .proc-titlebar-black itself is gone with the app-level "Procurement
   Desk" titlebar it styled (Ben, 2026-08-30: folded into the menubar's own
   exit control, see ProcDesktop.tsx) -- a record popup's own gsp-titlebar
   (suppliers-local/_popup.tsx etc.) still needs this rule, hence the other
   three selectors stay. */
.plp .gsp-titlebar,
.plp .gsp-window > .gsp-titlebar,
.plp [data-window-id] .gsp-titlebar {
  background: var(--rp-black) !important;
  color: var(--rp-white) !important;
  font-family: var(--font-display, Fraunces, Georgia, serif);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  padding: 4px 8px;
  border-bottom: 1px solid var(--rp-ink);
}

.plp .gsp-titlebar-icon {
  background: var(--rp-ink);
  border: 0;
  color: var(--rp-white);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}

/* ------------------------------------------------------------------ */
/* Category tabs (row 1) and screen sub-tabs (row 2). Ben, 2026-08-31:
   "show as tab, with content connected to tab" / "align w/ other pages" --
   the category DROPDOWN launcher and the old "open screens" strip (row 2
   used to list only what had already been launched) are both gone; both
   rows are real tab strips now (ProcDesktop.tsx). Their COLOUR (silver bar,
   white-plate-red-top-edge active tab, matching Order Management's own
   module tabs) lives in red-plate.css section 7b, which loads after this
   sheet and wins -- this file only owns the two bars' structural z-index,
   the same "nav stays above window content" reasoning the old dropdown
   menubar carried. */
.plp .proc-cat-tabs,
.plp .proc-screen-tabs {
  position: relative;
  z-index: 9000;
  flex: none;
  /* A category can hold up to 8 screens (sourcing/RFP) -- the row scrolls
     rather than wrapping onto a second line, keeping the strip one row
     tall the same way the old dropdown menubar always was. */
  overflow-x: auto;
  flex-wrap: nowrap;
}

/* ------------------------------------------------------------------ */
/* Matrix work area -- every opened screen lives here as a `.gsp-tabpane`,
   only the current one visible (gsp-structural.css owns the display rule,
   scoped by data-eid="proc-desktop"). */
.plp .gsp-matrix.proc-matrix-area {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  min-height: 0;
  /* isolation:isolate keeps this its own stacking context, so a record
     popup declared through the shared WindowManager (none exist today,
     see ProcDesktop.tsx's own taskbar comment) could never out-stack the
     menubar above it. */
  isolation: isolate;
  z-index: 0;
  background: var(--plp-paper);
}

/* ------------------------------------------------------------------ */
/* Taskbar along bottom -- record popups only (Ben, 2026-08-30: a screen is
   a tab now, shown in the tab strip above, not listed here too). Chip
   styling for a screen's own taskbar entry is gone with the chips
   themselves; a future kind:"record" window declared through the shared
   WindowManager would need its own chip rule added here, not resurrect
   this one -- procurement2's current popups are plain gsp-dialog modals,
   entirely outside this taskbar. */
.plp .gsp-taskbar.proc-taskbar {
  position: relative;
  z-index: 9000;
  flex: none;
  background: var(--plp-paper-2);
  border-top: 1px solid var(--plp-hairline-dark);
  font-family: var(--font-ui, sans-serif);
  font-size: 11.5px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
}

.plp .proc-taskbar-settings {
  font: inherit;
  color: var(--plp-ink);
  background: var(--plp-paper);
  border: 1px solid var(--plp-hairline-dark);
  border-radius: var(--ds-radius-sm);
  padding: 2px 10px;
  cursor: pointer;
  flex: none;
}
.plp .proc-taskbar-settings:hover { background: var(--plp-paper-3); }

/* ------------------------------------------------------------------ */
/* Table heads: Red Plate silver + mono (2026-09-01 harmonization, Ben:
   "harmonize the design throughout" — supersedes the pre-freeze black-head
   mandate that dated from the letterpress skin). */
.plp .gsp-grid thead th,
.plp .gsp-table thead th,
.plp .olp-table thead th,
.plp .proc-table thead th,
.plp table thead th,
.plp thead th.proc-header-th,
.plp .proc-header-row th {
  background: var(--rp-silver) !important;
  color: var(--rp-ink) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--rp-line-2) !important;
  border-right: 1px solid var(--rp-line) !important;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 8px;
}

.plp .olp-sort-mark {
  color: var(--rp-ink-mute) !important;
  margin-left: 4px;
}

.plp .olp-col-resize {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 5px;
  background: transparent;
  border: none;
  cursor: col-resize;
  z-index: 10;
}
.plp .olp-col-resize:hover,
.plp .olp-col-resize[data-active="true"] {
  background: var(--rp-white);
}

/* ------------------------------------------------------------------ */
/* Ben, 2026-08-24 rule 6: the filter lives IN the column head and is not
   visible until clicked, like MS Excel. The permanent filter row is gone.  */
.plp .proc-table thead th {
  position: relative;
  overflow: visible;
  white-space: nowrap;
  padding-right: 26px;
}

.plp .proc-filter-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  padding: 0;
  line-height: 1;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-sm);
  cursor: pointer;
  z-index: 5;
}
.plp .proc-filter-toggle:hover,
.plp .proc-filter-toggle[data-open="true"] {
  color: var(--rp-white);
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
}
/* a column that is actually filtering says so without being opened */
.plp .proc-filter-toggle[data-on="true"] {
  color: var(--rp-black);
  background: var(--rp-white);
  border-color: var(--rp-white);
}
.plp .proc-table thead th[data-filtered="true"] { box-shadow: inset 0 -2px 0 var(--rp-white); }

.plp .proc-filter-popover {
  position: fixed;
  left: var(--pf-x, 0px);
  top: var(--pf-y, 0px);
  z-index: 9500;
  width: 230px;
  background: var(--plp-paper);
  border: 1px solid var(--plp-ink);
  box-shadow: 0 6px 20px rgba(14, 14, 12, 0.32);
  font-size: 11.5px;
}
.plp .proc-filter-popover-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 8px;
  background: var(--rp-black);
  color: var(--rp-white);
}
.plp .proc-filter-popover-title {
  flex: 1 1 auto;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plp .proc-filter-popover-close {
  flex: none;
  width: 16px;
  height: 16px;
  padding: 0;
  line-height: 1;
  color: var(--rp-white);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0;
  cursor: pointer;
}
.plp .proc-filter-popover-close:hover { background: var(--plp-purchasing); border-color: var(--plp-purchasing); }

.plp .proc-filter-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}
.plp .proc-filter-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.plp .proc-filter-field .gsp-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--plp-ink-mute);
}
.plp .proc-filter-field .gsp-input,
.plp .proc-filter-field .gsp-select {
  width: 100%;
  box-sizing: border-box;
  font-size: 11.5px;
  padding: 3px 5px;
  border: 1px solid var(--plp-hairline-dark);
  background: var(--rp-white);
  color: var(--plp-ink);
}
.plp .proc-filter-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 8px 8px;
}

/* ------------------------------------------------------------------ */
/* Datagrid container. Ben, 2026-08-24 rule 6 (second half): "reduce dead
   space from the main header to the start of content of the window" -- the
   strip that used to sit between the toolbar and the column heads is gone
   entirely (it became the bottom bar below), and the toolbar above it is
   tightened.                                                            */
/* The grid owns the height of the pane it is in: the rows scroll, the bottom
   bar stays put. Without this the bar sat at the end of the scrolled content
   and a user with 100 rows never saw the totals or the row-limit control. */
.plp .gsp-pane-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.plp .proc-table-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.plp .proc-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
/* the head stays visible while the rows scroll under it */
.plp .proc-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Ben, 2026-08-24 rule 6 (second half): "reduce dead space from the main
   header to the start of content of the window." Two strips used to sit
   between the title bar and the first row of data -- this toolbar and a
   record-count/row-limit bar. The second one is gone (it became the bottom
   row); this one is tightened to the height of its own controls. */
.plp .gsp-toolbar {
  padding: 2px 6px;
  gap: 5px;
  min-height: 0;
  flex-wrap: nowrap;
}
.plp .gsp-toolbar .gsp-btn,
.plp .gsp-toolbar .gsp-tool {
  padding: 2px 8px;
  line-height: 1.35;
}
.plp .gsp-toolbar .gsp-input,
.plp .gsp-toolbar .gsp-input-search,
.plp .gsp-toolbar .gsp-select { padding: 2px 5px; }
/* nowrap keeps the strip one line high; the screen's descriptive label is the
   thing that gives way, so a narrow window never pushes its own action button
   off the right edge */
.plp .gsp-toolbar .gsp-toolbar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plp .gsp-toolbar .gsp-btn,
.plp .gsp-toolbar .gsp-tool,
.plp .gsp-toolbar .gsp-leadfilter,
.plp .gsp-toolbar .gsp-select { flex: none; }
.plp .gsp-pane-body { padding: 0; }
.plp .gsp-pane-body > .gsp-muted:first-child { padding: 4px 6px; margin: 0; }

/* ------------------------------------------------------------------ */
/* Ben, 2026-08-24 rule 10: the row above the column heads is merged into the
   bottom row, and it states the total number of rows.                    */
/* Lives inside the window's own status bar (portalled there by ProcTable),
   so it carries no background or border of its own -- it IS the bottom row. */
.plp .proc-table-footbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
}
.plp .gsp-statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  flex-wrap: nowrap;
  padding: 2px 8px;
  min-height: 0;
  background: var(--plp-paper-2);
  border-top: 1px solid var(--plp-hairline-dark);
}
/* the screen's own note gives way first when the window is narrow, so the
   totals and the row limit are never pushed onto a second line */
.plp .gsp-statusbar .gsp-statusbar-cell {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plp .proc-table-count {
  font-family: var(--font-mono, monospace);
  color: var(--plp-ink-mute);
  white-space: nowrap;
}

.plp .proc-table-clear-filters {
  font: inherit;
  color: var(--plp-ink);
  background: var(--plp-paper);
  border: 1px solid var(--plp-hairline-dark);
  border-radius: var(--ds-radius-sm);
  padding: 1px 6px;
  cursor: pointer;
}
.plp .proc-table-clear-filters:hover { background: var(--plp-paper-3); }

.plp .proc-limit-label {
  font-size: 11px;
  color: var(--plp-ink-mute);
}

.plp .proc-limit-select {
  flex: none;
  width: auto;
  padding: 1px 4px;
  font-size: 11px;
  border: 1px solid var(--plp-hairline-dark);
  background: var(--plp-paper);
}

/* ------------------------------------------------------------------ */
/* Ben, 2026-08-24 rule 7: "cut off column content instead of wrapping it."
   A fixed table layout is what makes a column obey its own width; without it
   the browser widens the column to fit the longest cell and nothing ever
   clips.                                                                  */
.plp .proc-table { table-layout: fixed; width: 100%; }
.plp .proc-table tbody tr:not([data-group="true"]) td {
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 8px;
}
.plp .proc-table td.olp-cell-clip {
  overflow: hidden;
  text-overflow: ellipsis;
}
.plp .proc-table td.olp-cell-open { overflow: visible; }
/* The cell itself does the clipping. An earlier attempt also made every
   direct child span display:inline-block with max-width:100%, which made the
   span claim the full column and pushed its own text out of view -- the
   order-ref column then showed nothing but an ellipsis on every row. Children
   stay inline so text-overflow measures the real text. */
/* group header rows still need their full label */
.plp .proc-table tr[data-group="true"] td { white-space: normal; overflow: visible; }

/* ------------------------------------------------------------------ */
/* Dialogs, Inputs, Buttons                                           */
.plp .gsp-dialog { background: var(--plp-paper); border: 1px solid var(--plp-ink); box-shadow: 0 4px 18px rgba(14, 14, 12, 0.3); }
.plp .gsp-input:focus,
.plp .gsp-select:focus,
.plp .gsp-textarea:focus { outline: 2px solid var(--rp-black); outline-offset: -1px; }

.plp .gsp-btn {
  background: var(--plp-paper);
  border: 1px solid var(--plp-hairline-dark);
  color: var(--plp-ink);
  font-family: inherit;
  font-size: 11.5px;
  padding: 3px 10px;
  cursor: pointer;
}
.plp .gsp-btn:hover { background: var(--plp-paper-3); }
.plp .gsp-btn[data-default="true"] {
  background: var(--rp-black);
  border-color: var(--rp-black);
  color: var(--rp-white);
}
.plp .gsp-btn[data-default="true"]:hover {
  background: var(--rp-ink);
}
