/**
 * ProcureME cross-browser UI baseline (Chrome, Edge, Safari — mobile & desktop).
 * Loaded after Tailwind CDN on authenticated pages and on auth screens.
 *
 * Buttons (rounded-lg rectangle): use class pairs on <button> and <a> actions.
 *   procure-btn procure-btn-filled          — primary
 *   procure-btn procure-btn-outlined        — secondary (alias: procure-btn-secondary)
 *   procure-btn procure-btn-tonal           — tertiary / toolbar
 *   procure-btn procure-btn-text            — low-emphasis text button
 *   procure-btn procure-btn-danger          — destructive confirm
 *   procure-btn procure-btn-chip            — toggle chips (+ is-active / aria-pressed)
 *   procure-btn procure-btn-filled procure-btn-fab — square FAB (rounded-lg)
 * Modifiers: procure-btn-sm | procure-btn-xs | procure-btn-lg | procure-btn-block
 * File upload: partial resources/views/partials/file-input-field.php
 * List page header: partial resources/views/partials/page-list-header.php (title → description → actions).
 * List filters + table: .procure-list-workspace (full width of #main-content).
 */

/* Dynamic viewport height (mobile browser chrome) with static fallback. */
.min-h-screen {
    min-height: 100vh;
    min-height: 100dvh;
}

.h-screen {
    height: 100vh;
    height: 100dvh;
}

.max-h-screen {
    max-height: 100vh;
    max-height: 100dvh;
}

/* overflow-x: hidden everywhere; clip only when supported (avoids Safari/legacy parse quirks). */
html {
    overflow-x: hidden;
    /* Keep native form controls light unless the in-app dark theme is on. */
    color-scheme: light;
    /* Fluid root type: scales with viewport (rem-based Tailwind follows). */
    font-size: clamp(0.9375rem, 0.8125rem + 0.45vw, 1.0625rem);
}

#main-content {
    font-size: clamp(0.9375rem, 0.82rem + 0.4vw, 1rem);
}

.procure-line-card {
    width: 100%;
}

.procure-line-card__title {
    /* Shared PO/PR line description (procure-line-readonly-card.php) */
    font-size: clamp(0.8125rem, 0.68rem + 0.55vw, 0.9375rem);
}

.procure-line-card__aside {
    font-size: clamp(0.6875rem, 0.62rem + 0.35vw, 0.8125rem);
}

.procure-line-card .procure-line-metrics__row {
    font-size: clamp(0.8125rem, 0.72rem + 0.35vw, 0.9375rem);
}

.procure-line-card .procure-line-metric-label {
    font-size: clamp(0.625rem, 0.55rem + 0.3vw, 0.6875rem);
}

@supports (overflow: clip) {
    html,
    body,
    #main-content {
        overflow-x: clip;
    }
}

html[data-theme='dark'] {
    color-scheme: dark;
}

/* Readable fields on light UI (avoids OS dark preference painting dark inputs + dark text). */
html:not([data-theme='dark']) #main-content input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='button']):not([type='submit']):not([type='reset']):not([type='image']):not([type='file']):not([type='color']):not([type='range']),
html:not([data-theme='dark']) #main-content select,
html:not([data-theme='dark']) #main-content textarea {
    background-color: #fff;
    color: #0f172a;
}

html:not([data-theme='dark']) #main-content input:-webkit-autofill,
html:not([data-theme='dark']) #main-content input:-webkit-autofill:hover,
html:not([data-theme='dark']) #main-content input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    -webkit-text-fill-color: #0f172a;
    caret-color: #0f172a;
}

body,
#main-content {
    overflow-x: hidden;
    max-width: 100%;
}

/* Notch / home-indicator padding when viewport-fit=cover is set. */
@supports (padding: env(safe-area-inset-top)) {
    body.has-mobile-tabbar {
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    }

    .procure-mobile-header {
        padding-top: max(0.625rem, env(safe-area-inset-top, 0px));
    }

    #app-dialog-root {
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }
}

/* Safari backdrop-filter prefix (session trail, dialogs). */
.bg-white\/95 {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

[data-app-dialog-backdrop] {
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
}

/* iOS: 16px+ inputs avoid focus zoom; desktop keeps Tailwind text-sm. */
@media (max-width: 767.98px) {
    input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='button']):not([type='submit']):not([type='reset']):not([type='image']),
    select,
    textarea {
        font-size: 1rem;
        line-height: 1.5;
    }
}

/* Touch feedback without gray flash (WebKit). */
a,
button,
summary,
[role='button'],
label[for] {
    -webkit-tap-highlight-color: transparent;
}

button,
[type='button'],
[type='submit'],
[type='reset'] {
    touch-action: manipulation;
}

/* -------------------------------------------------------------------------- */
/* Shared action buttons — rounded rectangle (Tailwind rounded-lg equivalent) */
/* -------------------------------------------------------------------------- */

:root {
  --procure-btn-radius: 0.5rem;
}

.procure-btn {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--procure-btn-radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    color 150ms ease,
    transform 80ms ease;
}

.procure-btn:focus {
  outline: none;
}

.procure-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.procure-btn:disabled,
.procure-btn[disabled],
.procure-btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
  pointer-events: none;
}

/* Filled (primary) */
.procure-btn-filled {
  background-color: #2563eb;
  color: #fff;
  box-shadow:
    0 1px 2px rgb(37 99 235 / 0.28),
    0 1px 3px rgb(15 23 42 / 0.12);
}

.procure-btn-filled:hover {
  background-color: #1d4ed8;
  box-shadow:
    0 2px 4px rgb(37 99 235 / 0.32),
    0 2px 6px rgb(15 23 42 / 0.14);
}

.procure-btn-filled:active {
  background-color: #1e40af;
  transform: scale(0.98);
}

/* Filled neutral (search / filter submit) */
.procure-btn-filled--neutral,
.procure-search-submit {
  background-color: rgb(30 41 59);
  color: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.2);
}

.procure-btn-filled--neutral:hover,
.procure-search-submit:hover {
  background-color: rgb(15 23 42);
}

/* Outlined (secondary) */
.procure-btn-outlined,
.procure-btn-secondary {
  background-color: #fff;
  border-color: rgb(203 213 225);
  color: rgb(30 41 59);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.procure-btn-outlined:hover,
.procure-btn-secondary:hover {
  background-color: rgb(248 250 252);
  border-color: rgb(148 163 184);
}

.procure-btn-outlined:active,
.procure-btn-secondary:active {
  background-color: rgb(241 245 249);
}

/* Text (tertiary / inline actions) */
.procure-btn-text {
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--procure-btn-radius);
  background-color: transparent;
  color: #2563eb;
  font-weight: 600;
  box-shadow: none;
}

.procure-btn-text:hover {
  background-color: rgb(239 246 255);
  color: #1d4ed8;
}

/* Tonal */
.procure-btn-tonal {
  background-color: rgb(219 234 254);
  color: rgb(30 64 175);
  box-shadow: none;
}

.procure-btn-tonal:hover {
  background-color: rgb(191 219 254);
}

/* Destructive */
.procure-btn-danger {
  background-color: #dc2626;
  color: #fff;
  box-shadow: 0 1px 2px rgb(220 38 38 / 0.25);
}

.procure-btn-danger:hover {
  background-color: #b91c1c;
}

.procure-btn-danger-outlined {
  background-color: #fff;
  border-color: rgb(254 202 202);
  color: #b91c1c;
}

.procure-btn-danger-outlined:hover {
  background-color: rgb(254 242 242);
  border-color: rgb(252 165 165);
}

/* Size / layout modifiers */
.procure-btn-sm {
  min-height: 2.25rem;
  padding: 0.375rem 1rem;
  font-size: 0.8125rem;
}

.procure-btn-xs {
  min-height: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--procure-btn-radius);
}

.procure-btn-lg {
  min-height: 3rem;
  padding: 0.75rem 1.75rem;
}

.procure-btn-block {
  width: 100%;
}

/* Toggle / chip (e.g. date presets) */
.procure-btn-chip {
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--procure-btn-radius);
  border: 1px solid rgb(203 213 225);
  background-color: #fff;
  color: rgb(51 65 85);
  font-weight: 600;
  font-size: 0.8125rem;
  box-shadow: none;
}

.procure-btn-chip:hover {
  background-color: rgb(248 250 252);
}

.procure-btn-chip.is-active,
.procure-btn-chip[aria-pressed='true'] {
  border-color: #2563eb;
  background-color: #2563eb;
  color: #fff;
  box-shadow: 0 1px 2px rgb(37 99 235 / 0.25);
}

/* FAB — rounded square (same radius as standard buttons; not circular) */
.procure-btn-fab {
  border-radius: var(--procure-btn-radius);
  min-height: 0;
  padding: 0;
  box-shadow:
    0 4px 6px rgb(37 99 235 / 0.28),
    0 2px 4px rgb(15 23 42 / 0.12);
}

/* List row action (table/card links) */
a.procure-list-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  min-width: 2.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--procure-btn-radius);
  border: 1px solid rgb(203 213 225);
  background-color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  color: rgb(30 41 59);
  text-decoration: none;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
  transition: background-color 150ms ease, border-color 150ms ease;
}

/* SKU list (and similar) row actions — avoid table fixed-layout crushing link labels */
.procure-list-action-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
}

.table-responsive-wrap td.procure-list-actions-cell,
.table-responsive-wrap td.procure-list-actions-cell .procure-list-action-group {
  overflow-wrap: normal;
  word-break: normal;
}

.table-responsive-wrap td.procure-list-actions-cell a.procure-list-action-link {
  flex: 0 0 auto;
}

@media (max-width: 1023.98px) {
  .table-responsive-wrap td.procure-list-actions-cell .procure-list-action-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 5.5rem;
    margin-left: auto;
  }

  .table-responsive-wrap td.procure-list-actions-cell a.procure-list-action-link {
    width: 100%;
    min-height: 2.5rem;
    padding-inline: 0.5rem;
  }
}

@media (min-width: 1024px) {
  .table-responsive-wrap td.procure-list-actions-cell .procure-list-action-group {
    flex-direction: row;
    flex-wrap: nowrap;
    max-width: none;
  }
}

@media (max-width: 767.98px) {
  .procure-list-action-group--card {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .procure-list-action-group--card a.procure-list-action-link {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 2.75rem;
  }
}

a.procure-list-action-link:hover {
  background-color: rgb(248 250 252);
}

a.procure-list-action-link:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Material-style file picker */
.procure-file-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.procure-file-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.procure-file-picker__label {
  cursor: pointer;
}

.procure-file-picker__name {
  font-size: 0.875rem;
  color: rgb(100 116 139);
}

.procure-file-picker__name.has-file {
  color: rgb(15 23 42);
  font-weight: 500;
}

/* Primary search / list filter submit (slate-800). */

/* Consistent search field appearance. */
input[type='search'] {
    -webkit-appearance: none;
    appearance: none;
}

input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* Select chevron spacing in WebKit / Blink. */
select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2rem;
}

select:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Flex/grid children: allow shrinking (Safari overflow). */
.min-w-0-flex > * {
    min-width: 0;
}

/* Modal open: prevent background scroll bleed (iOS Safari). */
body.app-dialog-open {
    overflow: hidden;
    touch-action: none;
}

/* Smooth scrolling when supported; respect reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    html:focus-within {
        scroll-behavior: smooth;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    #scroll-top-fab {
        transition: none;
    }

    .procure-btn,
    .procure-btn-filled:active {
        transition: none;
        transform: none;
    }
}

/* Alpine cloak (layout + any x-cloak islands). */
[x-cloak] {
    display: none !important;
}

/* -------------------------------------------------------------------------- */
/* App shell layout (moved from inline layout styles — single cross-browser)  */
/* -------------------------------------------------------------------------- */

@media print {
    .print-hide {
        display: none !important;
    }
}

#scroll-top-fab {
    transition:
        opacity 220ms ease-out,
        transform 220ms cubic-bezier(0.33, 1, 0.68, 1),
        background-color 150ms ease-out,
        border-color 150ms ease-out,
        box-shadow 150ms ease-out;
}

#scroll-top-fab.scroll-top-fab--concealed {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92);
}

.procure-pr-selection-fab {
    z-index: 60;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 767.98px) {
    body.has-mobile-tabbar .procure-pr-selection-fab {
        bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px) + 0.75rem);
    }
}

@media (min-width: 768px) {
    .procure-pr-selection-fab {
        bottom: 1.5rem;
    }
}

/* List / hub page header — always: title, description, then actions (full content width). */
.procure-page-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
}

.procure-page-toolbar__title {
    margin: 0;
    line-height: 1.25;
}

.procure-page-toolbar__intro {
    width: 100%;
    max-width: 100%;
}

.procure-page-toolbar__intro > :first-child {
    margin-top: 0;
}

.procure-page-toolbar__intro > :last-child {
    margin-bottom: 0;
}

.procure-page-toolbar__intro p + p {
    margin-top: 0.5rem;
}

.procure-page-toolbar__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 640px) {
    .procure-page-toolbar__actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
}

/* List hub: filters + table in one full-width shell (no unused right gutter). */
.procure-list-workspace {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-radius: 0.75rem;
    border: 1px solid rgb(226 232 240);
    background-color: #fff;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.procure-list-workspace__toolbar {
    width: 100%;
    padding: 1rem;
    border-bottom: 1px solid rgb(241 245 249);
}

.procure-list-workspace__toolbar form {
    width: 100%;
    max-width: 100%;
}

.procure-list-workspace .procure-list-workspace__table.table-responsive-wrap {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.procure-list-workspace .procure-list-workspace__table-host {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.procure-list-workspace .procure-list-workspace__cards {
    padding: 1rem;
    width: 100%;
}

.procure-page-toolbar__actions .procure-btn {
    width: 100%;
}

@media (min-width: 640px) {
    .procure-page-toolbar__actions .procure-btn {
        width: auto;
    }
}

/* Wide data tables: scroll inside the shell; page body stays overflow-x clipped. */
.table-responsive-wrap {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

@supports (scrollbar-gutter: stable) {
    .table-responsive-wrap {
        scrollbar-gutter: stable;
    }
}

/* Nested legacy shells used overflow-hidden for rounded corners — must not clip table width. */
.table-responsive-wrap > .overflow-hidden:has(> table),
.table-responsive-wrap.overflow-hidden:has(> table) {
    overflow-x: auto;
    overflow-y: visible;
}

.table-responsive-wrap table:not(.procure-admin-users-table):not(.procure-master-list-fit) {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.table-responsive-wrap table.procure-admin-users-table,
.table-responsive-wrap table.procure-master-list-fit {
    border-collapse: collapse;
}

/* Opt-in: squeeze columns to viewport without horizontal scroll (rare). */
.table-responsive-wrap.table-layout-fixed table {
    width: 100%;
    table-layout: fixed;
}

.table-responsive-wrap th,
.table-responsive-wrap td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}

.table-responsive-wrap .tabular-nums,
.table-responsive-wrap .font-mono {
    overflow-wrap: normal;
    word-break: normal;
}

.table-responsive-wrap.table-scroll-sticky table {
    min-width: 640px;
}

/* SKU master list — avoid fixed-layout crushing short columns (UOM, CCY, headers) */
.table-responsive-wrap.table-scroll-sticky table.procure-sku-list-table {
    min-width: 42rem;
}

@media (min-width: 1024px) {
    .table-responsive-wrap.table-scroll-sticky table.procure-sku-list-table {
        min-width: 58rem;
    }
}

.table-responsive-wrap table.procure-sku-list-table th,
.table-responsive-wrap table.procure-sku-list-table td {
    overflow-wrap: normal;
    word-break: normal;
}

.table-responsive-wrap table.procure-sku-list-table th.procure-table-col-tight,
.table-responsive-wrap table.procure-sku-list-table td.procure-table-col-tight {
    width: 1%;
    white-space: nowrap;
}

.table-responsive-wrap table.procure-sku-list-table th.procure-table-col-desc,
.table-responsive-wrap table.procure-sku-list-table td.procure-table-col-desc {
    min-width: 11rem;
    overflow-wrap: break-word;
    word-break: normal;
}

.table-responsive-wrap table.procure-sku-list-table td.procure-table-col-code {
    min-width: 6.5rem;
    max-width: 10.5rem;
}

.table-responsive-wrap table.procure-sku-list-table td.procure-table-col-code a {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-all;
    line-height: 1.35;
}

.table-responsive-wrap table.procure-sku-list-table th.procure-table-col-category,
.table-responsive-wrap table.procure-sku-list-table td.procure-table-col-category {
    min-width: 8.5rem;
    max-width: 14rem;
    line-height: 1.35;
}

.table-responsive-wrap table.procure-sku-list-table .procure-sku-row-meta {
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Master list tables (cost centres, locations, …): short code col + primary label, compact rows */
.table-responsive-wrap table.procure-master-list-table th,
.table-responsive-wrap table.procure-master-list-table td {
    overflow-wrap: normal;
    word-break: normal;
    vertical-align: middle;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.table-responsive-wrap table.procure-master-list-table th.procure-table-col-code,
.table-responsive-wrap table.procure-master-list-table td.procure-table-col-code {
    width: 1%;
    min-width: 2.75rem;
    max-width: 6.5rem;
    white-space: nowrap;
    padding-left: 0.75rem;
    padding-right: 0.5rem;
}

.table-responsive-wrap table.procure-master-list-table th.procure-table-col-label,
.table-responsive-wrap table.procure-master-list-table td.procure-table-col-label {
    min-width: 8rem;
    width: auto;
    line-height: 1.35;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.table-responsive-wrap table.procure-master-list-table th.procure-table-col-tight,
.table-responsive-wrap table.procure-master-list-table td.procure-table-col-tight {
    width: 1%;
    white-space: nowrap;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.table-responsive-wrap table.procure-master-list-table th.procure-table-col-actions,
.table-responsive-wrap table.procure-master-list-table td.procure-table-col-actions {
    width: 1%;
    white-space: nowrap;
    padding-left: 0.5rem;
    padding-right: 0.75rem;
}

/* Compact mobile stacks for master lists (code + name on one visual row) */
.procure-mobile-list-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.procure-mobile-list-card {
    border-radius: 0.75rem;
    border: 1px solid rgb(226 232 240);
    background: #fff;
    padding: 0.625rem 0.875rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.procure-mobile-list-card__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.procure-mobile-list-card__main {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.5rem;
    row-gap: 0.125rem;
}

.procure-mobile-list-card__code {
    flex-shrink: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    color: rgb(30 41 59);
}

.procure-mobile-list-card__name {
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    color: rgb(15 23 42);
}

.procure-mobile-list-card__meta {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: rgb(71 85 105);
}

.procure-mobile-list-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgb(241 245 249);
}

/* Vendor master list — name + contact email are primary; avoid fixed-layout crushing */
.table-responsive-wrap.table-scroll-sticky table.procure-vendor-list-table {
    min-width: 44rem;
}

@media (min-width: 1024px) {
    .table-responsive-wrap.table-scroll-sticky table.procure-vendor-list-table {
        min-width: 52rem;
    }
}

@media (min-width: 1280px) {
    .table-responsive-wrap.table-scroll-sticky table.procure-vendor-list-table {
        min-width: 58rem;
    }
}

.table-responsive-wrap table.procure-vendor-list-table th,
.table-responsive-wrap table.procure-vendor-list-table td {
    overflow-wrap: normal;
    word-break: normal;
}

.table-responsive-wrap table.procure-vendor-list-table th.procure-vendor-col-tight,
.table-responsive-wrap table.procure-vendor-list-table td.procure-vendor-col-tight {
    width: 1%;
    white-space: nowrap;
}

.table-responsive-wrap table.procure-vendor-list-table th.procure-table-col-code,
.table-responsive-wrap table.procure-vendor-list-table td.procure-table-col-code {
    max-width: 10rem;
}

.table-responsive-wrap table.procure-vendor-list-table th.procure-vendor-col-name,
.table-responsive-wrap table.procure-vendor-list-table td.procure-vendor-col-name {
    min-width: 0;
    width: auto;
    line-height: 1.35;
}

.table-responsive-wrap table.procure-vendor-list-table th.procure-vendor-col-contact,
.table-responsive-wrap table.procure-vendor-list-table td.procure-vendor-col-contact {
    min-width: 0;
    width: auto;
    line-height: 1.35;
}

.table-responsive-wrap table.procure-vendor-list-table td.procure-vendor-col-contact {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.table-responsive-wrap table.procure-vendor-list-table th.procure-vendor-col-activity,
.table-responsive-wrap table.procure-vendor-list-table td.procure-vendor-col-activity {
    min-width: 7rem;
    max-width: 12rem;
    line-height: 1.35;
}

.table-responsive-wrap table.procure-vendor-list-table th.procure-vendor-col-actions,
.table-responsive-wrap table.procure-vendor-list-table td.procure-vendor-col-actions {
    width: 1%;
    white-space: nowrap;
}

/* Issue request list — fit viewport like other master lists */
.table-responsive-wrap:has(> table.procure-ir-list-table) {
    overflow-x: hidden;
}

.table-responsive-wrap:has(> table.procure-ir-list-table) table.procure-ir-list-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.table-responsive-wrap table.procure-ir-list-table th.procure-table-col-actions,
.table-responsive-wrap table.procure-ir-list-table td.procure-table-col-actions {
    width: 1%;
    white-space: nowrap;
}

/* Issue request detail — fit main column; numeric cols tight, SKU + fulfillment wrap */
.table-responsive-wrap:has(> table.procure-ir-detail-table) {
    overflow-x: hidden;
}

.table-responsive-wrap:has(> table.procure-ir-detail-table) table.procure-ir-detail-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.table-responsive-wrap table.procure-ir-detail-table th,
.table-responsive-wrap table.procure-ir-detail-table td {
    vertical-align: top;
}

.table-responsive-wrap table.procure-ir-detail-table th.procure-ir-col-sku,
.table-responsive-wrap table.procure-ir-detail-table td.procure-ir-col-sku {
    min-width: 0;
    width: auto;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.table-responsive-wrap table.procure-ir-detail-table td.procure-ir-col-sku .font-mono {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.table-responsive-wrap table.procure-ir-detail-table th.procure-ir-col-num,
.table-responsive-wrap table.procure-ir-detail-table td.procure-ir-col-num {
    width: 1%;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    text-align: center;
}

.table-responsive-wrap table.procure-ir-detail-table th.procure-ir-col-fulfill,
.table-responsive-wrap table.procure-ir-detail-table td.procure-ir-col-fulfill {
    width: 1%;
    min-width: 0;
    white-space: normal;
}

.table-responsive-wrap table.procure-ir-detail-table td.procure-ir-col-fulfill .ir-fulfill-actions {
    max-width: 11rem;
    margin-left: auto;
}

.ir-fulfill-btn-shortage {
    border-color: rgb(253 230 138);
    color: rgb(146 64 14);
    background-color: rgb(255 251 235);
}

.ir-fulfill-btn-shortage:hover {
    background-color: rgb(254 243 199);
    border-color: rgb(251 191 36);
    color: rgb(120 53 15);
}

.procure-mobile-list-card__actions .ir-fulfill-actions {
    width: 100%;
}

@media (min-width: 1280px) {
    .table-responsive-wrap table.procure-ir-detail-table td.procure-ir-col-fulfill .ir-fulfill-actions {
        max-width: 12.5rem;
    }
}

/* Master / report tables — fit main column; scroll inside wrap when actions need room */
.table-responsive-wrap:has(> table.procure-master-list-table),
.table-responsive-wrap:has(> table.procure-report-table) {
    overflow-x: auto;
    max-width: 100%;
}

.table-responsive-wrap:has(> table.procure-vendor-list-table),
.table-responsive-wrap:has(> table.procure-ir-list-table),
.table-responsive-wrap:has(> table.procure-ir-detail-table) {
    overflow-x: hidden;
}

.table-responsive-wrap:has(> table.procure-master-list-table:not(.procure-admin-users-table):not(.procure-master-list-fit))
    > table.procure-master-list-table:not(.procure-admin-users-table):not(.procure-master-list-fit),
.table-responsive-wrap:has(> table.procure-report-table) > table.procure-report-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.table-responsive-wrap table.procure-master-list-table:not(.procure-admin-users-table):not(.procure-master-list-fit) th.procure-table-col-actions,
.table-responsive-wrap table.procure-master-list-table:not(.procure-admin-users-table):not(.procure-master-list-fit) td.procure-table-col-actions {
    width: 1%;
    min-width: 10.5rem;
    vertical-align: middle;
}

#main-content #live-q-search-results,
#main-content section[aria-labelledby] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Master lists that must fit #main-content (max-w-5xl) — no clipped action columns */
.table-responsive-wrap:has(> table.procure-admin-users-table),
.table-responsive-wrap:has(> table.procure-master-list-fit) {
    overflow-x: hidden;
}

.table-responsive-wrap table.procure-admin-users-table,
.table-responsive-wrap table.procure-master-list-fit {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.table-responsive-wrap table.procure-admin-users-table th.procure-admin-col-name,
.table-responsive-wrap table.procure-admin-users-table td.procure-admin-col-name,
.table-responsive-wrap table.procure-admin-users-table th.procure-admin-col-email,
.table-responsive-wrap table.procure-admin-users-table td.procure-admin-col-email,
.table-responsive-wrap table.procure-admin-users-table th.procure-admin-col-roles,
.table-responsive-wrap table.procure-admin-users-table td.procure-admin-col-roles,
.table-responsive-wrap table.procure-master-list-fit th.procure-master-col-truncate,
.table-responsive-wrap table.procure-master-list-fit td.procure-master-col-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-responsive-wrap table.procure-master-list-fit td.procure-master-col-wrap {
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

/* Desktop: fit tables show full labels (fixed layout + nowrap truncate clipped short names). */
@media (min-width: 768px) {
    .table-responsive-wrap table.procure-master-list-fit {
        table-layout: auto;
    }

    .table-responsive-wrap table.procure-master-list-fit th.procure-master-col-truncate,
    .table-responsive-wrap table.procure-master-list-fit td.procure-master-col-truncate,
    .table-responsive-wrap table.procure-master-list-fit th.procure-table-col-label,
    .table-responsive-wrap table.procure-master-list-fit td.procure-table-col-label {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
        word-break: normal;
        line-height: 1.35;
        min-width: 9rem;
    }

    .table-responsive-wrap:has(> table.procure-master-list-fit) {
        overflow-x: auto;
    }
}

.table-responsive-wrap table.procure-admin-users-table th.procure-table-col-actions,
.table-responsive-wrap table.procure-admin-users-table td.procure-table-col-actions,
.table-responsive-wrap table.procure-master-list-fit th.procure-table-col-actions,
.table-responsive-wrap table.procure-master-list-fit td.procure-table-col-actions {
    width: 5.75rem;
    min-width: 0;
    padding-inline: 0.5rem;
    vertical-align: middle;
}

.table-responsive-wrap table.procure-admin-users-table td.procure-list-actions-cell .procure-list-action-group,
.table-responsive-wrap table.procure-master-list-fit td.procure-list-actions-cell .procure-list-action-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 5.75rem;
    margin-left: auto;
    gap: 0.25rem;
}

.table-responsive-wrap table.procure-admin-users-table td.procure-list-actions-cell a.procure-list-action-link,
.table-responsive-wrap table.procure-admin-users-table td.procure-list-actions-cell button.procure-btn-xs,
.table-responsive-wrap table.procure-master-list-fit td.procure-list-actions-cell a.procure-list-action-link,
.table-responsive-wrap table.procure-master-list-fit td.procure-list-actions-cell button.procure-btn-xs {
    width: 100%;
    min-height: 2.25rem;
    padding-inline: 0.375rem;
}

@media (min-width: 1280px) {
    .table-responsive-wrap table.procure-admin-users-table td.procure-list-actions-cell .procure-list-action-group,
    .table-responsive-wrap table.procure-master-list-fit td.procure-list-actions-cell .procure-list-action-group {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: none;
        width: auto;
    }

    .table-responsive-wrap table.procure-admin-users-table th.procure-table-col-actions,
    .table-responsive-wrap table.procure-admin-users-table td.procure-table-col-actions,
    .table-responsive-wrap table.procure-master-list-fit th.procure-table-col-actions,
    .table-responsive-wrap table.procure-master-list-fit td.procure-table-col-actions {
        width: auto;
        min-width: 11rem;
        padding-inline: 1rem;
    }

    .table-responsive-wrap table.procure-admin-users-table td.procure-list-actions-cell a.procure-list-action-link,
    .table-responsive-wrap table.procure-admin-users-table td.procure-list-actions-cell button.procure-btn-xs,
    .table-responsive-wrap table.procure-master-list-fit td.procure-list-actions-cell a.procure-list-action-link,
    .table-responsive-wrap table.procure-master-list-fit td.procure-list-actions-cell button.procure-btn-xs {
        width: auto;
    }
}

.table-responsive-wrap table.procure-report-table th,
.table-responsive-wrap table.procure-report-table td {
    overflow-wrap: anywhere;
    word-break: normal;
    vertical-align: top;
}

.table-responsive-wrap table.procure-report-table th.procure-table-col-num,
.table-responsive-wrap table.procure-report-table td.procure-table-col-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table-responsive-wrap:has(> table.procure-stock-on-hand-table) {
    overflow-x: hidden;
    max-width: 100%;
}

.table-responsive-wrap table.procure-stock-on-hand-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.table-responsive-wrap table.procure-stock-on-hand-table th.procure-stock-col-item,
.table-responsive-wrap table.procure-stock-on-hand-table td.procure-stock-col-item {
    min-width: 8rem;
}

.table-responsive-wrap table.procure-stock-on-hand-table th.procure-table-col-num,
.table-responsive-wrap table.procure-stock-on-hand-table td.procure-table-col-num {
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table-responsive-wrap table.procure-peek-lines {
    width: 100%;
    table-layout: fixed;
}

.table-responsive-wrap table.procure-peek-lines th.procure-table-col-num,
.table-responsive-wrap table.procure-peek-lines td.procure-table-col-num,
table.procure-peek-lines th:nth-child(n + 2),
table.procure-peek-lines td:nth-child(n + 2) {
    text-align: center;
}

/* Vendor master list — full width of main column, no inner horizontal scroll */
.table-responsive-wrap:has(> table.procure-vendor-list-table) {
    overflow-x: hidden;
}

.table-responsive-wrap:has(> table.procure-vendor-list-table) table.procure-vendor-list-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
    .table-responsive-wrap table.procure-vendor-list-table td.procure-list-actions-cell .procure-list-action-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 5.5rem;
        margin-left: auto;
    }

    .table-responsive-wrap table.procure-vendor-list-table td.procure-list-actions-cell a.procure-list-action-link {
        width: 100%;
        min-height: 2.5rem;
        padding-inline: 0.5rem;
    }
}

.table-responsive-wrap.table-scroll-sticky th:first-child,
.table-responsive-wrap.table-scroll-sticky td:first-child {
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
    box-shadow: 1px 0 0 rgba(148, 163, 184, 0.35);
}

/* PO/PR line tables: many columns; fixed layout crushes description — use auto + scroll */
.table-responsive-wrap.procure-lines-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.table-responsive-wrap.procure-lines-table-wrap table {
    table-layout: auto;
    width: 100%;
    min-width: 42rem;
}

.table-responsive-wrap.procure-lines-table-wrap th,
.table-responsive-wrap.procure-lines-table-wrap td {
    overflow-wrap: break-word;
    word-break: normal;
}

.table-responsive-wrap.procure-lines-table-wrap .procure-lines-table-desc {
    min-width: 9rem;
    width: 38%;
}

.table-responsive-wrap.procure-lines-table-wrap .procure-lines-table-line-col {
    width: 2.5rem;
    max-width: 2.75rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.table-responsive-wrap.procure-lines-table-wrap .procure-lines-table-fit {
    overflow-x: auto;
    max-width: 100%;
}

/* Line card metrics: one horizontal row on phones (no 2×2 label maze) */
.procure-line-metrics__row {
    display: flex;
    gap: 0.625rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.procure-line-metrics__row::-webkit-scrollbar {
    display: none;
}

.procure-line-metrics__row > .procure-line-metric-cell {
    flex: 1 1 0;
    min-width: 4.25rem;
}

@media (min-width: 640px) {
    .procure-line-metrics__row {
        display: grid;
        overflow-x: visible;
    }

    .procure-line-metrics__row.procure-line-metrics__row--4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .procure-line-metrics__row.procure-line-metrics__row--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .procure-line-metrics__row.procure-line-metrics__row--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .procure-line-metrics__row > .procure-line-metric-cell {
        min-width: 0;
    }
}

.record-card-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 100%;
}

.record-card-stack > * {
    min-width: 0;
}

.proc-list-line-toggle[aria-expanded='true'] .proc-list-line-caret {
    transform: rotate(90deg);
}

/* Sidebar / mobile nav scroll (iOS momentum). */
.procure-sidebar-nav,
.procure-mobile-nav-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Collapsible nav panels — consistent hidden across WebKit / Gecko / Blink. */
[data-nav-section-panel][hidden] {
    display: none !important;
}

/* Native buttons in shell (theme, sign out) — same hit target as MD buttons. */
.procure-sidebar-utility-btn {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    display: flex;
    width: 100%;
    align-items: center;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    color: rgb(71 85 105);
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.procure-sidebar-utility-btn:hover {
    background-color: rgb(241 245 249);
}

.procure-sidebar-utility-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Shared text fields / selects (use instead of one-off Tailwind per form). */
.procure-form-control {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(203 213 225);
    background-color: #fff;
    color: rgb(15 23 42);
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

@media (min-width: 768px) {
    .procure-form-control {
        font-size: 0.875rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

.procure-form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

select.procure-form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2rem;
}

textarea.procure-form-control {
    min-height: 5rem;
    resize: vertical;
}

/* iOS date inputs: prevent clipped native control. */
input.procure-form-control[type='date'],
input.procure-form-control[type='datetime-local'],
input.procure-form-control[type='time'] {
    min-height: 2.75rem;
}

/* Details/summary disclosure rows (Safari marker). */
summary.procure-disclosure,
.procure-disclosure > summary,
details.procure-disclosure > summary {
    cursor: pointer;
    list-style: none;
}

summary.procure-disclosure::-webkit-details-marker,
.procure-disclosure > summary::-webkit-details-marker,
details.procure-disclosure > summary::-webkit-details-marker {
    display: none;
}

summary.procure-disclosure::marker,
details.procure-disclosure > summary::marker {
    content: '';
}

/* Firefox: submit buttons with procure-btn should not clip text. */
input.procure-btn,
button.procure-btn {
    line-height: 1.25;
}

/* Mobile drawer + iOS: lock body when nav open (Alpine adds overflow-hidden on body). */
body.overflow-hidden {
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: none;
}

/* Collapsible read-only blocks (PO face terms, long notes). */
.procure-clamp-expand__body--clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--procure-clamp-lines, 4);
    line-clamp: var(--procure-clamp-lines, 4);
    overflow: hidden;
}
