/* =========================================================
   ROUTIQ PURCHASING CORE
   FILE: cores/purchasing/purchasing.css
========================================================= */


/* =========================================================
   PURCHASING CORE VARIABLES
========================================================= */

:root {
  /* Page foundation */
  --purchasing-bg: #f1f1ed;
  --purchasing-surface: #ffffff;
  --purchasing-surface-soft: #faf9f3;

  /* Borders */
  --purchasing-border: #dfddd3;
  --purchasing-border-strong: #ccc8b8;

  /* Typography */
  --purchasing-text: #20231f;
  --purchasing-text-secondary: #686a62;
  --purchasing-text-muted: #929287;

  /* Purchasing signature color */
  --purchasing-primary: #bd8628;
  --purchasing-primary-dark: #93651c;
  --purchasing-primary-soft: #f6edd9;

  /* Workflow status colors */
  --purchasing-success: #4e8067;
  --purchasing-success-soft: #e9f2ed;

  --purchasing-warning: #a76f22;
  --purchasing-warning-soft: #f7eedf;

  --purchasing-processing: #b17c2b;
  --purchasing-processing-soft: #f5ecda;

  --purchasing-danger: #a64d4d;
  --purchasing-danger-soft: #f8eaea;

  /* Depth */
  --purchasing-shadow:
    0 18px 45px rgba(63, 55, 35, 0.08);

  /* Radius */
  --purchasing-radius-large: 18px;
  --purchasing-radius-medium: 12px;
  --purchasing-radius-small: 8px;
}

/* =========================================================
   PURCHASING CORE HEADER COLOR OVERRIDE

   Dashboard Header의 구조와 크기는 그대로 유지하고,
   Purchasing Core에서만 Amber Signature를 적용한다.
========================================================= */

.purchasing-header {
  background:
    linear-gradient(
      110deg,
      #493818 0%,
      #5a421a 48%,
      #3f321b 100%
    );

  border-bottom-color: rgba(218, 170, 73, 0.45);

  box-shadow:
    0 8px 26px rgba(55, 40, 13, 0.22),
    inset 0 -1px 0 rgba(236, 194, 106, 0.16);
}


/* Header divider */

.purchasing-header .header-divider {
  background: rgba(231, 190, 104, 0.38);
}


/* Main Header text */

.purchasing-header .page-title-block h1,
.purchasing-header .header-date,
.purchasing-header .header-time,
.purchasing-header .user-info strong {
  color: #f7f3e8;
}


/* Secondary Header text */

.purchasing-header .page-title-block p,
.purchasing-header .user-info p {
  color: rgba(247, 243, 232, 0.65);
}


/* Live feed */

.purchasing-header .header-feed {
  color: #e4b65d;
}

.purchasing-header .feed-track {
  color: #e4b65d;
}


/* Header SVG icons */

.purchasing-header .header-svg-icon,
.purchasing-header .user-avatar svg,
.purchasing-header .chevron-svg {
  color: #e0b15a;
  stroke: currentColor;
}


/* User avatar */

.purchasing-header .user-avatar {
  color: #e0b15a;

  background: rgba(222, 174, 82, 0.12);
  border-color: rgba(222, 174, 82, 0.28);
}


/* Theme toggle body */

.purchasing-header .theme-toggle {
  background: rgba(29, 23, 13, 0.34);
  border-color: rgba(224, 177, 90, 0.34);
}


/* Theme toggle knob */

.purchasing-header .toggle-knob {
  background: #e0ad4b;

  box-shadow:
    0 3px 8px rgba(30, 20, 5, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}


/* Sun and moon icons */

.purchasing-header .toggle-sun,
.purchasing-header .toggle-moon {
  color: #f3d28e;
  stroke: currentColor;
}

/* Header hover states */

.purchasing-header .user-block:hover {
  background: rgba(224, 177, 90, 0.09);
}

.purchasing-header .theme-toggle:hover {
  border-color: rgba(239, 194, 104, 0.58);
}

/* =========================================================
   PAGE FOUNDATION

   Dashboard의 body 스타일이 이미 존재하더라도
   Purchasing Core 영역에만 적용된다.
========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.purchasing-page {
  min-height: calc(100vh - 72px);
  padding: 34px clamp(24px, 3.2vw, 58px) 54px;

  color: var(--purchasing-text);

  background:
    radial-gradient(
      circle at 8% 0%,
      rgba(200, 151, 54, 0.11),
      transparent 31%
    ),
    radial-gradient(
      circle at 92% 18%,
      rgba(222, 190, 113, 0.055),
      transparent 28%
    ),
    var(--purchasing-bg);
}

/* =========================================================
   PAGE HEADING
========================================================= */

.purchasing-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;

  max-width: 1680px;
  margin: 0 auto 26px;
}

.purchasing-heading__eyebrow,
.section-kicker {
  display: block;
  margin-bottom: 7px;

  color: var(--purchasing-primary);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.15em;
}

.purchasing-heading h1 {
  margin: 0;

  color: var(--purchasing-text);
  font-size: clamp(1.85rem, 2.5vw, 2.65rem);
  font-weight: 680;
  letter-spacing: -0.04em;
}

.purchasing-heading p {
  margin: 8px 0 0;

  color: var(--purchasing-text-secondary);
  font-size: 0.96rem;
  line-height: 1.6;
}

.purchasing-heading__status {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  padding: 10px 14px;

  color: var(--purchasing-success);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--purchasing-border);
  border-radius: 999px;

  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.system-status-dot {
  width: 8px;
  height: 8px;

  background: var(--purchasing-success);
  border-radius: 50%;

  box-shadow: 0 0 0 4px rgba(63, 124, 99, 0.12);
}


/* =========================================================
   COMMON CARDS
========================================================= */

.intake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.7fr);
  gap: 22px;

  max-width: 1680px;
  margin: 0 auto;
}

.intake-card,
.processing-panel,
.review-panel,
.records-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--purchasing-border);
  border-radius: var(--purchasing-radius-large);
  box-shadow: var(--purchasing-shadow);
}

.intake-card {
  min-width: 0;
  padding: 22px;
}

.section-heading,
.processing-panel__header,
.review-panel__header,
.records-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2,
.processing-panel__header h2,
.review-panel__header h2,
.records-card__header h2 {
  margin: 0;

  color: var(--purchasing-text);
  font-size: 1.05rem;
  font-weight: 680;
  letter-spacing: -0.018em;
}

.section-state,
.summary-date {
  color: var(--purchasing-text-muted);
  font-size: 0.73rem;
  font-weight: 650;
}


/* =========================================================
   DOCUMENT DROP ZONE
========================================================= */

.document-drop-zone {
  display: flex;
  min-height: 286px;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  padding: 34px;

  text-align: center;
  outline: none;

  background:
    linear-gradient(
      145deg,
      rgba(247, 250, 253, 0.95),
      rgba(238, 244, 249, 0.8)
    );
  border: 1.5px dashed #c3b58f;
  border-radius: 14px;

  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.document-drop-zone:hover,
.document-drop-zone:focus-visible,
.document-drop-zone.is-dragging {
  background: var(--purchasing-primary-soft);
  border-color: var(--purchasing-primary);

  box-shadow:
  inset 0 0 0 1px rgba(189, 134, 40, 0.09),
  0 14px 30px rgba(132, 95, 32, 0.09);

  transform: translateY(-2px);
}

.drop-zone-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;

  margin-bottom: 16px;

  color: var(--purchasing-primary);
  background: #ffffff;
  border: 1px solid #ddd4bc;
  border-radius: 15px;

  box-shadow: 0 10px 24px rgba(42, 67, 90, 0.08);
}

.drop-zone-icon svg {
  width: 27px;
  height: 27px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.document-drop-zone h3 {
  margin: 0 0 7px;

  font-size: 1.05rem;
  font-weight: 680;
}

.document-drop-zone p {
  margin: 0 0 19px;

  color: var(--purchasing-text-secondary);
  font-size: 0.84rem;
}

.browse-button {
  min-width: 145px;
  padding: 10px 18px;

  color: #ffffff;
  background: var(--purchasing-primary);
  border: 1px solid var(--purchasing-primary);
  border-radius: 8px;

  font-size: 0.81rem;
  font-weight: 650;

  transition:
    background 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.browse-button:hover {
  background: var(--purchasing-primary-dark);
  border-color: var(--purchasing-primary-dark);
  transform: translateY(-1px);
}

.supported-file-types {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;

  margin-top: 18px;
}

.supported-file-types span {
  padding: 5px 8px;

  color: var(--purchasing-text-muted);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--purchasing-border);
  border-radius: 5px;

  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.document-types {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  margin-top: 16px;
  padding: 15px 2px 0;
}

.document-type-label {
  color: var(--purchasing-text-muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.document-type-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.document-type-list span {
  padding: 6px 9px;

  color: var(--purchasing-text-secondary);
  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 6px;

  font-size: 0.68rem;
  font-weight: 620;
}

.upload-message {
  min-height: 20px;
  margin-top: 10px;

  color: var(--purchasing-danger);
  font-size: 0.75rem;
  font-weight: 600;
}

.upload-message.is-success {
  color: var(--purchasing-success);
}

/* =========================================================
   INTAKE SUMMARY
========================================================= */

.intake-summary-card {
  display: flex;
  flex-direction: column;
}

.summary-metrics {
  display: grid;
  gap: 10px;
}

.summary-metric {
  display: flex;
  min-height: 63px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 13px 14px;

  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 10px;
}

.summary-metric__label {
  display: flex;
  align-items: center;
  gap: 10px;

  color: var(--purchasing-text-secondary);
  font-size: 0.75rem;
  font-weight: 620;
}

.summary-metric strong {
  color: var(--purchasing-text);
  font-size: 1.3rem;
  font-weight: 680;
}

.metric-icon {
  width: 9px;
  height: 9px;

  border-radius: 50%;
}

.metric-icon--uploaded {
  background: var(--purchasing-primary);
}

.metric-icon--processing {
  background: var(--purchasing-processing);
}

.metric-icon--review {
  background: var(--purchasing-warning);
}

.metric-icon--created {
  background: var(--purchasing-success);
}

.workflow-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;

  margin-top: auto;
  padding-top: 23px;

  color: var(--purchasing-text-muted);
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workflow-route i {
  width: 13px;
  height: 1px;

  background: var(--purchasing-border-strong);
}


/* =========================================================
   PROCESSING PANEL
========================================================= */

.processing-panel,
.review-panel,
.records-card {
  max-width: 1680px;
  margin-right: auto;
  margin-left: auto;
}

.processing-panel,
.review-panel {
  margin-top: 22px;
  padding: 23px;
}

.processing-panel[hidden],
.review-panel[hidden] {
  display: none;
}

.processing-status,
.review-badge {
  padding: 7px 10px;

  border-radius: 999px;

  font-size: 0.68rem;
  font-weight: 700;
}

.processing-status {
  color: var(--purchasing-processing);
  background: var(--purchasing-processing-soft);
}

.review-badge {
  color: var(--purchasing-warning);
  background: var(--purchasing-warning-soft);
}

.processing-document {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(280px, 0.85fr);
  gap: 25px;
  align-items: center;

  margin-top: 20px;
  padding: 17px;

  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 12px;
}

.processing-document__file {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.file-icon {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 48px;
  place-items: center;

  color: var(--purchasing-primary);
  background: #ffffff;
  border: 1px solid var(--purchasing-border);
  border-radius: 8px;

  font-size: 0.58rem;
  font-weight: 800;
}

.processing-document__file div:last-child {
  min-width: 0;
}

.processing-document__file strong,
.processing-document__file span {
  display: block;
}

.processing-document__file strong {
  overflow: hidden;

  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-document__file span {
  margin-top: 5px;

  color: var(--purchasing-text-muted);
  font-size: 0.7rem;
}

.processing-progress {
  display: flex;
  align-items: center;
  gap: 11px;
}

.processing-progress__track {
  overflow: hidden;

  width: 100%;
  height: 7px;

  background: #dfe6ec;
  border-radius: 999px;
}

.processing-progress__bar {
  width: 0%;
  height: 100%;

  background: var(--purchasing-primary);
  border-radius: inherit;

  transition: width 350ms ease;
}

.processing-progress > span {
  min-width: 37px;

  color: var(--purchasing-text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: right;
}

.processing-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;

  margin-top: 14px;
}

.processing-step {
  display: flex;
  gap: 10px;

  padding: 13px;

  opacity: 0.45;
  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 10px;

  transition:
    opacity 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.processing-step > span {
  display: grid;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  place-items: center;

  color: var(--purchasing-text-muted);
  background: #ffffff;
  border: 1px solid var(--purchasing-border);
  border-radius: 50%;

  font-size: 0.65rem;
  font-weight: 750;
}

.processing-step strong,
.processing-step small {
  display: block;
}

.processing-step strong {
  font-size: 0.72rem;
}

.processing-step small {
  margin-top: 5px;

  color: var(--purchasing-text-muted);
  font-size: 0.63rem;
  line-height: 1.4;
}

.processing-step.is-active,
.processing-step.is-complete {
  opacity: 1;
}

.processing-step.is-active {
  background: var(--purchasing-primary-soft);
  border-color: #d5bf8b;
}

.processing-step.is-complete {
  background: var(--purchasing-success-soft);
  border-color: #bad6c7;
}

.processing-step.is-complete > span {
  color: #ffffff;
  background: var(--purchasing-success);
  border-color: var(--purchasing-success);
}


/* =========================================================
   REVIEW PANEL
========================================================= */

.review-panel__header {
  align-items: flex-start;
}

.review-panel__header p {
  margin: 7px 0 0;

  color: var(--purchasing-text-secondary);
  font-size: 0.78rem;
}

.extraction-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;

  margin-top: 22px;
}

.form-field {
  min-width: 0;
}

.form-field--full {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  margin-bottom: 7px;

  color: var(--purchasing-text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
}

.form-field input,
.form-field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;

  color: var(--purchasing-text);
  outline: none;
  background: #ffffff;
  border: 1px solid var(--purchasing-border-strong);
  border-radius: 8px;

  font-size: 0.78rem;

  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--purchasing-primary);
  box-shadow: 0 0 0 3px rgba(45, 99, 143, 0.1);
}

.extracted-line-items {
  padding: 16px;

  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 11px;
}

.line-items-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;

  margin-bottom: 12px;
}

.line-items-heading label {
  margin: 0;
}

.line-items-heading p {
  margin: 5px 0 0;

  color: var(--purchasing-text-muted);
  font-size: 0.67rem;
}

.line-items-heading > span {
  color: var(--purchasing-primary);
  font-size: 0.68rem;
  font-weight: 700;
}

.line-items-table-wrapper,
.records-table-wrapper {
  overflow-x: auto;
}

.line-items-table,
.records-table {
  width: 100%;

  border-collapse: collapse;
}

.line-items-table th,
.line-items-table td {
  padding: 10px 11px;

  border-bottom: 1px solid var(--purchasing-border);

  font-size: 0.7rem;
  text-align: left;
}

.line-items-table th {
  color: var(--purchasing-text-muted);
  font-weight: 700;
}

.line-items-table input {
  width: 100%;
  min-width: 90px;
  padding: 8px 9px;

  color: var(--purchasing-text);
  background: #ffffff;
  border: 1px solid var(--purchasing-border);
  border-radius: 6px;
  outline: none;

  font-size: 0.7rem;
}

.line-items-table input:focus {
  border-color: var(--purchasing-primary);

  box-shadow:
    0 0 0 3px rgba(189, 134, 40, 0.10);
}

.line-item-description {
  min-width: 280px !important;
}

.line-item-unit {
  min-width: 65px !important;
  text-align: center;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;

  padding-top: 3px;
}

.primary-action,
.secondary-action {
  min-height: 42px;
  padding: 10px 17px;

  border-radius: 8px;

  font-size: 0.76rem;
  font-weight: 680;
}

.primary-action {
  color: #ffffff;
  background: var(--purchasing-primary);
  border: 1px solid var(--purchasing-primary);
}

.primary-action:hover {
  background: var(--purchasing-primary-dark);
}

.secondary-action {
  color: var(--purchasing-text-secondary);
  background: #ffffff;
  border: 1px solid var(--purchasing-border-strong);
}

.secondary-action:hover {
  background: var(--purchasing-surface-soft);
}


/* =========================================================
   RECENT PURCHASE RECORDS
========================================================= */

.records-card {
  overflow: hidden;

  margin-top: 22px;
}

.records-card__header {
  padding: 21px 23px;

  border-bottom: 1px solid var(--purchasing-border);
}

.record-search {
  display: flex;
  width: min(245px, 28vw);
  min-width: 180px;
  align-items: center;
  gap: 8px;

  padding: 8px 10px;

  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 8px;
}

.record-search span {
  display: grid;
  place-items: center;

  color: var(--purchasing-text-muted);
}

.record-search svg {
  width: 16px;
  height: 16px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.record-search input {
  width: 100%;

  color: var(--purchasing-text);
  outline: none;
  background: transparent;
  border: 0;

  font-size: 0.73rem;
}

.purchase-records-wrapper {
  padding: 15px;
}

.purchase-record-cards {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.purchase-record-card {
  position: relative;

  background: #fcfcfd;
  border: 1px solid #d1d5db;
  border-radius: var(--purchasing-radius-medium);
  overflow: hidden;

  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.purchase-record-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;

  width: 20px;

  background: #c0c5cc;

  border-top-left-radius: var(--purchasing-radius-medium);
  border-bottom-left-radius: var(--purchasing-radius-medium);

  transition:
    background-color 180ms ease;
}

body:not(.dark-mode) .purchase-record-card--incomplete {
  border-color: #d1d5db;
}

body:not(.dark-mode) .purchase-record-card--incomplete::before {
  background: linear-gradient(180deg, #0f1318 0%, #10141a 100%);
}

.purchase-record-card--incomplete:hover {
  border-color: rgba(189, 134, 40, 0.62);
  box-shadow:
    0 7px 20px rgba(189, 134, 40, 0.18),
    0 0 0 1px rgba(189, 134, 40, 0.2);
  transform: translateY(-1px);
}

.purchase-record-card--incomplete:hover::before {
  background: #bd8628;
}

.purchase-record-card--received {
  border-color: rgba(189, 134, 40, 0.7);
  box-shadow:
    0 7px 21px rgba(189, 134, 40, 0.22),
    0 0 0 1px rgba(189, 134, 40, 0.3);
}

.purchase-record-card--received::before {
  background: #bd8628;
}

.purchase-record-card--received:hover {
  box-shadow:
    0 10px 26px rgba(189, 134, 40, 0.28),
    0 0 0 1px rgba(189, 134, 40, 0.42);
  transform: translateY(-1px);
}

.purchase-record-card__summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;

  padding: 14px 16px 14px 30px;
}

.purchase-record-card__main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.purchase-record-card__icon-slot {
  display: grid;
  width: 44px;
  place-items: center;
}

.purchase-record-card__document-icon {
  position: relative;
  display: grid;
  width: 38px;
  height: 44px;
  place-items: center;

  color: #59616b;
  background: #f4f6f8;
  border: 1px solid #c6ccd4;
  border-radius: 8px;

  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.purchase-record-card__document-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;

  width: 11px;
  height: 11px;

  background: linear-gradient(135deg, #e4e8ec 50%, #f4f6f8 50%);
  border-left: 1px solid #c6ccd4;
  border-bottom: 1px solid #c6ccd4;
  border-top-right-radius: 7px;
}

.purchase-record-card__received-icon-image {
  display: block;
  width: 34px;
  height: 34px;

  object-fit: contain;
}

.purchase-record-card__meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.purchase-record-card__vendor,
.purchase-record-card__date,
.purchase-record-card__count {
  color: var(--purchasing-text-secondary);
  font-size: 0.73rem;
  font-weight: 620;
}

.purchase-record-card__vendor {
  color: var(--purchasing-text);
  font-size: 0.77rem;
  font-weight: 650;
}

.purchase-record-po {
  color: #1e2227;
  text-decoration-color: rgba(55, 63, 72, 0.26);
}

.purchase-record-card__submeta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.purchase-record-card__submeta-separator {
  color: #8e97a1;
  font-size: 0.7rem;
}

.purchase-record-card__status-wrap {
  justify-self: end;
}

.purchase-record-card--incomplete .status-badge {
  color: #3e454f;
  background: #eceff2;
  border: 1px solid #ccd2d8;
}

.purchase-record-card--received .status-badge {
  color: #5f450f;
  background: rgba(189, 134, 40, 0.2);
  border: 1px solid rgba(189, 134, 40, 0.44);
}

.purchase-record-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  margin-left: 0;
  padding: 7px 12px;

  color: #525a64;
  background: #f4f6f8;
  border: 1px solid #d1d7de;
  border-radius: 999px;

  font-size: 0.67rem;
  font-weight: 700;

  justify-self: end;
}

.purchase-record-toggle__icon {
  font-size: 0.66rem;
}

.purchase-record-toggle:hover,
.purchase-record-toggle:focus-visible {
  color: #4d3910;
  border-color: rgba(189, 134, 40, 0.6);
  background: rgba(189, 134, 40, 0.12);
}

.purchase-record-card__details {
  padding: 0 16px 15px 30px;
}

.purchase-record-lines-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--purchasing-border);
  border-radius: 10px;
}

.purchase-record-lines-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.purchase-record-lines-table th,
.purchase-record-lines-table td {
  padding: 11px;
  border-bottom: 1px solid var(--purchasing-border);

  font-size: 0.71rem;
  line-height: 1.45;
  text-align: left;
  vertical-align: middle;
}

.purchase-record-lines-table th {
  color: var(--purchasing-text-muted);
  background: var(--purchasing-surface-soft);

  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.025em;
}

.purchase-record-lines-table tbody tr:last-child td {
  border-bottom: 0;
}

.purchase-record-lines-table th:nth-child(1),
.purchase-record-lines-table td:nth-child(1) {
  width: 14%;
}

.purchase-record-lines-table th:nth-child(2),
.purchase-record-lines-table td:nth-child(2) {
  width: 40%;
}

.purchase-record-lines-table th:nth-child(3),
.purchase-record-lines-table td:nth-child(3),
.purchase-record-lines-table th:nth-child(4),
.purchase-record-lines-table td:nth-child(4),
.purchase-record-lines-table th:nth-child(5),
.purchase-record-lines-table td:nth-child(5),
.purchase-record-lines-table th:nth-child(6),
.purchase-record-lines-table td:nth-child(6) {
  white-space: nowrap;
}

.purchase-record-lines-table td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.purchase-record-lines-empty {
  padding: 22px !important;
  color: var(--purchasing-text-muted);
  text-align: center !important;
}

.empty-record-state--standalone {
  min-height: 160px;
  padding: 28px;

  border: 1px dashed var(--purchasing-border);
  border-radius: var(--purchasing-radius-medium);
}

/* =========================================================
   START: RESPONSIVE PURCHASE RECORD COLUMNS
========================================================= */

.records-table-wrapper {
  width: 100%;
  overflow-x: hidden;
}

.records-table {
  width: 100%;
  min-width: 0;

  table-layout: fixed;
}

.records-table th,
.records-table td {
  padding: 15px 12px;

  border-bottom: 1px solid var(--purchasing-border);

  font-size: 0.72rem;
  line-height: 1.45;
  text-align: left;
  vertical-align: middle;

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

/*
  Column width distribution
  Total: 100%
*/

.records-table th:nth-child(1),
.records-table td:nth-child(1) {
  width: 8%;
}

.records-table th:nth-child(2),
.records-table td:nth-child(2) {
  width: 10%;
}

.records-table th:nth-child(3),
.records-table td:nth-child(3) {
  width: 12%;
}

.records-table th:nth-child(4),
.records-table td:nth-child(4) {
  width: 25%;
}

.records-table th:nth-child(5),
.records-table td:nth-child(5) {
  width: 9%;
}

.records-table th:nth-child(6),
.records-table td:nth-child(6) {
  width: 6%;
}

.records-table th:nth-child(7),
.records-table td:nth-child(7) {
  width: 5%;
}

.records-table th:nth-child(8),
.records-table td:nth-child(8) {
  width: 9%;
}

.records-table th:nth-child(9),
.records-table td:nth-child(9) {
  width: 6%;
}

.records-table th:nth-child(10),
.records-table td:nth-child(10) {
  width: 10%;
}


/*
  Long text columns may grow vertically.
*/

.records-table td:nth-child(1),
.records-table td:nth-child(2),
.records-table td:nth-child(3),
.records-table td:nth-child(4) {
  white-space: normal;
  overflow-wrap: anywhere;
}


/*
  Compact operational data remains on one line
  whenever enough width is available.
*/

.records-table td:nth-child(5),
.records-table td:nth-child(6),
.records-table td:nth-child(7),
.records-table td:nth-child(8),
.records-table td:nth-child(9),
.records-table td:nth-child(10) {
  white-space: nowrap;
}


/*
  Existing description rule no longer forces
  the entire table to become wider.
*/

.description-cell {
  min-width: 0;
  max-width: none;

  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.part-number,
.po-number,
.po-number-button {
  max-width: 100%;

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* =========================================================
   END: RESPONSIVE PURCHASE RECORD COLUMNS
========================================================= */

.records-table th {
  color: var(--purchasing-text-muted);
  background: var(--purchasing-surface-soft);

  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.025em;
}

.records-table tbody tr:last-child td {
  border-bottom: 0;
}

.records-table tbody tr:not(.empty-record-row):hover {
  background: #fafcfd;
}

.po-number {
  color: var(--purchasing-primary);
  font-weight: 700;
}

.amount-value {
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.part-number {
  color: var(--purchasing-text);
  font-weight: 650;
}

.quantity-value,
.unit-value {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.unit-value {
  color: var(--purchasing-text-secondary);
}

.status-badge,
.workflow-badge {
  display: inline-flex;
  align-items: center;

  padding: 6px 9px;

  border-radius: 999px;

  font-size: 0.64rem;
  font-weight: 700;
}

.status-badge--open {
  color: var(--purchasing-primary-dark);
  background: var(--purchasing-primary-soft);
}

.status-badge--ordered {
  color: var(--purchasing-primary-dark);
  background: rgba(189, 134, 40, 0.16);
  border: 1px solid rgba(189, 134, 40, 0.34);
}

.status-badge--partially-received {
  color: #9c5d10;
  background: rgba(196, 122, 22, 0.16);
  border: 1px solid rgba(174, 109, 24, 0.34);
}

.status-badge--awaiting-inspection {
  color: #8a5a14;
  background: rgba(182, 124, 39, 0.15);
  border: 1px solid rgba(166, 110, 31, 0.34);
}

.status-badge--received {
  color: var(--purchasing-success);
  background: rgba(78, 128, 103, 0.14);
  border: 1px solid rgba(78, 128, 103, 0.3);
}

.status-badge--received-with-overages {
  color: #2f6e60;
  background: rgba(56, 138, 118, 0.15);
  border: 1px solid rgba(56, 138, 118, 0.34);
}

.status-badge--rejected {
  color: var(--purchasing-danger);
  background: rgba(166, 77, 77, 0.14);
  border: 1px solid rgba(166, 77, 77, 0.3);
}

.status-badge--cancelled {
  color: #656a71;
  background: rgba(101, 106, 113, 0.13);
  border: 1px solid rgba(101, 106, 113, 0.3);
}

.workflow-badge {
  color: var(--purchasing-success);
  background: var(--purchasing-success-soft);
}

.empty-record-row td {
  padding: 48px 20px;
}

.empty-record-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  text-align: center;
}

.empty-record-state strong {
  font-size: 0.82rem;
}

.empty-record-state span {
  margin-top: 6px;

  color: var(--purchasing-text-muted);
  font-size: 0.7rem;
}


/* =========================================================
   RESPONSIVE CONTROL
========================================================= */

@media (max-width: 1100px) {
  .intake-layout {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 0.55fr);
  }

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

@media (max-width: 860px) {
  .purchasing-page {
    padding-right: 18px;
    padding-left: 18px;
  }

  .purchasing-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .intake-layout {
    grid-template-columns: 1fr;
  }

  .processing-document {
    grid-template-columns: 1fr;
  }

  .extraction-form {
    grid-template-columns: 1fr;
  }

  .form-field--full {
    grid-column: auto;
  }

  .records-card__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-search {
    width: 100%;
  }

  .purchase-record-card__summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .purchase-record-card__main {
    grid-column: 1 / -1;
  }

  .purchase-record-card__status-wrap {
    justify-self: start;
    margin-left: 56px;
  }

  .purchase-record-toggle {
    justify-self: end;
  }
}

@media (max-width: 560px) {
  .purchasing-page {
    padding-top: 24px;
  }

  .intake-card,
  .processing-panel,
  .review-panel {
    padding: 17px;
  }

  .document-drop-zone {
    min-height: 255px;
    padding: 25px 18px;
  }

  .document-types {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-type-list {
    justify-content: flex-start;
  }

  .processing-steps {
    grid-template-columns: 1fr;
  }

  .review-actions {
    flex-direction: column-reverse;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }
}

/* =========================================================
   PURCHASING CORE — DARK MODE

   Theme control:
   dashboard.js adds/removes body.dark-mode

   Design direction:
   Deep warm charcoal + muted amber accent
========================================================= */


/* =========================================================
   DARK MODE COLOR SYSTEM
========================================================= */

body.dark-mode {
  --purchasing-bg: #211f1a;
  --purchasing-surface: #2a2822;
  --purchasing-surface-soft: #323028;

  --purchasing-border: #454136;
  --purchasing-border-strong: #5b5444;

  --purchasing-text: #f2eee4;
  --purchasing-text-secondary: #c7c0b2;
  --purchasing-text-muted: #968f82;

  --purchasing-primary: #d5a548;
  --purchasing-primary-dark: #e0b45c;
  --purchasing-primary-soft: #413720;

  --purchasing-success: #76af8e;
  --purchasing-success-soft: #263b30;

  --purchasing-warning: #d4a04a;
  --purchasing-warning-soft: #42351f;

  --purchasing-processing: #d7a64e;
  --purchasing-processing-soft: #40361f;

  --purchasing-danger: #e18a84;
  --purchasing-danger-soft: #482a28;

  --purchasing-shadow:
    0 18px 48px rgba(0, 0, 0, 0.32);
}


/* =========================================================
   DARK MODE PAGE FOUNDATION
========================================================= */

body.dark-mode .purchasing-page {
  color: var(--purchasing-text);

  background:
    radial-gradient(
      circle at 8% 0%,
      rgba(203, 153, 55, 0.13),
      transparent 32%
    ),
    radial-gradient(
      circle at 92% 18%,
      rgba(150, 109, 35, 0.08),
      transparent 30%
    ),
    linear-gradient(
      180deg,
      #24211b 0%,
      #1d1c18 100%
    );
}


/* =========================================================
   DARK MODE HEADER
========================================================= */

body.dark-mode .purchasing-header {
  background:
    radial-gradient(
      circle at 35% 0%,
      rgba(218, 166, 67, 0.10),
      transparent 42%
    ),
    linear-gradient(
      110deg,
      #17150f 0%,
      #211b10 50%,
      #12110d 100%
    );

  border-bottom-color: rgba(213, 165, 72, 0.30);

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.38),
    inset 0 -1px 0 rgba(224, 180, 92, 0.12);
}

body.dark-mode .purchasing-header .header-divider {
  background: rgba(224, 180, 92, 0.25);
}

body.dark-mode .purchasing-header .page-title-block h1,
body.dark-mode .purchasing-header .header-date,
body.dark-mode .purchasing-header .header-time,
body.dark-mode .purchasing-header .user-info strong {
  color: #f3eee2;
}

body.dark-mode .purchasing-header .page-title-block p,
body.dark-mode .purchasing-header .user-info p {
  color: rgba(243, 238, 226, 0.62);
}

body.dark-mode .purchasing-header .header-feed {
  border-left-color: rgba(224, 180, 92, 0.16);
  border-right-color: rgba(224, 180, 92, 0.16);
}

body.dark-mode .purchasing-header .feed-track {
  color: #ddb15a;
}

body.dark-mode .purchasing-header .feed-track::before {
  background: #d5a548;

  box-shadow:
    0 0 14px rgba(213, 165, 72, 0.72);
}

body.dark-mode .purchasing-header .header-svg-icon,
body.dark-mode .purchasing-header .user-avatar svg,
body.dark-mode .purchasing-header .chevron-svg {
  color: #d5a548;
  stroke: currentColor;
}

body.dark-mode .purchasing-header .user-avatar {
  color: #d5a548;

  background: rgba(213, 165, 72, 0.10);
  border-color: rgba(213, 165, 72, 0.25);
}

body.dark-mode .purchasing-header .theme-toggle {
  background: rgba(0, 0, 0, 0.30);
  border-color: rgba(213, 165, 72, 0.36);
}

body.dark-mode .purchasing-header .toggle-knob {
  background: #d5a548;

  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

body.dark-mode .purchasing-header .toggle-sun,
body.dark-mode .purchasing-header .toggle-moon {
  color: #f2d38e;
  stroke: currentColor;
}


/* =========================================================
   DARK MODE PAGE HEADING
========================================================= */

body.dark-mode .purchasing-heading h1,
body.dark-mode .section-heading h2,
body.dark-mode .processing-panel__header h2,
body.dark-mode .review-panel__header h2,
body.dark-mode .records-card__header h2 {
  color: var(--purchasing-text);
}

body.dark-mode .purchasing-heading p,
body.dark-mode .review-panel__header p {
  color: var(--purchasing-text-secondary);
}

body.dark-mode .purchasing-heading__status {
  color: #8fc3a3;

  background: rgba(42, 40, 34, 0.88);
  border-color: var(--purchasing-border);

  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.18);
}

body.dark-mode .system-status-dot {
  background: #76af8e;

  box-shadow:
    0 0 0 4px rgba(118, 175, 142, 0.12);
}


/* =========================================================
   DARK MODE MAIN CARDS
========================================================= */

body.dark-mode .intake-card,
body.dark-mode .processing-panel,
body.dark-mode .review-panel,
body.dark-mode .records-card {
  background:
    linear-gradient(
      145deg,
      rgba(45, 42, 35, 0.97),
      rgba(37, 35, 30, 0.97)
    );

  border-color: var(--purchasing-border);

  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}


/* =========================================================
   DARK MODE DOCUMENT DROP ZONE
========================================================= */

body.dark-mode .document-drop-zone {
  color: var(--purchasing-text);

  background:
    linear-gradient(
      145deg,
      rgba(50, 47, 39, 0.96),
      rgba(40, 38, 32, 0.92)
    );

  border-color: #746446;
}

body.dark-mode .document-drop-zone:hover,
body.dark-mode .document-drop-zone:focus-visible,
body.dark-mode .document-drop-zone.is-dragging {
  background:
    linear-gradient(
      145deg,
      rgba(69, 57, 31, 0.95),
      rgba(53, 46, 31, 0.94)
    );

  border-color: var(--purchasing-primary);

  box-shadow:
    inset 0 0 0 1px rgba(213, 165, 72, 0.14),
    0 16px 32px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(213, 165, 72, 0.07);
}

body.dark-mode .document-drop-zone p {
  color: var(--purchasing-text-secondary);
}

body.dark-mode .drop-zone-icon {
  color: var(--purchasing-primary);

  background: #292720;
  border-color: #62583f;

  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.30);
}


/* =========================================================
   DARK MODE BUTTONS
========================================================= */

body.dark-mode .browse-button,
body.dark-mode .primary-action {
  color: #241b0d;

  background: var(--purchasing-primary);
  border-color: var(--purchasing-primary);

  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.24);
}

body.dark-mode .browse-button:hover,
body.dark-mode .primary-action:hover {
  color: #1c160b;

  background: var(--purchasing-primary-dark);
  border-color: var(--purchasing-primary-dark);
}

body.dark-mode .secondary-action {
  color: var(--purchasing-text-secondary);

  background: #302e27;
  border-color: var(--purchasing-border-strong);
}

body.dark-mode .secondary-action:hover {
  color: var(--purchasing-text);

  background: #39362d;
}


/* =========================================================
   DARK MODE FILE AND DOCUMENT TYPE LABELS
========================================================= */

body.dark-mode .supported-file-types span {
  color: var(--purchasing-text-muted);

  background: rgba(36, 34, 29, 0.85);
  border-color: var(--purchasing-border);
}

body.dark-mode .document-type-list span {
  color: var(--purchasing-text-secondary);

  background: var(--purchasing-surface-soft);
  border-color: var(--purchasing-border);
}


/* =========================================================
   DARK MODE INTAKE SUMMARY
========================================================= */

body.dark-mode .summary-metric {
  background:
    linear-gradient(
      145deg,
      #323028,
      #2c2a24
    );

  border-color: var(--purchasing-border);
}

body.dark-mode .summary-metric__label {
  color: var(--purchasing-text-secondary);
}

body.dark-mode .summary-metric strong {
  color: var(--purchasing-text);
}

body.dark-mode .workflow-route {
  color: var(--purchasing-text-muted);
}

body.dark-mode .workflow-route i {
  background: var(--purchasing-border-strong);
}


/* =========================================================
   DARK MODE PROCESSING PANEL
========================================================= */

body.dark-mode .processing-document,
body.dark-mode .processing-step,
body.dark-mode .extracted-line-items {
  background: var(--purchasing-surface-soft);
  border-color: var(--purchasing-border);
}

body.dark-mode .file-icon {
  color: var(--purchasing-primary);

  background: #26241f;
  border-color: var(--purchasing-border);
}

body.dark-mode .processing-document__file strong,
body.dark-mode .processing-step strong {
  color: var(--purchasing-text);
}

body.dark-mode .processing-document__file span,
body.dark-mode .processing-step small {
  color: var(--purchasing-text-muted);
}

body.dark-mode .processing-progress__track {
  background: #191813;
}

body.dark-mode .processing-progress__bar {
  background:
    linear-gradient(
      90deg,
      #b98529,
      #e0b45c
    );
}

body.dark-mode .processing-progress > span {
  color: var(--purchasing-text-secondary);
}

body.dark-mode .processing-step > span {
  color: var(--purchasing-text-secondary);

  background: #26241f;
  border-color: var(--purchasing-border);
}

body.dark-mode .processing-step.is-active {
  background: var(--purchasing-primary-soft);
  border-color: #826934;
}

body.dark-mode .processing-step.is-complete {
  background: var(--purchasing-success-soft);
  border-color: #456550;
}

body.dark-mode .processing-step.is-complete > span {
  color: #f2eee4;

  background: var(--purchasing-success);
  border-color: var(--purchasing-success);
}


/* =========================================================
   DARK MODE REVIEW FORM
========================================================= */

body.dark-mode .form-field label {
  color: var(--purchasing-text-secondary);
}

body.dark-mode .form-field input,
body.dark-mode .form-field select {
  color: var(--purchasing-text);

  background: #24231e;
  border-color: var(--purchasing-border-strong);

  color-scheme: dark;
}

body.dark-mode .form-field input:focus,
body.dark-mode .form-field select:focus {
  border-color: var(--purchasing-primary);

  box-shadow:
    0 0 0 3px rgba(213, 165, 72, 0.13);
}

body.dark-mode .line-items-heading p {
  color: var(--purchasing-text-muted);
}

body.dark-mode .line-items-table th,
body.dark-mode .line-items-table td {
  color: var(--purchasing-text-secondary);
  border-bottom-color: var(--purchasing-border);
}

body.dark-mode .line-items-table th {
  color: var(--purchasing-text-muted);
}

body.dark-mode .line-items-table input {
  color: var(--purchasing-text);

  background: #24231e;
  border-color: var(--purchasing-border-strong);
}

body.dark-mode .line-items-table input:focus {
  border-color: var(--purchasing-primary);

  box-shadow:
    0 0 0 3px rgba(213, 165, 72, 0.13);
}

body.dark-mode .part-number {
  color: var(--purchasing-text);
}

body.dark-mode .unit-value {
  color: var(--purchasing-text-secondary);
}

/* =========================================================
   DARK MODE RECENT PURCHASE RECORDS
========================================================= */

body.dark-mode .records-card__header {
  border-bottom-color: var(--purchasing-border);
}

body.dark-mode .record-search {
  background: #24231e;
  border-color: var(--purchasing-border);
}

body.dark-mode .record-search span {
  color: var(--purchasing-text-muted);
}

body.dark-mode .record-search input {
  color: var(--purchasing-text);
}

body.dark-mode .record-search input::placeholder {
  color: #7f786c;
}

body.dark-mode .records-table th {
  color: var(--purchasing-text-muted);

  background: #302e27;
  border-bottom-color: var(--purchasing-border);
}

body.dark-mode .records-table td {
  color: var(--purchasing-text-secondary);
  border-bottom-color: var(--purchasing-border);
}

body.dark-mode .records-table tbody tr:not(.empty-record-row):hover {
  background: rgba(213, 165, 72, 0.045);
}

body.dark-mode .purchase-record-card {
  background: rgba(49, 46, 39, 0.95);
  border-color: rgba(117, 110, 97, 0.75);
}

body.dark-mode .purchase-record-card::before {
  background: #6e747d;
}

body.dark-mode .purchase-record-card--incomplete:hover {
  border-color: rgba(208, 157, 66, 0.7);
}

body.dark-mode .purchase-record-card--incomplete:hover::before,
body.dark-mode .purchase-record-card--received::before {
  background: #c99741;
}

body.dark-mode .purchase-record-card--received {
  border-color: rgba(208, 157, 66, 0.75);
  box-shadow:
    0 8px 24px rgba(208, 157, 66, 0.22),
    0 0 0 1px rgba(208, 157, 66, 0.32);
}

body.dark-mode .purchase-record-card__vendor,
body.dark-mode .purchase-record-card__date,
body.dark-mode .purchase-record-card__count {
  color: var(--purchasing-text-secondary);
}

body.dark-mode .purchase-record-po {
  color: #f4efe2;
  text-decoration-color: rgba(244, 239, 226, 0.35);
}

body.dark-mode .purchase-record-card__submeta-separator {
  color: #8f887c;
}

body.dark-mode .purchase-record-card__document-icon {
  color: #dbd6c9;
  background: #3c3a32;
  border-color: #6b6659;
}

body.dark-mode .purchase-record-card__document-icon::after {
  background: linear-gradient(135deg, #4d493f 50%, #3c3a32 50%);
  border-left-color: #6b6659;
  border-bottom-color: #6b6659;
}

body.dark-mode .purchase-record-card__received-icon-image {
  display: block;
}

body.dark-mode .purchase-record-card--incomplete .status-badge {
  color: #ece6db;
  background: #3a372f;
  border-color: #6b6659;
}

body.dark-mode .purchase-record-card--received .status-badge {
  color: #f6dfac;
  background: rgba(208, 157, 66, 0.2);
  border-color: rgba(208, 157, 66, 0.5);
}

body.dark-mode .purchase-record-toggle {
  color: #ddd7cb;
  background: #36332c;
  border-color: #696354;
}

body.dark-mode .purchase-record-toggle:hover,
body.dark-mode .purchase-record-toggle:focus-visible {
  color: #f2daa6;
  background: rgba(208, 157, 66, 0.16);
  border-color: rgba(208, 157, 66, 0.6);
}

body.dark-mode .purchase-record-lines-table-wrapper {
  border-color: var(--purchasing-border);
}

body.dark-mode .purchase-record-lines-table th {
  color: var(--purchasing-text-muted);
  background: #302e27;
  border-bottom-color: var(--purchasing-border);
}

body.dark-mode .purchase-record-lines-table td {
  color: var(--purchasing-text-secondary);
  border-bottom-color: var(--purchasing-border);
}

body.dark-mode .purchase-record-lines-empty {
  color: var(--purchasing-text-muted);
}

body.dark-mode .empty-record-state--standalone {
  border-color: var(--purchasing-border);
}

body.dark-mode .po-number {
  color: #e1b45c;
}

body.dark-mode .empty-record-state strong {
  color: var(--purchasing-text);
}

body.dark-mode .empty-record-state span {
  color: var(--purchasing-text-muted);
}


/* =========================================================
   DARK MODE STATUS BADGES
========================================================= */

body.dark-mode .processing-status {
  color: #e0b45c;
  background: var(--purchasing-processing-soft);
}

body.dark-mode .review-badge {
  color: #e0b45c;
  background: var(--purchasing-warning-soft);
}

body.dark-mode .status-badge--open {
  color: #e0b45c;
  background: #413720;
}

body.dark-mode .status-badge--ordered {
  color: #d8ba7f;
  background: rgba(168, 119, 46, 0.24);
  border-color: rgba(200, 156, 84, 0.34);
}

body.dark-mode .status-badge--partially-received {
  color: #e0ad63;
  background: rgba(164, 100, 25, 0.3);
  border-color: rgba(214, 138, 49, 0.38);
}

body.dark-mode .status-badge--awaiting-inspection {
  color: #dfb076;
  background: rgba(141, 94, 33, 0.3);
  border-color: rgba(196, 133, 59, 0.38);
}

body.dark-mode .status-badge--received {
  color: #9cd0b8;
  background: rgba(74, 123, 101, 0.28);
  border-color: rgba(99, 163, 133, 0.4);
}

body.dark-mode .status-badge--received-with-overages {
  color: #8dd0c0;
  background: rgba(47, 113, 98, 0.3);
  border-color: rgba(74, 156, 136, 0.42);
}

body.dark-mode .status-badge--rejected {
  color: #df9a9a;
  background: rgba(126, 65, 65, 0.28);
  border-color: rgba(180, 90, 90, 0.38);
}

body.dark-mode .status-badge--cancelled {
  color: #b2b7bf;
  background: rgba(104, 111, 121, 0.24);
  border-color: rgba(130, 138, 149, 0.36);
}

body.dark-mode .workflow-badge {
  color: #8fc3a3;
  background: var(--purchasing-success-soft);
}

/* =========================================================
   START: ORIGINAL DOCUMENT VIEWER
========================================================= */

body.purchase-viewer-open {
  overflow: hidden;
}

.purchase-viewer[hidden] {
  display: none;
}

.purchase-viewer {
  position: fixed;
  z-index: 5000;
  inset: 0;

  display: grid;
  place-items: center;

  padding: 24px;
}

.purchase-viewer__backdrop {
  position: absolute;
  inset: 0;

  background: rgba(20, 20, 17, 0.72);
  backdrop-filter: blur(8px);
}

.purchase-viewer__dialog {
  position: relative;
  z-index: 1;

  display: flex;
  width: min(1600px, 100%);
  max-height: calc(100vh - 48px);
  flex-direction: column;

  overflow: hidden;

  color: var(--purchasing-text);
  background: var(--purchasing-bg);
  border: 1px solid var(--purchasing-border-strong);
  border-radius: 20px;

  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.28);
}

.purchase-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;

  padding: 21px 24px;

  background: var(--purchasing-surface);
  border-bottom: 1px solid var(--purchasing-border);
}

.purchase-viewer__header h2 {
  margin: 0;

  color: var(--purchasing-text);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.purchase-viewer__header p {
  margin: 6px 0 0;

  color: var(--purchasing-text-secondary);
  font-size: 0.78rem;
}

.purchase-viewer__close {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;

  color: var(--purchasing-text-secondary);
  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 10px;
}

.purchase-viewer__close:hover {
  color: var(--purchasing-text);
  border-color: var(--purchasing-border-strong);
}

.purchase-viewer__close svg {
  width: 19px;
  height: 19px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.purchase-viewer__loading,
.purchase-viewer__error {
  display: flex;
  min-height: 440px;
  align-items: center;
  justify-content: center;
  flex-direction: column;

  padding: 50px;

  text-align: center;
}

.purchase-viewer__loading[hidden],
.purchase-viewer__error[hidden],
.purchase-viewer__content[hidden] {
  display: none;
}

.purchase-viewer__loading strong,
.purchase-viewer__error strong {
  margin-top: 16px;

  font-size: 0.95rem;
}

.purchase-viewer__loading p,
.purchase-viewer__error p {
  max-width: 460px;
  margin: 7px 0 0;

  color: var(--purchasing-text-secondary);
  font-size: 0.78rem;
  line-height: 1.6;
}

.purchase-viewer__error strong {
  color: var(--purchasing-danger);
}

.purchase-viewer__spinner {
  width: 34px;
  height: 34px;

  border: 3px solid var(--purchasing-border);
  border-top-color: var(--purchasing-primary);
  border-radius: 50%;

  animation: purchaseViewerSpin 800ms linear infinite;
}

@keyframes purchaseViewerSpin {
  to {
    transform: rotate(360deg);
  }
}

.purchase-viewer__content {
  overflow-y: auto;
  padding: 22px;
}

.purchase-viewer__comparison {
  display: grid;
  grid-template-columns:
    minmax(0, 1.35fr)
    minmax(360px, 0.65fr);
  gap: 20px;
}

.purchase-viewer__document-panel,
.purchase-viewer__extraction-panel,
.purchase-viewer__line-items {
  min-width: 0;
  padding: 19px;

  background: var(--purchasing-surface);
  border: 1px solid var(--purchasing-border);
  border-radius: 15px;

  box-shadow:
    0 12px 28px rgba(45, 40, 28, 0.055);
}

.viewer-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  margin-bottom: 15px;
}

.viewer-panel-heading h3 {
  margin: 0;

  color: var(--purchasing-text);
  font-size: 0.97rem;
  font-weight: 690;
}

.viewer-document-open {
  padding: 8px 11px;
  color: var(--purchasing-primary-dark);
  text-decoration: none;

  background: var(--purchasing-primary-soft);
  border: 1px solid rgba(189, 134, 40, 0.28);
  border-radius: 7px;

  font-size: 0.7rem;
  font-weight: 680;
}

.viewer-document-open:hover {
  border-color: var(--purchasing-primary);
}

.viewer-document-frame {
  display: grid;
  min-height: 610px;
  place-items: center;

  overflow: hidden;

  color: var(--purchasing-text-muted);
  background: #e9e9e5;
  border: 1px solid var(--purchasing-border);
  border-radius: 10px;
}

.viewer-document-frame iframe {
  display: block;
  width: 100%;
  height: 610px;

  border: 0;
}

.viewer-document-frame img {
  display: block;
  max-width: 100%;
  max-height: 610px;

  object-fit: contain;
}

.viewer-document-unsupported {
  max-width: 390px;
  padding: 30px;

  text-align: center;
}

.viewer-document-unsupported strong {
  display: block;

  color: var(--purchasing-text);
}

.viewer-document-unsupported p {
  margin: 8px 0 0;

  color: var(--purchasing-text-secondary);
  font-size: 0.76rem;
  line-height: 1.6;
}

.viewer-file-meta {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.7fr;
  gap: 10px;

  margin-top: 12px;
}

.viewer-file-meta div,
.viewer-summary-field {
  min-width: 0;
  padding: 11px 12px;

  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 9px;
}

.viewer-file-meta span,
.viewer-summary-field span,
.viewer-storage-path > span {
  display: block;
  margin-bottom: 6px;

  color: var(--purchasing-text-muted);
  font-size: 0.63rem;
  font-weight: 680;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.viewer-file-meta strong,
.viewer-summary-field strong {
  display: block;

  overflow: hidden;

  color: var(--purchasing-text);
  font-size: 0.76rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.viewer-storage-path {
  margin-top: 12px;
  padding: 12px;

  background: var(--purchasing-surface-soft);
  border: 1px solid var(--purchasing-border);
  border-radius: 9px;
}

.viewer-storage-path code {
  display: block;

  overflow-wrap: anywhere;

  color: var(--purchasing-text-secondary);
  font-size: 0.68rem;
  line-height: 1.55;
}

.purchase-viewer__line-items {
  margin-top: 20px;
}

.viewer-line-count {
  padding: 6px 9px;

  color: var(--purchasing-primary-dark);
  background: var(--purchasing-primary-soft);
  border-radius: 999px;

  font-size: 0.67rem;
  font-weight: 700;
}

.viewer-line-table-wrapper {
  overflow-x: auto;

  border: 1px solid var(--purchasing-border);
  border-radius: 10px;
}

.viewer-line-table {
  width: 100%;
  min-width: 780px;

  border-collapse: collapse;
}

.viewer-line-table th,
.viewer-line-table td {
  padding: 11px 12px;

  text-align: left;
  vertical-align: middle;

  border-bottom: 1px solid var(--purchasing-border);
}

.viewer-line-table th {
  color: var(--purchasing-text-muted);
  background: var(--purchasing-surface-soft);

  font-size: 0.64rem;
  font-weight: 730;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.viewer-line-table td {
  color: var(--purchasing-text-secondary);
  font-size: 0.75rem;
}

.viewer-line-table tbody tr:last-child td {
  border-bottom: 0;
}

.viewer-line-table-empty {
  padding: 35px !important;

  color: var(--purchasing-text-muted) !important;
  text-align: center !important;
}

.po-number-button {
  padding: 0;

  color: var(--purchasing-primary-dark);
  text-align: left;

  background: transparent;
  border: 0;

  font: inherit;
  font-weight: 720;
  text-decoration: underline;
  text-decoration-color: rgba(147, 101, 28, 0.35);
  text-underline-offset: 3px;
}

.po-number-button:hover,
.po-number-button:focus-visible {
  color: var(--purchasing-primary);
  text-decoration-color: currentColor;
}

@media (max-width: 1100px) {
  .purchase-viewer__comparison {
    grid-template-columns: 1fr;
  }

  .viewer-document-frame,
  .viewer-document-frame iframe {
    min-height: 520px;
    height: 520px;
  }
}

@media (max-width: 720px) {
  .purchase-viewer {
    padding: 0;
  }

  .purchase-viewer__dialog {
    width: 100%;
    max-height: 100vh;

    border-radius: 0;
  }

  .purchase-viewer__header {
    padding: 17px;
  }

  .purchase-viewer__content {
    padding: 14px;
  }

  .purchase-viewer__document-panel,
  .purchase-viewer__extraction-panel,
  .purchase-viewer__line-items {
    padding: 14px;
  }

  .viewer-summary-grid,
  .viewer-file-meta {
    grid-template-columns: 1fr;
  }

  .viewer-document-frame,
  .viewer-document-frame iframe {
    min-height: 430px;
    height: 430px;
  }
}

/* =========================================================
   END: ORIGINAL DOCUMENT VIEWER
========================================================= */

/* =========================================================
   START: PURCHASING COMPACT HEADER AND MAIN LAYOUT
========================================================= */


/* ---------------------------------------------------------
   Header center:
   Reserve this area for the future ROUTIQ AI character button.
   Existing live-feed text remains hidden for JS compatibility.
--------------------------------------------------------- */

.purchasing-header .purchasing-ai-slot {
  display: flex;
  min-width: 90px;
  min-height: 42px;
  align-items: center;
  justify-content: center;

  color: transparent;
}

.purchasing-header
.purchasing-ai-slot
.feed-track[hidden] {
  display: none !important;
}


/* ---------------------------------------------------------
   Main page:
   Reduce the blank space directly below the header.
--------------------------------------------------------- */

.purchasing-page {
  padding-top: 16px;
}


/* ---------------------------------------------------------
   Compact introduction:
   Keep only the operational description and status.
--------------------------------------------------------- */

.purchasing-heading--compact {
  align-items: center;

  margin-bottom: 14px;
}

.purchasing-heading--compact
.purchasing-heading__content {
  min-width: 0;
}

.purchasing-heading--compact
.purchasing-heading__content p {
  max-width: 680px;
  margin: 0;

  font-size: 0.88rem;
  line-height: 1.45;
}


/* ---------------------------------------------------------
   Dark mode:
   Preserve the compact introduction text color.
--------------------------------------------------------- */

body.dark-mode
.purchasing-heading--compact
.purchasing-heading__content p {
  color: var(--purchasing-text-secondary);
}


/* ---------------------------------------------------------
   Responsive layout
--------------------------------------------------------- */

@media (max-width: 860px) {
  .purchasing-page {
    padding-top: 14px;
  }

  .purchasing-heading--compact {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;

    margin-bottom: 14px;
  }
}

@media (max-width: 560px) {
  .purchasing-page {
    padding-top: 12px;
  }

  .purchasing-heading--compact
  .purchasing-heading__content p {
    font-size: 0.82rem;
  }

  .purchasing-heading--compact
  .purchasing-heading__status {
    padding: 8px 11px;

    font-size: 0.7rem;
  }
}


/* =========================================================
   END: PURCHASING COMPACT HEADER AND MAIN LAYOUT
========================================================= */
/* =========================================================
   START: ORBI PURCHASING AI HEADER BUTTON
========================================================= */


/* ---------------------------------------------------------
   Header center slot
--------------------------------------------------------- */

.purchasing-header .purchasing-ai-slot {
  display: flex;
  min-width: 310px;
  min-height: 70px;
  align-items: center;
  justify-content: center;
  gap: 18px;

  overflow: visible;
  color: inherit;
}

/* ---------------------------------------------------------
   Orbi assistant labels
--------------------------------------------------------- */

.orbi-agent-label {
  display: inline-flex;
  align-items: center;

  line-height: 1;
  white-space: nowrap;

  pointer-events: none;
  user-select: none;
}

.orbi-agent-label--role {
  color: rgba(247, 243, 232, 0.62);

  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.orbi-agent-label--action {
  color: #f2c664;

  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.015em;
}

body.dark-mode
.purchasing-header
.orbi-agent-label--role {
  color: rgba(243, 238, 226, 0.55);
}

body.dark-mode
.purchasing-header
.orbi-agent-label--action {
  color: #e4b85e;
}
/* ---------------------------------------------------------
   Orbi button
--------------------------------------------------------- */

.orbi-agent-button {
  position: relative;

  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;

  padding: 0;

  overflow: hidden;

  appearance: none;
  outline: none;

  background:
    linear-gradient(
      145deg,
      rgba(31, 25, 15, 0.98),
      rgba(13, 11, 8, 0.98)
    );

  border: 1px solid rgba(232, 180, 69, 0.62);
  border-radius: 18px;

  box-shadow:
    0 7px 18px rgba(12, 9, 4, 0.34),
    0 0 0 rgba(224, 173, 75, 0),
    inset 0 1px 0 rgba(255, 232, 176, 0.13);

  cursor: pointer;

  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}


/* ---------------------------------------------------------
   Orbi image
--------------------------------------------------------- */

.orbi-agent-button__image {
    display: block;

    width: 62px;
    height: 62px;

    object-fit: cover;
    object-position: center;

    border-radius: 15px;

    pointer-events: none;
    user-select: none;

    transition:
        transform 180ms ease,
        filter 180ms ease;
}
/* ---------------------------------------------------------
   Mini Analyzer Light
--------------------------------------------------------- */

.orbi-agent-button__analyzer-light {
    position: absolute;

    top: 8px;
    left: 50%;

    width: 5px;
    height: 5px;

    background: #ffd75a;
    border-radius: 50%;

    opacity: .25;

    transform: translateX(-50%);

    pointer-events: none;

    transition:
        opacity .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.orbi-agent-button:hover
.orbi-agent-button__analyzer-light {

    opacity: 1;

    transform:
        translateX(-50%)
        scale(1.3);

    box-shadow:
        0 0 5px rgba(255,220,110,.95),
        0 0 12px rgba(255,195,47,.9),
        0 0 18px rgba(255,170,0,.55);

    animation:
        orbiAnalyzerPulse
        1.2s
        ease-in-out
        infinite;
}

@keyframes orbiAnalyzerPulse {

    0%,
    100%{

        opacity:.7;
    }

    50%{

        opacity:1;
    }

}
/* ---------------------------------------------------------
   Online status indicator
--------------------------------------------------------- */

.orbi-agent-button__status {
  position: absolute;
  top: 3px;
  right: 3px;

  width: 8px;
  height: 8px;

  background: #62c47d;
  border: 2px solid #2a2112;
  border-radius: 50%;

  box-shadow:
    0 0 0 2px rgba(98, 196, 125, 0.10),
    0 0 8px rgba(98, 196, 125, 0.65);

  pointer-events: none;
}


/* ---------------------------------------------------------
   Hover
--------------------------------------------------------- */

.orbi-agent-button:hover {
  border-color: rgba(248, 196, 83, 0.94);

  box-shadow:
    0 9px 22px rgba(12, 9, 4, 0.42),
    0 0 18px rgba(224, 173, 75, 0.30),
    inset 0 1px 0 rgba(255, 235, 189, 0.18);

  transform:
    translateY(-2px)
    scale(1.055);
}

.orbi-agent-button:hover
.orbi-agent-button__image {
  filter: brightness(1.07);
  transform: scale(1.035);
}


/* ---------------------------------------------------------
   Keyboard focus
--------------------------------------------------------- */

.orbi-agent-button:focus-visible {
  border-color: #f1c263;

  box-shadow:
    0 0 0 3px rgba(241, 194, 99, 0.24),
    0 9px 22px rgba(12, 9, 4, 0.42),
    0 0 18px rgba(224, 173, 75, 0.25);
}


/* ---------------------------------------------------------
   Click
--------------------------------------------------------- */

.orbi-agent-button:active {
  box-shadow:
    0 4px 11px rgba(12, 9, 4, 0.35),
    0 0 10px rgba(224, 173, 75, 0.22),
    inset 0 2px 5px rgba(0, 0, 0, 0.26);

  transform: translateY(0) scale(0.96);
}

.orbi-agent-button:active
.orbi-agent-button__image {
  transform: scale(0.98);
}


/* ---------------------------------------------------------
   Subtle idle animation
--------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .orbi-agent-button__status {
    animation:
      orbi-status-pulse 2.8s ease-in-out infinite;
  }
}

@keyframes orbi-status-pulse {
  0%,
  100% {
    opacity: 0.78;

    box-shadow:
      0 0 0 2px rgba(98, 196, 125, 0.08),
      0 0 5px rgba(98, 196, 125, 0.42);
  }

  50% {
    opacity: 1;

    box-shadow:
      0 0 0 3px rgba(98, 196, 125, 0.12),
      0 0 10px rgba(98, 196, 125, 0.72);
  }
}


/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */

@media (max-width: 860px) {
  .purchasing-header .purchasing-ai-slot {
    min-width: 62px;
  }

  .orbi-agent-button {
    width: 46px;
    height: 46px;

    border-radius: 13px;
  }

  .orbi-agent-button__image {
  display: block;

  width: 62px;
  height: 62px;

  object-fit: cover;
  object-position: center;

  border-radius: 15px;

  pointer-events: none;
  user-select: none;

  transition:
    transform 180ms ease,
    filter 180ms ease;
}
}


/* =========================================================
   END: ORBI PURCHASING AI HEADER BUTTON
========================================================= */
/* =========================================================
   START: ORBI LIVING BUTTON ANIMATION
========================================================= */


/* ---------------------------------------------------------
   Hover movement
--------------------------------------------------------- */

.orbi-agent-button:hover {
  border-color: rgba(248, 196, 83, 0.96);

  box-shadow:
    0 11px 25px rgba(12, 9, 4, 0.44),
    0 0 22px rgba(224, 173, 75, 0.38),
    inset 0 1px 0 rgba(255, 235, 189, 0.20);

  transform:
    translateY(-2px)
    scale(1.055);
}

.orbi-agent-button:hover
.orbi-agent-button__image {
  filter:
    brightness(1.1)
    saturate(1.08);

  transform: scale(1.045);
}


/* ---------------------------------------------------------
   Mini Analyzer light

   This small light sits over the analyzer at the
   top center of the source image.
--------------------------------------------------------- */

.orbi-agent-button__analyzer-light {
  position: absolute;
  z-index: 4;

  top: 7px;
  left: 50%;

  width: 5px;
  height: 5px;

  opacity: 0.25;
  background: #ffd75a;
  border-radius: 50%;

  box-shadow:
    0 0 3px rgba(255, 215, 90, 0.25);

  pointer-events: none;

  transform: translateX(-50%);

  transition:
    opacity 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.orbi-agent-button:hover
.orbi-agent-button__analyzer-light {
  opacity: 1;

  box-shadow:
    0 0 4px rgba(255, 224, 117, 0.95),
    0 0 9px rgba(255, 195, 47, 0.92),
    0 0 15px rgba(255, 179, 0, 0.60);

  transform:
    translateX(-50%)
    scale(1.25);

  animation:
    orbi-analyzer-pulse
    1.35s
    ease-in-out
    infinite;
}


/* ---------------------------------------------------------
   Eye blink overlay container

   Coordinates are based on the current square Orbi icon.
--------------------------------------------------------- */

.orbi-agent-button__blink {
  position: absolute;
  z-index: 3;

  inset: 0;

  overflow: hidden;

  pointer-events: none;
}

.orbi-agent-button__eyelid {
  position: absolute;

  top: 31px;

  width: 6px;
  height: 15px;

  opacity: 0;

  background:
    linear-gradient(
      180deg,
      #050505 0%,
      #080808 100%
    );

  border-radius: 999px;

  box-shadow:
    0 0 3px rgba(0, 0, 0, 0.95);

  transform:
    scaleY(0)
    translateZ(0);

  transform-origin: center;
}

.orbi-agent-button__eyelid--left {
  left: 25px;
}

.orbi-agent-button__eyelid--right {
  right: 25px;
}


/* Blink only while the user is interacting with Orbi */

.orbi-agent-button:hover
.orbi-agent-button__eyelid,
.orbi-agent-button:focus-visible
.orbi-agent-button__eyelid {
  animation:
    orbi-eye-blink
    3.1s
    ease-in-out
    infinite;
}


/* ---------------------------------------------------------
   Online status remains above every layer
--------------------------------------------------------- */

.orbi-agent-button__status {
  z-index: 6;
}


/* ---------------------------------------------------------
   Animation keyframes
--------------------------------------------------------- */

@keyframes orbi-eye-blink {
  0%,
  42%,
  46%,
  75%,
  79%,
  100% {
    opacity: 0;

    transform: scaleY(0);
  }

  43%,
  45%,
  76%,
  78% {
    opacity: 1;

    transform: scaleY(1);
  }
}

@keyframes orbi-analyzer-pulse {
  0%,
  100% {
    opacity: 0.65;

    box-shadow:
      0 0 3px rgba(255, 224, 117, 0.70),
      0 0 7px rgba(255, 195, 47, 0.55);
  }

  50% {
    opacity: 1;

    box-shadow:
      0 0 5px rgba(255, 235, 151, 1),
      0 0 11px rgba(255, 195, 47, 0.95),
      0 0 18px rgba(255, 179, 0, 0.72);
  }
}


/* ---------------------------------------------------------
   Reduced-motion accessibility
--------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .orbi-agent-button,
  .orbi-agent-button__image,
  .orbi-agent-button__analyzer-light {
    transition: none;
  }

  .orbi-agent-button:hover {
    transform: none;
  }

  .orbi-agent-button:hover
  .orbi-agent-button__image {
    transform: none;
  }

  .orbi-agent-button:hover
  .orbi-agent-button__eyelid,
  .orbi-agent-button:focus-visible
  .orbi-agent-button__eyelid,
  .orbi-agent-button:hover
  .orbi-agent-button__analyzer-light {
    animation: none;
  }
}


/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */

@media (max-width: 860px) {
  .purchasing-header .purchasing-ai-slot {
    min-width: 78px;
    min-height: 62px;
  }

  .orbi-agent-button {
    width: 58px;
    height: 58px;

    border-radius: 16px;
  }

  .orbi-agent-button__image {
    width: 52px;
    height: 52px;

    border-radius: 13px;
  }

  .orbi-agent-button__analyzer-light {
    top: 6px;

    width: 4px;
    height: 4px;
  }

  .orbi-agent-button__eyelid {
    top: 27px;

    width: 5px;
    height: 13px;
  }

  .orbi-agent-button__eyelid--left {
    left: 21px;
  }

  .orbi-agent-button__eyelid--right {
    right: 21px;
  }
}


/* =========================================================
   END: ORBI LIVING BUTTON ANIMATION
========================================================= */
/* =========================================================
   START: ORBI PURCHASING WORKSPACE PANEL
========================================================= */

:root {
  --orbi-panel-width: min(430px, 36vw);
  --orbi-panel-bg: #111312;
  --orbi-panel-surface: #191c1a;
  --orbi-panel-border: rgba(239, 184, 61, 0.2);
  --orbi-panel-text: #f6f3ea;
  --orbi-panel-muted: rgba(246, 243, 234, 0.62);
  --orbi-panel-amber: #f0b72f;
}


/* ---------------------------------------------------------
   Workspace shell
--------------------------------------------------------- */

.orbi-workspace-panel {
  position: fixed;
  z-index: 1200;
  top: 0;
  right: 0;
  bottom: 0;

  width: var(--orbi-panel-width);
  min-width: 360px;

  color: var(--orbi-panel-text);
  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(240, 183, 47, 0.12),
      transparent 32%
    ),
    var(--orbi-panel-bg);

  border-left: 1px solid var(--orbi-panel-border);

  box-shadow:
    -18px 0 48px rgba(8, 9, 8, 0.24);

  transform: translateX(100%);
  visibility: hidden;

  transition:
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 360ms step-end;
}

body.orbi-workspace-open .orbi-workspace-panel {
  transform: translateX(0);
  visibility: visible;

  transition:
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0ms step-start;
}

.orbi-workspace-panel__inner {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;

  height: 100%;
}


/* ---------------------------------------------------------
   Panel header
--------------------------------------------------------- */

.orbi-workspace-panel__header {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 14px 18px;

  background: rgba(12, 14, 13, 0.94);
  border-bottom: 1px solid var(--orbi-panel-border);
}

.orbi-workspace-panel__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.orbi-workspace-panel__q-symbol {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;

  color: #111312;
  background:
    linear-gradient(
      145deg,
      #ffd568,
      var(--orbi-panel-amber)
    );

  border: 1px solid rgba(255, 221, 133, 0.75);
  border-radius: 12px;

  box-shadow:
    0 8px 20px rgba(240, 183, 47, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);

}

.orbi-workspace-panel__q-symbol img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.orbi-workspace-panel__identity span {
  display: block;

  margin-bottom: 3px;

  color: var(--orbi-panel-amber);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.orbi-workspace-panel__identity h2 {
  margin: 0;

  color: var(--orbi-panel-text);
  font-size: 0.96rem;
  font-weight: 700;
}

.orbi-workspace-panel__close {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;

  padding: 0;

  color: rgba(246, 243, 234, 0.68);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;

  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.orbi-workspace-panel__close:hover {
  color: var(--orbi-panel-text);
  background: rgba(240, 183, 47, 0.1);
  border-color: rgba(240, 183, 47, 0.35);
}

.orbi-workspace-panel__close svg {
  width: 18px;
  height: 18px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}


/* ---------------------------------------------------------
   Orbi desk hero
--------------------------------------------------------- */

.orbi-workspace-hero {
  position: relative;

  min-height: 230px;
  overflow: hidden;

  background:
    linear-gradient(
      145deg,
      #1e1d18,
      #0e100f
    );

  border-bottom: 1px solid var(--orbi-panel-border);
}

.orbi-workspace-hero::after {
  position: absolute;
  inset: 0;

  content: "";

  pointer-events: none;

  background:
    linear-gradient(
      to top,
      rgba(8, 9, 8, 0.94) 0%,
      rgba(8, 9, 8, 0.25) 52%,
      rgba(8, 9, 8, 0.05) 100%
    );
}

.orbi-workspace-hero__image {
  display: block;
  width: 100%;
  height: 230px;

  object-fit: cover;
  object-position: center;

  filter:
    saturate(0.92)
    contrast(1.04);
}

.orbi-workspace-hero__overlay {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: 15px;
  left: 16px;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.orbi-workspace-hero__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  margin-bottom: 7px;

  color: rgba(246, 243, 234, 0.74);
  font-size: 0.67rem;
  font-weight: 650;
}

.orbi-workspace-hero__status i {
  width: 7px;
  height: 7px;

  background: #62c98b;
  border-radius: 50%;

  box-shadow:
    0 0 0 4px rgba(98, 201, 139, 0.12);
}

.orbi-workspace-hero__overlay h3 {
  margin: 0;

  color: #ffffff;
  font-size: 1.28rem;
  font-weight: 750;
}

.orbi-workspace-hero__overlay p {
  margin: 3px 0 0;

  color: rgba(255, 255, 255, 0.67);
  font-size: 0.72rem;
}

.orbi-workspace-hero__q-mark {
  color: rgba(240, 183, 47, 0.92);

  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.1em;

  text-shadow:
    0 0 18px rgba(240, 183, 47, 0.3);
}


/* ---------------------------------------------------------
   Conversation
--------------------------------------------------------- */

.orbi-conversation {
  min-height: 0;
  overflow-y: auto;

  padding: 18px;

  scrollbar-color:
    rgba(240, 183, 47, 0.3)
    transparent;
}

.orbi-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  margin-bottom: 14px;
}

.orbi-message__avatar {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;

  color: #121310;
  background: var(--orbi-panel-amber);
  border-radius: 9px;

  font-size: 0.85rem;
  font-weight: 900;
}

.orbi-message__content {
  max-width: 82%;
  padding: 11px 13px;

  background: var(--orbi-panel-surface);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 4px 14px 14px 14px;
}

.orbi-message__content span {
  display: block;

  margin-bottom: 5px;

  color: var(--orbi-panel-amber);
  font-size: 0.64rem;
  font-weight: 750;
}

.orbi-message__content p {
  margin: 0;

  color: rgba(246, 243, 234, 0.86);
  font-size: 0.76rem;
  line-height: 1.55;
}


/* ---------------------------------------------------------
   Composer
--------------------------------------------------------- */

.orbi-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 9px;

  padding: 14px 16px 16px;

  background: rgba(12, 14, 13, 0.96);
  border-top: 1px solid var(--orbi-panel-border);
}

.orbi-composer__field {
  display: block;
  min-width: 0;
}

.orbi-composer textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  max-height: 120px;

  padding: 11px 13px;

  resize: none;

  color: var(--orbi-panel-text);
  outline: none;
  background: #1b1e1c;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;

  font-size: 0.76rem;
  line-height: 1.45;

  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.orbi-composer textarea::placeholder {
  color: rgba(246, 243, 234, 0.38);
}

.orbi-composer textarea:focus {
  border-color: rgba(240, 183, 47, 0.46);

  box-shadow:
    0 0 0 3px rgba(240, 183, 47, 0.08);
}

.orbi-composer__send {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;

  padding: 0;

  color: #151711;
  background:
    linear-gradient(
      145deg,
      #ffd36a,
      var(--orbi-panel-amber)
    );

  border: 1px solid rgba(255, 220, 132, 0.65);
  border-radius: 11px;
}

.orbi-composer__send svg {
  width: 18px;
  height: 18px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}


/* ---------------------------------------------------------
   Active header button
--------------------------------------------------------- */

body.orbi-workspace-open
.orbi-agent-button {
  border-color: rgba(255, 210, 112, 0.95);

  box-shadow:
    0 8px 22px rgba(11, 8, 3, 0.38),
    0 0 22px rgba(240, 183, 47, 0.28),
    inset 0 1px 0 rgba(255, 236, 189, 0.2);
}


/* ---------------------------------------------------------
   Responsive protection
--------------------------------------------------------- */

@media (max-width: 1100px) {
  :root {
    --orbi-panel-width: min(410px, 44vw);
  }
}

@media (max-width: 820px) {
  :root {
    --orbi-panel-width: 100vw;
  }

  .orbi-workspace-panel {
    min-width: 0;
  }

}
/* ---------------------------------------------------------
   Orbi live conversation states
--------------------------------------------------------- */

.orbi-message--user {
  justify-content: flex-end;
}

.orbi-message--user
.orbi-message__content {
  max-width: 84%;

  background:
    rgba(240, 183, 47, 0.13);

  border-color:
    rgba(240, 183, 47, 0.24);

  border-radius:
    14px 4px 14px 14px;
}

.orbi-message--user
.orbi-message__content span {
  color:
    rgba(246, 243, 234, 0.54);

  text-align: right;
}

.orbi-message--error
.orbi-message__content {
  background:
    rgba(207, 78, 62, 0.1);

  border-color:
    rgba(207, 78, 62, 0.3);
}

.orbi-message--error
.orbi-message__content span {
  color: #e58b7f;
}

.orbi-thinking {
  display: flex;
  min-width: 42px;
  min-height: 18px;
  align-items: center;
  gap: 5px;
}

.orbi-thinking i {
  width: 5px;
  height: 5px;

  background:
    var(--orbi-panel-amber);

  border-radius: 50%;

  animation:
    orbiThinkingPulse
    900ms
    ease-in-out
    infinite;
}

.orbi-thinking i:nth-child(2) {
  animation-delay: 120ms;
}

.orbi-thinking i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes orbiThinkingPulse {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.orbi-composer textarea:disabled {
  cursor: wait;
  opacity: 0.62;
}

.orbi-composer__send:disabled {
  cursor: wait;
  opacity: 0.58;
}

/* =========================================================
   END: ORBI PURCHASING WORKSPACE PANEL
========================================================= */
/* =========================================================
   AI DECISION CARD — ORBI
========================================================= */

.ai-decision-card {
  position: relative;

  margin-top: 18px;
  padding: 22px;

  overflow: hidden;

  color: var(--purchasing-text);

  background:
    linear-gradient(
      135deg,
      rgba(255, 251, 242, 0.98),
      rgba(249, 245, 234, 0.96)
    );

  border: 1px solid
    rgba(189, 134, 40, 0.28);

  border-radius: 16px;

  box-shadow:
    0 14px 34px rgba(78, 58, 20, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);

  animation:
    aiDecisionCardReveal
    220ms ease-out;
}

.ai-decision-card::before {
  content: "";

  position: absolute;
  top: 0;
  left: 0;

  width: 4px;
  height: 100%;

  background:
    linear-gradient(
      180deg,
      var(--purchasing-primary),
      var(--purchasing-primary-dark)
    );
}

.ai-decision-card[hidden] {
  display: none;
}

@keyframes aiDecisionCardReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Header */

.ai-decision-card__header {
  display: grid;
  grid-template-columns:
    auto
    minmax(0, 1fr)
    auto;
  align-items: start;
  gap: 14px;
}

.ai-decision-card__agent-mark {
  display: grid;

  width: 92px;
  height: 92px;
  place-items: center;

  color: #f4cf78;

  background:
    linear-gradient(
      145deg,
      #2b2317,
      #15110b
    );

  border: 1px solid
    rgba(189, 134, 40, 0.48);

  border-radius: 12px;

  box-shadow:
    0 8px 18px rgba(36, 27, 12, 0.18);
}

.ai-decision-card__agent-image{
    display:block;
    width:100%;
    height:100%;
    object-fit:cover;
    border-radius:inherit;
}

.ai-decision-card__heading {
  min-width: 0;
}

.ai-decision-card__agent {
  display: inline-block;

  margin-right: 8px;

  color: var(--purchasing-primary-dark);

  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.13em;
}

.ai-decision-card__eyebrow {
  display: inline-block;

  color: var(--purchasing-text-muted);

  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-decision-card__heading h3 {
  margin: 6px 0 0;

  color: var(--purchasing-text);

  font-size: 1.04rem;
  font-weight: 720;
  line-height: 1.4;
}

.ai-decision-card__heading p {
  max-width: 720px;
  margin: 6px 0 0;

  color: var(--purchasing-text-secondary);

  font-size: 0.79rem;
  line-height: 1.55;
}

.ai-decision-card__status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;

  padding: 0 10px;

  color: var(--purchasing-primary-dark);

  background:
    rgba(189, 134, 40, 0.11);

  border: 1px solid
    rgba(189, 134, 40, 0.22);

  border-radius: 999px;

  font-size: 0.67rem;
  font-weight: 720;
  white-space: nowrap;
}


/* Details */

.ai-decision-card__details {
  display: grid;
  grid-template-columns:
    minmax(130px, 0.7fr)
    minmax(190px, 1fr)
    minmax(250px, 1.45fr)
    minmax(180px, 1fr);
  gap: 10px;

  margin: 18px 0 0;
}

.ai-decision-card__detail {
  min-width: 0;
  padding: 12px 13px;

  background:
    rgba(255, 255, 255, 0.64);

  border: 1px solid
    rgba(91, 76, 49, 0.12);

  border-radius: 10px;
}

.ai-decision-card__detail dt {
  margin-bottom: 5px;

  color: var(--purchasing-text-muted);

  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ai-decision-card__detail dd {
  margin: 0;

  overflow-wrap: anywhere;

  color: var(--purchasing-text);

  font-size: 0.77rem;
  font-weight: 650;
  line-height: 1.45;
}


/* Recommendation */

.ai-decision-card__recommendation {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  margin-top: 12px;
  padding: 11px 13px;

  color: var(--purchasing-text-secondary);

  background:
    rgba(189, 134, 40, 0.065);

  border-radius: 9px;
}

.ai-decision-card__recommendation > span {
  display: grid;
  flex: 0 0 auto;

  width: 19px;
  height: 19px;
  place-items: center;

  color: var(--purchasing-primary-dark);

  border: 1px solid
    rgba(189, 134, 40, 0.34);

  border-radius: 50%;

  font-size: 0.65rem;
  font-weight: 760;
}

.ai-decision-card__recommendation p {
  margin: 0;

  font-size: 0.74rem;
  line-height: 1.55;
}


/* Actions */

.ai-decision-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  margin-top: 16px;
}

.ai-decision-card__actions button {
  min-height: 42px;
  white-space: nowrap;
}

.ai-decision-card__continue {
  color: var(--purchasing-primary-dark);

  background:
    rgba(255, 255, 255, 0.72);

  border-color:
    rgba(189, 134, 40, 0.38);
}

.ai-decision-card__continue:hover {
  color: var(--purchasing-primary-dark);

  background:
    var(--purchasing-primary-soft);

  border-color:
    var(--purchasing-primary);
}

.ai-decision-card__cancel {
  color: var(--purchasing-text-muted);

  background: transparent;

  border-color: transparent;
}

.ai-decision-card__cancel:hover {
  color: var(--purchasing-text-secondary);

  background:
    rgba(0, 0, 0, 0.035);

  border-color:
    var(--purchasing-border);
}

body.dark-mode
.ai-decision-card__continue {
  color: var(--purchasing-primary-dark);

  background:
    rgba(25, 23, 18, 0.42);

  border-color:
    rgba(213, 165, 72, 0.3);
}

body.dark-mode
.ai-decision-card__cancel:hover {
  background:
    rgba(255, 255, 255, 0.04);
}

/* Dark mode */

body.dark-mode .ai-decision-card {
  background:
    linear-gradient(
      135deg,
      rgba(57, 49, 32, 0.98),
      rgba(42, 38, 29, 0.98)
    );

  border-color:
    rgba(213, 165, 72, 0.28);

  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

body.dark-mode
.ai-decision-card__detail {
  background:
    rgba(25, 23, 18, 0.42);

  border-color:
    rgba(213, 165, 72, 0.13);
}

body.dark-mode
.ai-decision-card__recommendation {
  background:
    rgba(213, 165, 72, 0.075);
}


/* Responsive */

@media (max-width: 1100px) {
  .ai-decision-card__details {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .ai-decision-card {
    padding: 18px;
  }

  .ai-decision-card__header {
    grid-template-columns:
      auto
      minmax(0, 1fr);
  }

  .ai-decision-card__status {
    grid-column: 2;
    justify-self: start;
  }

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

  .ai-decision-card__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-decision-card__actions button {
    width: 100%;
  }
}

/* =========================================================
   WAREHOUSE SUITE SHARED SHELL — PURCHASING IDENTITY
========================================================= */

/* Purchasing amber accent for shared warehouse-header.css color system */
.purchasing-header {
  --core-header-accent-rgb: 189, 134, 40;
}

/* Weather text — purchasing amber light palette */
.purchasing-header .weather-block__temperature {
  color: #f7f3e8;
}

.purchasing-header .weather-block__location {
  color: rgba(247, 243, 232, 0.65);
}

/* Sidebar active state — restrained gold treatment */
.sidebar-nav-item--purchasing.is-active {
  border-color: rgba(189, 134, 40, 0.42);
}

.sidebar-nav-item--purchasing.is-active .sidebar-nav-icon {
  color: #bd8628;
}

/* =========================================================
   PURCHASING SIDEBAR REFINEMENT
========================================================= */

/* Step 1: Center ROUTIQ branding horizontally */
.dashboard-shell .sidebar-top {
  align-items: center;
  text-align: center;
}

/* Step 2: ORBI purchasing identity */
.sidebar-orbi-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px 7px;
  margin: 8px 4px 0;
  border-top: 1px solid rgba(189, 134, 40, 0.12);
}

.sidebar-orbi-identity__icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.86;
}

.sidebar-orbi-identity__label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sidebar-orbi-identity__name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #d8ab47;
  line-height: 1.2;
}

.sidebar-orbi-identity__role {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(247, 243, 232, 0.44);
  line-height: 1.2;
}

