:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --brand: #195b47;
  --brand-dark: #0f3d31;
  --blue: #2563eb;
  --green: #16803c;
  --amber: #b45309;
  --red: #b42318;
  --shadow: 0 14px 35px rgba(23, 32, 51, 0.08);
}

.pc-filter-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.pc-task-table {
  min-width: 1500px;
}

.pc-row-overdue td {
  background: #fff1f2;
}

.pc-row-near td {
  background: #fffbeb;
}

.ims-update-result {
  margin: 16px 0;
}

.ims-update-success {
  border-left: 4px solid var(--green);
}

.ims-update-error {
  border-left: 4px solid var(--red);
}

@media (max-width: 900px) {
  .pc-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .pc-filter-grid {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

html.crm-modal-open,
body.crm-modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.login-screen {
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: #f5f7fa;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(540px, 55fr) minmax(440px, 45fr);
}

.login-brand-panel {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(38px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 16% 15%, rgba(63, 180, 132, 0.28), transparent 30%),
    radial-gradient(circle at 88% 78%, rgba(39, 142, 101, 0.22), transparent 33%),
    linear-gradient(145deg, #0b3d2e 0%, #062f24 48%, #041f19 100%);
}

.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom right, black, transparent 72%);
}

.login-brand-panel::after {
  content: "";
  position: absolute;
  inset: -15%;
  z-index: -1;
  opacity: 0.18;
  transform: rotate(-8deg);
  background: repeating-radial-gradient(ellipse at 10% 60%, transparent 0 42px, rgba(170, 236, 207, 0.22) 43px 44px, transparent 45px 62px);
}

.login-pattern {
  position: absolute;
  right: -120px;
  top: 20%;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 62px rgba(255, 255, 255, 0.025), 0 0 0 124px rgba(255, 255, 255, 0.018);
}

.login-brand-lockup {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.18), rgba(255,255,255,.07));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 14px 30px rgba(0,0,0,.18);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.login-brand-name {
  max-width: 150px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.9);
}

.login-brand-content {
  position: relative;
  z-index: 2;
  max-width: 690px;
  margin: clamp(60px, 12vh, 150px) 0 auto;
}

.login-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: #a7e3ca;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-eyebrow span {
  width: 24px;
  height: 2px;
  border-radius: 99px;
  background: #6cd5aa;
}

.login-brand-content h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(46px, 5.4vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.login-brand-copy {
  max-width: 600px;
  margin: 26px 0 0;
  color: rgba(235, 250, 244, 0.72);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.7;
}

.login-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.login-feature-list span {
  padding: 9px 13px;
  border: 1px solid rgba(184, 235, 214, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  backdrop-filter: blur(8px);
  color: rgba(247, 255, 252, 0.9);
  font-size: 13px;
  font-weight: 700;
}

.login-module-map {
  position: absolute;
  right: clamp(28px, 4vw, 70px);
  bottom: clamp(84px, 11vh, 140px);
  width: 310px;
  height: 214px;
  pointer-events: none;
}

.login-module-map::before,
.login-module-map::after {
  content: "";
  position: absolute;
  background: rgba(153, 225, 196, 0.18);
}

.login-module-map::before { left: 34px; right: 34px; top: 50%; height: 1px; }
.login-module-map::after { top: 28px; bottom: 28px; left: 50%; width: 1px; }

.login-module-card {
  position: absolute;
  width: 136px;
  min-height: 72px;
  padding: 13px 13px 11px 36px;
  border: 1px solid rgba(205, 245, 229, 0.16);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.055));
  box-shadow: 0 16px 35px rgba(0, 15, 11, 0.18), inset 0 1px 0 rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
}

.login-module-card strong,
.login-module-card small { display: block; }
.login-module-card strong { font-size: 13px; line-height: 1.2; }
.login-module-card small { margin-top: 5px; color: rgba(229, 248, 240, 0.62); font-size: 11px; }
.module-indicator { position: absolute; left: 14px; top: 16px; width: 9px; height: 9px; border: 2px solid rgba(255,255,255,.6); border-radius: 50%; box-shadow: 0 0 0 4px rgba(101, 214, 169, 0.12); }
.module-order { left: 0; top: 0; }
.module-inventory { right: 0; top: 0; }
.module-dispatch { left: 0; bottom: 0; }
.module-crm { right: 0; bottom: 0; }

.login-brand-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(230, 248, 240, 0.6);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ee2ac;
  box-shadow: 0 0 0 4px rgba(94, 226, 172, 0.1);
}

.login-access-panel {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px clamp(30px, 5vw, 80px) 76px;
  background:
    radial-gradient(circle at 100% 0, rgba(23, 107, 77, 0.075), transparent 27%),
    radial-gradient(circle at 0 100%, rgba(41, 121, 90, 0.05), transparent 30%),
    #f5f7fa;
}

.login-access-inner { width: min(430px, 100%); }

.login-card.auth-box {
  position: relative;
  width: 100%;
  padding: clamp(32px, 4vw, 46px);
  border: 1px solid rgba(203, 214, 224, 0.88);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 30px 70px rgba(15, 45, 35, 0.1), 0 4px 14px rgba(15, 23, 42, 0.04), inset 0 1px 0 #fff;
}

.login-card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 25px;
  border: 1px solid #cfe4db;
  border-radius: 14px;
  color: #176b4d;
  background: linear-gradient(145deg, #eef9f4, #e3f3ec);
  box-shadow: 0 10px 22px rgba(23, 107, 77, 0.1);
}

.login-card-icon svg { width: 23px; height: 23px; }

.login-card-header { margin-bottom: 30px; }
.login-card-header .login-card-kicker { margin: 0 0 8px; color: #1f7a5a; font-size: 12px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.login-card-header h2 { margin: 0; color: #0f172a; font-size: clamp(29px, 3vw, 36px); letter-spacing: -0.035em; line-height: 1.12; }
.login-card-header > p:last-child { margin: 10px 0 0; color: #64748b; font-size: 15px; line-height: 1.55; }

.login-form-fields { display: grid; gap: 20px; }
.login-field { gap: 9px; color: #263548; font-size: 14px; font-weight: 750; }
.login-input-wrap { position: relative; display: block; }
.login-input-wrap svg { position: absolute; left: 15px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: #8291a5; pointer-events: none; transition: color .18s ease; }
.login-input-wrap input { min-height: 52px; padding: 13px 15px 13px 46px; border: 1px solid #d9e2ec; border-radius: 12px; background: #fbfcfd; color: #0f172a; font-size: 15px; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.login-input-wrap input::placeholder { color: #94a3b8; }
.login-input-wrap:focus-within svg { color: #176b4d; }
.login-input-wrap input:focus { outline: 0; border-color: #1f7a5a; background: #fff; box-shadow: 0 0 0 4px rgba(31, 122, 90, 0.12); }

.login-submit {
  width: 100%;
  min-height: 52px;
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1f7a5a, #176b4d 58%, #0f5a40);
  box-shadow: 0 13px 25px rgba(23, 107, 77, 0.22);
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.login-submit svg { width: 19px; height: 19px; transition: transform .18s ease; }
.login-submit:hover { background: linear-gradient(135deg, #238665, #176b4d 58%, #0f5a40); transform: translateY(-1px); box-shadow: 0 16px 29px rgba(23, 107, 77, 0.26); }
.login-submit:hover svg { transform: translateX(2px); }
.login-submit:active { transform: translateY(0); box-shadow: 0 8px 18px rgba(23, 107, 77, 0.2); }
.login-submit:focus-visible { outline: 3px solid rgba(31, 122, 90, 0.27); outline-offset: 3px; }
.login-submit:disabled { transform: none; filter: saturate(.65); box-shadow: none; cursor: wait; }

.login-authorized {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 22px 0 0;
  color: #78879a;
  font-size: 13px;
  font-weight: 650;
}
.login-authorized svg { width: 17px; height: 17px; color: #1f7a5a; }

.login-version {
  position: absolute;
  right: clamp(24px, 4vw, 54px);
  bottom: 27px;
  color: #8290a3;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.login-version span { padding: 0 5px; color: #b1bdc9; }

.login-screen .login-alert {
  right: clamp(20px, 4vw, 54px);
  bottom: 58px;
  max-width: 430px;
  padding: 14px 17px 14px 45px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  font-weight: 700;
}
.login-screen .login-alert::before { content: "!"; position: absolute; left: 16px; top: 50%; display: grid; place-items: center; width: 20px; height: 20px; transform: translateY(-50%); border: 1px solid rgba(255,255,255,.65); border-radius: 50%; font-size: 12px; }

@media (max-width: 1180px) {
  .login-shell { grid-template-columns: minmax(430px, 51fr) minmax(400px, 49fr); }
  .login-brand-content h1 { font-size: clamp(43px, 5vw, 62px); }
  .login-module-map { opacity: .48; transform: scale(.82); transform-origin: right bottom; }
}

@media (max-height: 760px) {
  .login-brand-content { margin-top: clamp(30px, 6vh, 70px); }
  .login-brand-content h1 { font-size: clamp(36px, 4.4vw, 52px); }
  .login-brand-copy { margin-top: 16px; font-size: 15px; line-height: 1.55; }
  .login-feature-list { margin-top: 20px; }
  .login-module-map { display: none; }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: minmax(280px, 38fr) minmax(390px, 62fr); }
  .login-brand-panel { padding: 34px 28px; }
  .login-brand-name { display: none; }
  .login-brand-content { margin-top: auto; margin-bottom: auto; }
  .login-brand-content h1 { font-size: clamp(36px, 6vw, 48px); }
  .login-brand-copy { font-size: 15px; line-height: 1.55; }
  .login-feature-list { display: grid; justify-items: start; }
  .login-module-map { display: none; }
  .login-access-panel { padding-inline: 30px; }
}

@media (max-width: 680px) {
  .login-shell { display: block; min-height: 100vh; }
  .login-brand-panel { min-height: 210px; padding: 28px 24px 38px; justify-content: flex-start; }
  .login-brand-panel::before { background-size: 42px 42px; }
  .login-brand-content { margin: 34px 0 0; }
  .login-eyebrow, .login-brand-copy, .login-feature-list, .login-brand-footer, .login-pattern { display: none; }
  .login-brand-content h1 { max-width: 420px; font-size: clamp(34px, 10vw, 46px); line-height: 1.02; }
  .login-brand-content h1 br { display: none; }
  .login-access-panel { min-height: calc(100vh - 210px); padding: 28px 18px 72px; align-items: start; }
  .login-access-inner { margin-top: -46px; position: relative; z-index: 4; }
  .login-card.auth-box { padding: 30px 24px; border-radius: 20px; box-shadow: 0 22px 55px rgba(15, 45, 35, 0.14); }
  .login-card-icon { margin-bottom: 20px; }
  .login-card-header { margin-bottom: 25px; }
  .login-card-header h2 { font-size: 30px; }
  .login-version { left: 20px; right: 20px; bottom: 22px; text-align: center; }
  .login-screen .login-alert { left: 18px; right: 18px; bottom: 58px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .login-input-wrap input,
  .login-submit,
  .login-submit svg { transition: none; }
}

.auth-box h2,
.panel h2,
.page-title h1 {
  margin: 0;
}

.muted,
.small {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #344054;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(25, 91, 71, 0.18);
  border-color: var(--brand);
}

button,
.button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--brand-dark);
}

button:disabled {
  opacity: 0.65;
  cursor: progress;
}

.ghost-button {
  background: #eef6f2;
  color: var(--brand);
  border: 1px solid #cfe4db;
}

.ghost-button:hover {
  background: #dfeee8;
}

.danger-button {
  background: #fee4e2;
  color: var(--red);
  border: 1px solid #fecdca;
}

.danger-button:hover {
  background: #fecdca;
}

.warning-button {
  background: #f59e0b;
  color: #422006;
  border: 1px solid #d97706;
}

.warning-button:hover {
  background: #d97706;
  color: #fff;
}

.buyer-picker-field {
  display: grid;
  gap: 7px;
}

.buyer-picker {
  position: relative;
}

.buyer-picker > input[type="search"] {
  padding-left: 15px;
  border-left-width: 5px;
}

.buyer-picker.party-green > input[type="search"] { border-left-color: #16a34a; background: #f0fdf4; }
.buyer-picker.party-red > input[type="search"] { border-left-color: #dc2626; background: #fff7f7; }
.buyer-picker.party-yellow > input[type="search"] { border-left-color: #d97706; background: #fffbeb; }

.buyer-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(16, 37, 31, 0.16);
}

.buyer-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-left: 4px solid #98a2b3;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.buyer-option + .buyer-option { margin-top: 4px; }
.buyer-option:hover, .buyer-option.is-active { background: #f2f4f7; }
.buyer-option.party-green { border-left-color: #16a34a; background: #f0fdf4; }
.buyer-option.party-red { border-left-color: #dc2626; background: #fff7f7; }
.buyer-option.party-yellow { border-left-color: #d97706; background: #fffbeb; }

.buyer-options-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.sales-target-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.sales-target-actions > :first-child { flex: 1; }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #10251f;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-size: 22px;
  font-weight: 900;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 600;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-section {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-section[hidden] {
  display: none;
}

.nav-heading {
  padding: 0 12px 2px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
}

.nav a.active,
.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav a {
  border: 1px solid transparent;
}

.nav a.active {
  border-color: rgba(255, 255, 255, 0.16);
}

.admin-nav-group {
  display: grid;
  gap: 5px;
  padding: 10px 0 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.admin-nav-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-nav-group-title {
  padding: 0 12px 3px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  padding: 13px 16px;
  border: 1px solid #dbe5df;
  border-radius: 8px;
  background: #f8fbf9;
}

.admin-workspace-header h2 {
  margin: 2px 0 0;
  color: #122820;
  font-size: 18px;
  letter-spacing: 0;
}

.admin-route-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-route-section[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell .sidebar {
    position: static;
    height: auto;
  }

  .admin-shell .nav {
    grid-template-columns: 1fr;
  }

  .admin-workspace-header,
  .admin-shell .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

.crm-shell {
  grid-template-columns: 320px 1fr;
}

.crm-activity-sidebar {
  gap: 18px;
  padding: 22px 16px 16px;
  background:
    radial-gradient(circle at 20% 0, rgba(111, 221, 174, .24), transparent 32%),
    linear-gradient(180deg, #1a5846, #124536 68%, #0e382d);
}

.crm-side-widgets {
  flex: 1 1 auto;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: rgba(143, 224, 191, .42) transparent;
  scrollbar-width: thin;
}

.crm-side-widgets::-webkit-scrollbar { width: 5px; }
.crm-side-widgets::-webkit-scrollbar-track { background: transparent; }
.crm-side-widgets::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(143, 224, 191, .32); }

.crm-side-widgets[hidden] { display: none; }

.crm-side-card {
  min-width: 0;
  overflow: hidden;
  padding: 15px;
  border: 1px solid #c9e5d9;
  border-radius: 14px;
  background: linear-gradient(145deg, #f8fffb, #edf8f3);
  box-shadow: 0 12px 28px rgba(0, 31, 22, .14);
}

.crm-side-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.crm-side-card-head h2 {
  margin: 0;
  color: #0b3529;
  font-size: 15px;
  letter-spacing: -.01em;
}

.crm-side-card-head p {
  margin: 4px 0 0;
  color: #506d62;
  font-size: 11px;
  line-height: 1.4;
}

.crm-live-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #16845d;
  box-shadow: 0 0 0 4px rgba(22, 132, 93, .12);
}

.crm-activity-metrics {
  display: grid;
  gap: 2px;
}

.crm-activity-metrics > div:not(.crm-side-error) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 31px;
  color: #294b3e;
  font-size: 12px;
}

.crm-activity-metrics strong {
  min-width: 30px;
  color: #0a3c2d;
  font-size: 16px;
  text-align: right;
}

.crm-side-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 11px;
  padding: 10px 0 0;
  border-top: 1px solid #d1e6dd;
  border-radius: 0;
  background: transparent;
  color: #116447;
  font-size: 12px;
  text-align: left;
}

.crm-side-link:hover,
.crm-side-link:focus-visible {
  background: transparent;
  color: #073f2d;
}

.crm-recent-list { display: grid; gap: 5px; }

.crm-recent-item {
  width: 100%;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 52px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: #173e31;
  text-align: left;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.crm-recent-item:hover,
.crm-recent-item:focus-visible {
  background: #e2f3eb;
  border-color: #a9d3c1;
  box-shadow: none;
}

.crm-recent-item:focus-visible {
  outline: 3px solid rgba(23, 122, 86, .22);
  outline-offset: 1px;
}

.crm-recent-item.is-unread {
  border-color: #e3b64f;
  background: linear-gradient(135deg, #fff9da, #fff2bd);
  box-shadow: inset 4px 0 0 #d89413, 0 4px 12px rgba(137, 91, 10, .1);
}

.crm-recent-item p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #173e31;
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.crm-recent-item small {
  color: #60776e;
  font-size: 10px;
}

.crm-recent-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 16px;
  margin-bottom: 3px;
}

.crm-new-update-badge {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #a75b00;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.crm-update-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #d9eee5;
  color: #126446;
  font-size: 10px;
  font-weight: 900;
}

.crm-update-icon.tone-green { background: #d8f3e6; color: #087443; }
.crm-update-icon.tone-amber { background: #fff0c7; color: #945a00; }
.crm-update-icon.tone-red { background: #fee2e2; color: #b42318; }
.crm-update-icon.tone-violet { background: #ede9fe; color: #6d28d9; }

.crm-side-skeleton {
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(90deg, #e2eee8, #f8fffb, #e2eee8);
  background-size: 200% 100%;
  animation: crm-side-shimmer 1.4s ease infinite;
}

.crm-side-skeleton.tall { height: 39px; }
@keyframes crm-side-shimmer { to { background-position: -200% 0; } }

.crm-side-empty,
.crm-side-error {
  margin: 7px 0 2px;
  padding: 9px;
  border-radius: 8px;
  background: #e7f2ed;
  color: #49665b;
  font-size: 11px;
  text-align: center;
}

.crm-side-error { color: #a5362c; }

.crm-utility-nav {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .2);
}

.crm-quick-toggle {
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 10px;
  background: #e9fff5;
  color: #0a432f;
  box-shadow: 0 7px 18px rgba(0, 28, 19, .15);
  font-size: 13px;
  font-weight: 850;
}

.crm-quick-toggle:hover,
.crm-quick-toggle:focus-visible {
  background: #fff;
  color: #063d2b;
}

.crm-quick-toggle:focus-visible {
  outline: 3px solid rgba(215, 255, 238, .48);
  outline-offset: 2px;
}

.crm-quick-chevron {
  font-size: 18px;
  line-height: 1;
  transition: transform .16s ease;
}

.crm-quick-toggle[aria-expanded="true"] .crm-quick-chevron { transform: rotate(180deg); }

.crm-quick-links {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 10px;
  background: rgba(4, 39, 29, .32);
}

.crm-quick-links[hidden] { display: none; }

.crm-quick-links a,
.crm-quick-links button {
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #f0fff8;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .02em;
  text-align: left;
}

.crm-quick-links a:hover,
.crm-quick-links a:focus-visible,
.crm-quick-links button:hover,
.crm-quick-links button:focus-visible {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.crm-activity-modal { width: min(900px, 100%); }

.crm-activity-filters {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.crm-activity-filters button { min-height: 42px; }
.crm-activity-timeline { display: grid; gap: 9px; max-height: 62vh; overflow: auto; padding: 2px; }

.crm-timeline-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.crm-timeline-item .crm-update-icon { width: 36px; height: 36px; font-size: 12px; }
.crm-timeline-title { display: flex; justify-content: space-between; gap: 15px; }
.crm-timeline-title time { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.crm-timeline-copy p { margin: 5px 0 8px; color: #344054; font-size: 13px; line-height: 1.45; }
.crm-timeline-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 11px; }
.crm-activity-loading { padding: 36px; color: var(--muted); text-align: center; }

@media (max-width: 1180px) {
  .crm-activity-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .crm-shell { grid-template-columns: 1fr; }
  .crm-activity-sidebar { height: auto; }
  .crm-side-widgets {
    flex: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding-right: 0;
  }
  .crm-utility-nav { margin-top: 0; }
}

@media (max-width: 640px) {
  .crm-side-widgets, .crm-activity-filters { grid-template-columns: 1fr; }
  .crm-timeline-title { display: grid; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .crm-side-skeleton { animation: none; }
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.05);
}

.span-4 {
  grid-column: span 4;
}

.span-6 {
  grid-column: span 6;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.modal-search-field {
  display: grid;
  gap: 5px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.section-split {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.large-suggestions {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.large-suggestions button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.large-suggestions button:hover,
.large-suggestions button:focus-visible {
  background: #eef7f2;
}

.table-wrap {
  overflow-x: auto;
}

.compact-table {
  margin-top: 14px;
}

.compact-table table {
  min-width: 560px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}

.badge,
.party-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.badge-admin,
.badge-green,
.party-green {
  background: #dcfce7;
  color: var(--green);
}

.badge-crm,
.badge-blue {
  background: #dbeafe;
  color: var(--blue);
}

.badge-deo,
.badge-ea,
.badge-amber,
.party-yellow {
  background: #fef3c7;
  color: var(--amber);
}

.badge-orange {
  background: #ffedd5;
  color: #c2410c;
}

.badge-neutral {
  background: #eef2f7;
  color: #475467;
}

.party-red,
.badge-red {
  background: #fee4e2;
  color: var(--red);
}

.inline-input {
  max-width: 100px;
  padding: 8px;
}

.line-qty-editor input {
  margin-top: 2px;
}

.result-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.cards-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cards-six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

#crmCards {
  min-height: 294px;
  align-content: start;
}

.cards-admin {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ---------------------------------------------------------------------- */
/* Admin dashboard summary tiles.                                         */
/* Scoped to #adminDashboardCards / .admin-summary-panel, which only      */
/* exist in frontend/admin.html, so other portals (dispatch, crm, etc.)   */
/* that also use .metric-grid / .cards-admin / .metric are unaffected.    */
/* ---------------------------------------------------------------------- */
.admin-summary-panel {
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  box-shadow: 0 18px 40px rgba(15, 61, 49, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
}

#adminDashboardCards {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

#adminDashboardCards .metric {
  position: relative;
  gap: 8px;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#adminDashboardCards .metric:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.13);
}

#adminDashboardCards .metric::before {
  content: "";
  order: -1;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background-color: var(--brand);
  opacity: 0.94;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 18px 18px;
  mask-size: 18px 18px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5Z'/%3E%3Cpath d='M3 13l9 5 9-5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5Z'/%3E%3Cpath d='M3 13l9 5 9-5'/%3E%3C/svg%3E");
}

#adminDashboardCards .metric strong {
  order: 1;
  font-size: 27px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

#adminDashboardCards .metric span {
  order: 2;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

/* Danger accent: Cancelled Orders, Open Alerts, SLA Overdue */
#adminDashboardCards .metric:nth-child(2),
#adminDashboardCards .metric:nth-child(8),
#adminDashboardCards .metric:nth-child(10) {
  border-left-color: var(--red);
  background: linear-gradient(180deg, #ffffff 0%, #fff5f4 100%);
}

#adminDashboardCards .metric:nth-child(2) strong,
#adminDashboardCards .metric:nth-child(8) strong,
#adminDashboardCards .metric:nth-child(10) strong {
  color: var(--red);
}

#adminDashboardCards .metric:nth-child(2)::before,
#adminDashboardCards .metric:nth-child(8)::before,
#adminDashboardCards .metric:nth-child(10)::before {
  background-color: var(--red);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19L12 3.5Z'/%3E%3Cpath d='M12 10v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19L12 3.5Z'/%3E%3Cpath d='M12 10v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

/* Warning accent: Level-1 Pending, Hold Orders, Owner Approval Pending, Demand Gap Items */
#adminDashboardCards .metric:nth-child(3),
#adminDashboardCards .metric:nth-child(4),
#adminDashboardCards .metric:nth-child(7),
#adminDashboardCards .metric:nth-child(9) {
  border-left-color: var(--amber);
  background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

#adminDashboardCards .metric:nth-child(3) strong,
#adminDashboardCards .metric:nth-child(4) strong,
#adminDashboardCards .metric:nth-child(7) strong,
#adminDashboardCards .metric:nth-child(9) strong {
  color: var(--amber);
}

#adminDashboardCards .metric:nth-child(3)::before,
#adminDashboardCards .metric:nth-child(4)::before,
#adminDashboardCards .metric:nth-child(7)::before,
#adminDashboardCards .metric:nth-child(9)::before {
  background-color: var(--amber);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E");
}

/* Info accent: CRM Sales Orders, DEO Demand Files */
#adminDashboardCards .metric:nth-child(5),
#adminDashboardCards .metric:nth-child(6) {
  border-left-color: var(--blue);
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
}

#adminDashboardCards .metric:nth-child(5) strong,
#adminDashboardCards .metric:nth-child(6) strong {
  color: var(--blue);
}

#adminDashboardCards .metric:nth-child(5)::before,
#adminDashboardCards .metric:nth-child(6)::before {
  background-color: var(--blue);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E");
}

@media (max-width: 1280px) {
  #adminDashboardCards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  #adminDashboardCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  #adminDashboardCards {
    grid-template-columns: 1fr;
  }
}

.one-col {
  grid-template-columns: 1fr;
}

.sticky-panel {
  position: sticky;
  top: 18px;
  align-self: start;
}

.product-search-wrap {
  position: relative;
}

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
  z-index: 8;
}

.suggestions:empty {
  display: none;
}

.suggestion {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.suggestion:hover {
  background: #dfeee8;
}

.suggestion.active {
  background: var(--brand-dark);
  color: #fff;
}

.suggestion.active .small {
  color: rgba(255, 255, 255, 0.82);
}

.result-grid span,
.metric {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric {
  display: grid;
  gap: 8px;
}

.metric-button {
  color: var(--ink);
  text-align: left;
  background: #f8fafc;
}

.metric-button:hover {
  background: #eef6f2;
  color: var(--ink);
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
}

.metric-card:hover {
  background: #eef6f2;
  color: var(--ink);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.action-card strong {
  font-size: 20px;
}

.tile-count {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.is-hidden {
  display: none !important;
}

.purchase-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.purchase-list,
.purchase-detail {
  display: grid;
  gap: 12px;
}

.purchase-group-list {
  display: grid;
  gap: 14px;
}

.purchase-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.purchase-po-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #f8fafc;
}

.work-tile {
  min-height: 142px;
  display: grid;
  place-items: center;
  gap: 10px;
  color: var(--ink);
  text-align: center;
  border: 1px solid var(--line);
  border-top-width: 4px;
  background: #f8fafc;
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.05);
}

.work-tile:hover,
.work-tile:focus-visible {
  color: #f8fafc;
  transform: translateY(-1px);
}

.work-tile:hover span,
.work-tile:hover small,
.work-tile:focus-visible span,
.work-tile:focus-visible small {
  color: #f8fafc;
}

.work-tile:hover strong,
.work-tile:focus-visible strong {
  color: #fff;
}

.work-tile span {
  font-weight: 800;
}

.work-tile strong {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  color: #fff;
  font-size: 24px;
}

.work-tile small {
  color: var(--muted);
  font-weight: 800;
}

.ibt-clickable-tile { cursor: pointer; }

.ibt-branch-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tile-green {
  background: #eaffea;
  border-color: #22c55e;
}

.tile-green strong {
  background: #16a34a;
}

.tile-amber {
  background: #fff8db;
  border-color: #f4b400;
}

.tile-amber strong {
  background: #eab308;
}

.tile-red {
  background: #fff1f1;
  border-color: #ef4444;
}

.tile-red strong {
  background: #dc2626;
}

.order-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  grid-auto-rows: max-content;
  gap: 16px;
  align-content: start;
  align-items: start;
}

.order-card,
.empty-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.06);
}

.order-card.order-overdue {
  border-top-color: var(--red);
  background: #fff7f7;
}

.order-card.deadline-safe {
  border-top-color: var(--green);
}

.order-card.deadline-warning {
  border-top-color: var(--amber);
  background: #fff8db;
}

.order-card.deadline-danger {
  border-top-color: var(--red);
  background: #fff7f7;
}

.order-card-pink {
  border-top-color: #db2777;
  background: #fff1f7;
}

.order-card-amber {
  border-top-color: #f97316;
  background: #fff7ed;
}

.order-card-red {
  border-top-color: var(--red);
  background: #fff5f5;
  box-shadow: 0 10px 24px rgba(180, 38, 38, .12);
}

.qty-correction-alert-body { display: grid; gap: 4px; padding: 4px 0; }
.qty-correction-alert-line { margin: 0; font-size: 14px; font-weight: 700; color: #b42318; }
.qty-correction-alert-line s { color: #7a1d13; }
.qty-correction-alert-note { margin: 0 0 6px; font-size: 12px; font-weight: 400; color: #6b7280; }
.qty-correction-alert-body hr { margin: 8px 0; border: none; border-top: 1px solid #f3d3d0; }

.order-card.order-missing-invoice {
  border-color: #f59e0b;
  border-top-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 10px 24px rgba(180, 83, 9, 0.14);
}

.order-card.order-missing-invoice .dealer-box,
.order-card.order-missing-invoice .order-meta {
  background: #fff7ed;
}

.correction-chunk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
  align-items: start;
  align-content: start;
  min-width: 0;
}

.correction-chunk-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
}

.correction-chunk-card__header {
  flex: 0 0 auto;
  margin: 0;
  padding: 16px 16px 12px;
}

.correction-chunk-card__header > div {
  min-width: 0;
}

.correction-chunk-card__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0 16px 16px;
}

.correction-chunk-card__summary > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e4ebf2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.correction-chunk-card__summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.correction-chunk-card__summary dd {
  margin: 4px 0 0;
  color: #253b34;
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.correction-chunk-card__content {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px 16px;
  overflow: visible;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.72);
}

.correction-chunk-card__latest {
  margin: 0;
}

.correction-chunk-card__section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.correction-chunk-card__section h3 {
  margin: 0;
  color: #475467;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.correction-chunk-card__footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 0 0 7px 7px;
}

.correction-chunk-card__footer button {
  min-width: 160px;
  min-height: 44px;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.correction-chunk-card__footer button:hover {
  background: var(--brand-dark);
}

.correction-chunk-card__footer button:active {
  transform: translateY(1px);
}

.correction-chunk-card__footer button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

.correction-chunk-card__footer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chunk-file-list,
.chunk-sales-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.correction-chunk-card .chunk-file-list button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  justify-content: flex-start;
  color: var(--brand);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: left;
}

.chunk-sales-row {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  overflow-wrap: anywhere;
}

.correction-complete-actions {
  align-self: start;
}

.weight-calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 16px;
  align-items: start;
}

.weight-order-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(260px, 0.45fr);
  gap: 14px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.weight-order-panel label {
  display: grid;
  gap: 8px;
}

.weight-add-panel {
  grid-column: 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.weight-table-panel {
  grid-column: 1;
  min-width: 0;
}

.weight-table-panel .table-wrap {
  margin: 0;
}

.weight-total-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f0fdf4;
  position: sticky;
  top: 0;
  z-index: 2;
}

.weight-total-card span,
.weight-total-card small {
  color: var(--muted);
}

.weight-total-card strong {
  color: var(--brand);
  font-size: 28px;
}

.weight-floating-total {
  position: sticky;
  bottom: 0;
  margin-left: auto;
  width: max-content;
  max-width: 100%;
  border: 1px solid #bbf7d0;
  border-radius: 8px 8px 0 0;
  padding: 10px 14px;
  background: #dcfce7;
  color: var(--brand);
  font-weight: 900;
  box-shadow: 0 -8px 20px rgba(23, 32, 51, 0.08);
  z-index: 4;
}

.order-card-top,
.order-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
  min-width: 0;
}

.order-card-top strong,
.order-card-head strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nt-order-card__header {
  align-items: flex-start;
}

.nt-order-card__badges {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.nt-order-card__id {
  flex: 1 1 auto;
  min-width: 0;
}

.nt-order-card__id strong {
  max-width: 100%;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

.order-id-block span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.deadline-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--blue);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.deadline-red {
  background: #fee4e2;
  border-color: #fecdca;
  color: var(--red);
}

.deadline-yellow {
  background: #fef3c7;
  border-color: #fde68a;
  color: var(--amber);
}

.deadline-green {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: var(--green);
}

.dealer-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #f8fafc;
  min-width: 0;
}

.dealer-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dealer-box strong {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.dealer-box.buyer-dealer-box {
  background: #eef8f5;
}

.dealer-box.buyer-dealer-box strong {
  font-size: 16px;
  font-style: italic;
  font-weight: 650;
  color: #173f3a;
}

.buyer-highlight {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: #eef8f5;
  color: #173f3a;
  font-style: italic;
  font-weight: 650;
}

.order-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: #475467;
  font-size: 13px;
  margin-bottom: 14px;
}

.order-meta > span,
.nt-order-card__meta-item {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid #e4ebf2;
  border-radius: 8px;
  background: #fbfdff;
}

.nt-order-card__meta-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
}

.nt-order-card__meta-item strong,
.order-meta > span strong {
  min-width: 0;
  color: #253b34;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.order-card-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  background: #fbfcfd;
}

.order-card-section h4 {
  margin: 0 0 8px;
  color: #475467;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.order-card-section p {
  margin: 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
}

.order-actions {
  background: #f8fafc;
}

.order-actions .actions,
.nt-order-card__actions {
  align-items: center;
}

.order-actions button,
.order-actions .ghost-button,
.nt-order-card__actions button,
.nt-order-card__actions .ghost-button {
  flex: 1 1 150px;
  min-width: min(170px, 100%);
}

.nt-order-card__actions [data-show-to-dispatch]:focus-visible {
  outline: 3px solid rgba(25, 91, 71, 0.32);
  outline-offset: 3px;
}

.order-documents {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.document-chip-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.document-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  text-align: left;
}

.document-chip .nt-order-card__file-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-chip .nt-order-card__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  border-radius: 999px;
  background: #dcfce7;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.nt-order-card {
  padding: 0;
  overflow: hidden;
  border-top-width: 3px;
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.07);
}

.nt-order-card__topline {
  margin: 0;
  padding: 10px 12px 8px;
  align-items: center;
  border-bottom: 1px solid #edf2f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.nt-order-card__body {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 9px 12px 0;
}

.nt-order-card__buyer-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.nt-order-card__buyer-line span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid #d7ebe4;
  border-radius: 999px;
  background: #f0f9f6;
  color: #47675d;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.nt-order-card__buyer-line strong {
  min-width: 0;
  margin: 0;
  color: #123f36;
  font-size: 14px;
  font-style: italic;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.nt-order-card__compact-meta {
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
  margin: 0;
  font-size: 12px;
}

.nt-order-card__compact-meta .nt-order-card__meta-item {
  gap: 2px;
  padding: 6px 7px;
  border-color: #e8eef2;
  background: #fbfcfd;
}

.nt-order-card__compact-meta .nt-order-card__meta-item em {
  font-size: 10px;
  line-height: 1.15;
}

.nt-order-card__compact-meta .nt-order-card__meta-item strong {
  font-size: 12px;
  line-height: 1.25;
}

.nt-order-card__controls {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 9px 12px 12px;
}

.nt-order-card__controls .nt-order-card__section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 8px;
  border-color: #e3ede8;
  background: #f7faf9;
}

.nt-order-card__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.nt-order-card__controls .nt-order-card__section h4 {
  margin: 0;
  color: #64756e;
  font-size: 10px;
  line-height: 1.1;
}

.nt-order-card__file-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.nt-order-card__view-all-files {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 850;
}

.nt-order-card__note-strip p {
  min-width: 0;
  color: #485b54;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nt-order-card__action-group {
  background: #f6f8fa;
}

.nt-order-card__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 5px;
  min-width: 0;
  width: 100%;
}

.nt-order-card__actions button,
.nt-order-card__actions .ghost-button,
.nt-order-card__files button,
.nt-order-card__files .ghost-button {
  min-width: 0;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.15;
  white-space: normal;
}

.nt-card-action--primary {
  border-color: #0b5d49;
  background: #0b5d49;
  color: #ffffff;
}

.nt-card-action--primary:hover:not(:disabled) {
  border-color: #084838;
  background: #084838;
}

.nt-card-action--secondary {
  border-color: #cfe0d8;
  background: #ffffff;
  color: #114236;
}

.nt-card-action--secondary:hover:not(:disabled) {
  border-color: #9fc8b8;
  background: #eef8f4;
}

.nt-card-action--danger {
  border-color: #f4c7c3;
  background: #fff7f6;
  color: #b42318;
}

.nt-card-action--danger:hover:not(:disabled) {
  border-color: #f0a7a0;
  background: #fee4e2;
}

.nt-card-action:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.nt-order-card__actions button:first-of-type:not(.ghost-button) {
  box-shadow: 0 7px 14px rgba(25, 91, 71, 0.15);
}

.nt-order-card__actions .badge {
  align-self: center;
  justify-self: start;
  min-height: 28px;
}

.nt-order-card__file-strip {
  border-color: #ccebdd;
  background: #f1fbf6;
}

.nt-order-card__files {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 6px;
  min-width: 0;
}

.nt-order-card__files .document-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  justify-content: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 34px;
  background: #ffffff;
  color: #145c49;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nt-order-card__file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  border-radius: 5px;
  background: #e9f7f1;
  color: #0b5d49;
  font-size: 10px;
  font-weight: 950;
}

.nt-order-card__file-open {
  color: #5d7169;
  font-size: 11px;
  font-weight: 850;
}

.nt-order-card__files .document-chip .nt-order-card__count {
  min-width: 18px;
  height: 18px;
  font-size: 11px;
}

@media (max-width: 560px) {
  .order-card-grid {
    grid-template-columns: 1fr;
  }

  .order-card-top,
  .nt-order-card__header {
    display: grid;
    gap: 8px;
  }

  .nt-order-card__badges {
    justify-content: flex-start;
  }

  .order-meta,
  .nt-order-card__meta-grid {
    grid-template-columns: 1fr;
  }

  .nt-order-card__compact-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nt-order-card__topline {
    padding: 10px 11px 8px;
  }

  .nt-order-card__body,
  .nt-order-card__controls {
    padding-left: 11px;
    padding-right: 11px;
  }

  .nt-order-card__buyer-line {
    align-items: flex-start;
  }

  .nt-order-card__actions {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  #orderCorrectionModal,
  #orderCorrectionDetailModal {
    padding: 8px;
  }

  #orderCorrectionModal .workflow-modal,
  #orderCorrectionDetailModal .workflow-modal {
    width: 100%;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
  }

  #orderCorrectionModal .workflow-modal > .panel-header,
  #orderCorrectionDetailModal .workflow-modal > .panel-header {
    margin: -16px -16px 0;
    padding: 15px 16px 13px;
  }

  #orderCorrectionDetailTitle {
    font-size: 20px;
    line-height: 1.25;
  }

  .correction-chunk-card__footer {
    padding: 12px 14px 14px;
  }

  .correction-chunk-card__footer button {
    width: 100%;
    min-width: 0;
  }
}

.metric strong {
  font-size: 24px;
}

.metric small {
  color: var(--muted);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-section {
  flex-basis: 100%;
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.file-button-list {
  max-height: 132px;
  overflow: auto;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.maintenance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #fecdca;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 16px;
  background: #fff7f7;
}

.maintenance-card h3 {
  margin: 0 0 6px;
}

.maintenance-card p {
  margin: 0;
  color: #475467;
}

.cleanup-modal {
  width: min(900px, 100%);
}

.cleanup-warning {
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: #fee4e2;
  color: var(--red);
  padding: 12px;
  font-weight: 800;
}

.cleanup-preview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
}

.cleanup-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.cleanup-check input {
  width: auto;
}

.result-panel {
  margin-top: 14px;
}

.rule-result {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.debug-box {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: #344054;
}

.recalc-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.check-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 8px;
}

.check-row label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.toast.success {
  background: var(--green);
}

.toast.warning {
  background: #9a6700;
}

.toast.info {
  background: #245ea8;
}

.button-loading {
  min-width: var(--loading-button-width, 120px);
  cursor: wait;
}

.button-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: ntw-spin 0.75s linear infinite;
}

.is-section-loading {
  position: relative;
  opacity: 0.72;
}

.is-section-loading::after {
  content: "Loading...";
  position: absolute;
  inset: 12px 12px auto auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #172033;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

@keyframes ntw-spin {
  to { transform: rotate(360deg); }
}

.upload-selection-status {
  min-height: 20px;
}

.modal-loading-placeholder {
  min-height: 96px;
}

.table-shell,
.selected-lines-table-wrap,
.order-card-grid {
  contain: layout paint;
}

.section-loader,
.section-error {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
}

.section-error {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.section-loader-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: ntw-spin 0.75s linear infinite;
}

.upload-selection-status.has-error {
  color: var(--red);
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 22, 18, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  isolation: isolate;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(8, 22, 18, 0.34);
  padding: 20px;
  display: grid;
  gap: 14px;
  opacity: 1;
  color: var(--ink);
}

.modal-wide {
  width: min(980px, 100%);
  max-height: 86vh;
  overflow: auto;
}

.purchase-entry-modal {
  width: min(1180px, 96vw);
  height: min(900px, 94vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.purchase-entry-head { flex: 0 0 auto; }
.purchase-header-summary { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 6px; font-size: .9rem; }
.purchase-grand-total { display: inline-flex; width: fit-content; margin-top: 8px; padding: 6px 10px; border: 1px solid #b7d7c7; border-radius: 6px; background: #eefaf3; color: #114531; font-weight: 850; }
.purchase-entry-body { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.purchase-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; }
.purchase-product-entry { display: grid; grid-template-columns: minmax(320px, 1fr) 150px auto; gap: 12px; align-items: end; position: relative; z-index: 3; }
.purchase-search-field { position: relative; }
.purchase-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 330px; overflow-y: auto; background: var(--surface, #fff); border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 14px 35px rgb(15 23 42 / 20%); z-index: 20; padding: 4px; }
.purchase-result-row { width: 100%; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(250px, 1fr) 100px; gap: 12px; text-align: left; align-items: center; border: 0; border-radius: 5px; background: transparent; color: inherit; padding: 10px 12px; }
.purchase-result-row:hover, .purchase-result-row.active { background: #e8eef7; color: #17233d; }
.purchase-result-row span { font-size: .82rem; }
.purchase-result-empty { padding: 18px; color: #64748b; }
.purchase-lines-wrap { min-height: 180px; flex: 1; overflow: auto; }
.purchase-lines-wrap thead { position: sticky; top: 0; z-index: 2; }
.purchase-entry-footer { flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid #dbe2ea; }
.purchase-correction-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px; align-items: end; }

#purchaseCorrectionModal {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

#purchaseCorrectionModal .purchase-entry-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  padding: 16px;
  gap: 12px;
}

#purchaseCorrectionModal .purchase-entry-head {
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dbe2ea;
}

#purchaseCorrectionModal .filter-grid {
  flex: 0 0 auto;
  grid-template-columns: minmax(160px, 190px) minmax(180px, 240px) minmax(280px, 1fr);
  margin-bottom: 0;
}

#purchaseCorrectionModal .purchase-product-entry {
  flex: 0 0 auto;
  grid-template-columns: minmax(320px, 1fr) minmax(120px, 150px) auto;
}

#purchaseCorrectionModal .purchase-lines-wrap {
  min-height: 0;
  scrollbar-gutter: stable;
}

#purchaseCorrectionModal .purchase-lines-wrap table {
  table-layout: fixed;
}

#purchaseCorrectionModal .purchase-lines-wrap th,
#purchaseCorrectionModal .purchase-lines-wrap td {
  overflow-wrap: anywhere;
  vertical-align: middle;
}

#purchaseCorrectionModal .purchase-lines-wrap th:nth-child(1) { width: 16%; }
#purchaseCorrectionModal .purchase-lines-wrap th:nth-child(3) { width: 16%; }
#purchaseCorrectionModal .purchase-lines-wrap th:nth-child(4) { width: 16%; }
#purchaseCorrectionModal .purchase-lines-wrap th:nth-child(5) { width: 110px; }

#purchaseCorrectionModal > .purchase-entry-modal > label.wide {
  flex: 0 0 auto;
  margin-top: 0;
}

#purchaseCorrectionModal #correctionRemark {
  min-height: 58px;
  resize: vertical;
}

@media (max-width: 720px) {
  .purchase-filter-grid, .purchase-product-entry, .purchase-correction-toolbar { grid-template-columns: 1fr; }
  .purchase-entry-modal { height: 96vh; }
  .purchase-result-row { grid-template-columns: 1fr; gap: 3px; }
  #purchaseCorrectionModal .purchase-entry-modal { padding: 12px; }
  #purchaseCorrectionModal .filter-grid,
  #purchaseCorrectionModal .purchase-product-entry { grid-template-columns: 1fr; }
  #purchaseCorrectionModal .purchase-entry-head,
  #purchaseCorrectionModal .modal-actions { display: grid; }
}

/* Purchase Manager workspace */
.purchase-shell {
  --pm-primary: #155b45;
  --pm-primary-hover: #0f4635;
  --pm-success: #18864b;
  --pm-warning: #b7791f;
  --pm-danger: #b42318;
  --pm-info: #2563eb;
  --pm-surface: #ffffff;
  --pm-surface-muted: #f4f8f6;
  --pm-border: #d7e3dd;
  --pm-text: #17231e;
  --pm-text-muted: #5f7168;
  --pm-shadow: 0 14px 34px rgba(23, 35, 30, .12);
  --pm-radius: 8px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  background: #eef3f1;
  color: var(--pm-text);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.purchase-shell .main {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 24px;
}

.purchase-topbar {
  min-height: auto;
  height: auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--pm-border);
}

.purchase-topbar h1 {
  color: var(--pm-text);
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.purchase-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.dispatch-updates-panel { min-height: 420px; }
.dispatch-updates-list { display: grid; gap: 7px; max-height: calc(100vh - 260px); overflow: auto; padding: 2px 5px 2px 2px; }

.purchase-update-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bcd2c8;
  border-radius: 9px;
  background: #fff;
  color: #173e31;
  text-align: left;
  box-shadow: 0 4px 14px rgba(23, 35, 30, .05);
  transition: background-color .16s ease, border-color .16s ease;
}
.purchase-update-item:hover, .purchase-update-item:focus-visible {
  background: #f4faf7;
  border-color: #78a995;
  outline: 3px solid rgba(21, 91, 69, .16);
  outline-offset: 1px;
}
.purchase-update-item.is-unread {
  border-color: #e3b64f;
  background: linear-gradient(135deg, #fff9da, #fff2bd);
  box-shadow: inset 4px 0 0 #d89413, 0 4px 12px rgba(137, 91, 10, .1);
}
.purchase-update-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: #94a8a0;
}
.purchase-update-item.is-unread .purchase-update-dot { background: #d89413; }
.purchase-update-item strong { display: block; font-size: 12px; color: #0f2c21; }
.purchase-update-item small { display: block; margin: 2px 0; color: #40584e; font-size: 11px; line-height: 1.4; }
.purchase-update-item time { display: block; color: #6b8078; font-size: 10px; }
.purchase-update-empty { margin: 7px 0 2px; padding: 10px; border-radius: 8px; background: #e7f2ed; color: #49665b; text-align: center; }
.purchase-quick-portal { position: relative; flex: 0 0 auto; }
.purchase-quick-toggle { display: inline-flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 38px; padding: 8px 12px; border: 1px solid #bcd2c8; background: #fff; color: #174f3e; box-shadow: 0 4px 14px rgba(23, 35, 30, .05); }
.purchase-quick-toggle:hover, .purchase-quick-toggle:focus-visible { border-color: #78a995; background: #f4faf7; color: #174f3e; outline: 3px solid rgba(21, 91, 69, .16); outline-offset: 2px; }
.purchase-quick-toggle > span:last-child { transition: transform .2s ease; }
.purchase-quick-toggle[aria-expanded="true"] > span:last-child { transform: rotate(180deg); }
.purchase-quick-links { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; display: grid; gap: 6px; width: min(250px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--pm-border); border-radius: var(--pm-radius); background: #fff; box-shadow: var(--pm-shadow); }
.purchase-quick-links[hidden] { display: none; }
.purchase-quick-links a, .purchase-quick-links button { display: block; width: 100%; min-height: 36px; padding: 9px 10px; border: 1px solid transparent; border-radius: 7px; background: #fff; color: #314b41; font-size: 12px; font-weight: 800; text-align: left; }
.purchase-quick-links a:hover, .purchase-quick-links button:hover, .purchase-quick-links a:focus-visible, .purchase-quick-links button:focus-visible { border-color: #bcd2c8; background: #f0f8f4; color: #174f3e; outline: 2px solid rgba(21, 91, 69, .16); outline-offset: 1px; }

.purchase-action-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.purchase-section-kicker {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}
.purchase-section-kicker h3 {
  margin: 0;
  font-size: 15px;
}
.purchase-action-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--pm-border);
  border-top: 4px solid transparent;
  border-radius: var(--pm-radius);
  background: #fff;
  color: var(--pm-text);
  text-align: left;
  box-shadow: 0 8px 24px rgba(23, 35, 30, .06);
}
.purchase-action-card strong {
  font-size: 15px;
  line-height: 1.28;
}
.purchase-action-card-create { border-top-color: #195b47; }
.purchase-action-card-queue { border-top-color: #2563eb; }
.purchase-workflow-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
}
.purchase-workflow-heading h3 {
  margin: 0;
  font-size: 15px;
}
.purchase-workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  counter-reset: purchase-step;
}
.purchase-status-tile { position: relative; overflow: hidden; border-left: 0; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.pm-workflow-tile { border-radius: var(--pm-radius, 8px); color: var(--pm-text, #17231e); }
.purchase-status-tile:hover { transform: translateY(-2px); color: var(--pm-text); box-shadow: 0 14px 30px rgba(23, 32, 51, .1); }
.purchase-status-tile:focus-visible { outline: 3px solid rgba(37, 99, 235, .22); outline-offset: 3px; color: var(--pm-text); box-shadow: 0 14px 30px rgba(23, 32, 51, .1); }
.purchase-status-tile.purchase-tile-green { border-color: #cfe2d7; background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%); }
.purchase-status-tile.purchase-tile-yellow { border-color: #ead39a; background: linear-gradient(180deg, #ffffff 0%, #fffaf0 100%); }
.purchase-status-tile.purchase-tile-red { border-color: #efb8b2; background: linear-gradient(180deg, #ffffff 0%, #fff6f5 100%); }
.purchase-workflow-step {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 134px;
  padding: 16px;
  border: 1px solid var(--pm-border);
  border-top: 4px solid #8aa398;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 35, 30, .06);
  isolation: isolate;
}
.purchase-workflow-step .metric-label {
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(21, 91, 69, .09);
  color: #155b45;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
}
.purchase-workflow-step strong {
  overflow-wrap: anywhere;
  hyphens: auto;
  font-size: 16px;
  line-height: 1.24;
}
.purchase-tile-counts { display: flex; flex-wrap: wrap; gap: 7px; align-self: end; margin-top: auto; min-height: 28px; }
.purchase-count-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 5px 8px; border: 1px solid rgba(23, 32, 51, .12); border-radius: 999px; background: rgba(255, 255, 255, .82); color: #344054; font-size: 11px; font-weight: 800; line-height: 1; }
.purchase-count-pill strong { font-size: 12px; line-height: 1; }
.purchase-tile-yellow .purchase-count-pending { border-color: #e7c16a; color: #8a5a00; background: #fff7df; }
.purchase-tile-red .purchase-count-overdue { border-color: #f0b4af; color: #9e2f27; background: #fff0ef; }

body.po360-open { overflow: hidden; }
.po360-workspace { position: fixed; inset: 0; z-index: 1200; background: #f4f7f5; color: #17231e; }
.po360-workspace[hidden] { display: none; }
.po360-shell { height: 100vh; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; overflow: hidden; }
.po360-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 18px 24px; border-bottom: 1px solid #dfe8e2; background: #fff; box-shadow: 0 10px 24px rgba(26, 52, 40, .08); }
.po360-header h2 { margin: 2px 0 4px; font-size: 26px; letter-spacing: 0; }
.po360-header p { margin: 0; color: #5b6b62; }
.po360-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.po360-total { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 10px; border: 1px solid #cddbd2; border-radius: 8px; background: #f8fbf9; font-weight: 900; }
.po360-toolbar { display: grid; grid-template-columns: minmax(260px, 1.8fr) repeat(5, minmax(140px, 1fr)); gap: 10px; padding: 14px 24px; border-bottom: 1px solid #dfe8e2; background: #fbfdfc; }
.po360-toolbar label { display: grid; gap: 5px; margin: 0; color: #506157; font-size: 12px; font-weight: 800; }
.po360-toolbar input, .po360-toolbar select { width: 100%; min-height: 38px; border: 1px solid #cbd8d1; border-radius: 8px; padding: 8px 10px; background: #fff; color: #17231e; font: inherit; }
.po360-search-field { grid-column: span 2; }
.po360-toolbar-actions { display: flex; align-items: end; gap: 8px; }
.po360-summary { padding: 10px 24px; border-bottom: 1px solid #e3ebe6; background: #fff; color: #52645a; font-size: 13px; font-weight: 700; pointer-events: none; }
.po360-results { min-height: 0; overflow: auto; padding: 0 24px 112px; scroll-padding: 76px 0 136px; }
.po360-table-wrap { min-width: 1120px; }
.po360-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 14px 0 0; background: #fff; border: 1px solid #dce6e0; border-radius: 8px; overflow: hidden; }
.po360-table th, .po360-table td { padding: 10px; border-bottom: 1px solid #edf2ef; text-align: left; vertical-align: top; font-size: 13px; }
.po360-table th { position: sticky; top: 0; z-index: 1; background: #eef5f1; color: #31463a; font-size: 12px; text-transform: uppercase; }
.po360-table th button { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; font-weight: 900; cursor: pointer; }
.po360-table button { scroll-margin: 96px 0 140px; }
.po360-table td span { display: block; }
.po360-doc-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 190px; }
.po360-doc-action { min-height: 30px; padding: 5px 8px; font-size: 12px; }
.po360-doc-muted { color: #7b8981; font-size: 12px; }
.po360-status { display: inline-flex; width: fit-content; max-width: 180px; border: 1px solid #d8e0dc; border-radius: 999px; padding: 4px 8px; background: #f8faf9; color: #425248; font-size: 12px; font-weight: 900; }
.po360-status-success { border-color: #b7d7c3; background: #edf8f0; color: #23613c; }
.po360-status-warning { border-color: #ecd083; background: #fff8df; color: #875a08; }
.po360-status-danger { border-color: #efb8b2; background: #fff0ef; color: #a2342a; }
.po360-status-info { border-color: #b8d5eb; background: #eef7ff; color: #225f8f; }
.po360-skeleton-row td { color: #607066; background: linear-gradient(90deg, #f6faf8, #fff, #f6faf8); }
.po360-results .empty-state { min-height: 96px; display: grid; align-content: center; justify-items: start; gap: 10px; position: relative; z-index: 3; }
.po360-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 24px; border-top: 1px solid #dfe8e2; background: #fff; pointer-events: none; }
.po360-pagination button { pointer-events: auto; }
.po360-pagination button:disabled { pointer-events: none; }
.po360-drawer { position: fixed; inset: 0; z-index: 1210; display: flex; justify-content: flex-end; background: rgba(18, 31, 25, .32); }
.po360-drawer[hidden] { display: none; }
.po360-drawer-panel { width: min(720px, 100%); height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #fff; box-shadow: -20px 0 45px rgba(13, 29, 21, .22); }
.po360-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px; border-bottom: 1px solid #dfe8e2; }
.po360-drawer-head h3 { margin: 3px 0 4px; font-size: 22px; letter-spacing: 0; }
.po360-drawer-head p { margin: 0; color: #617268; }
.po360-drawer-body { min-height: 0; overflow: auto; padding: 16px 18px 24px; }
.po360-detail-section { padding: 14px 0; border-bottom: 1px solid #edf2ef; }
.po360-detail-section h4 { margin: 0 0 10px; font-size: 15px; letter-spacing: 0; }
.po360-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.po360-facts div { padding: 9px; border: 1px solid #e0e8e3; border-radius: 8px; background: #fbfdfc; }
.po360-facts dt { color: #5d6d64; font-size: 12px; font-weight: 800; }
.po360-facts dd { margin: 3px 0 0; color: #17231e; font-weight: 800; overflow-wrap: anywhere; }
.po360-history-item, .po360-timeline-item, .po360-data-note { display: grid; gap: 4px; margin: 8px 0; padding: 10px; border: 1px solid #e1e9e4; border-radius: 8px; background: #fbfdfc; }
.po360-history-item span, .po360-timeline-item span, .po360-timeline-item p { margin: 0; color: #63736a; font-size: 12px; }

.purchase-request-dashboard { grid-template-rows: auto minmax(0, 1fr); }
.crm-pr-command-toolbar { display: grid; grid-template-columns: minmax(240px, 1.6fr) repeat(4, minmax(130px, 1fr)); gap: 10px; padding: 12px 0 14px; border-bottom: 1px solid #e0e8e3; }
.crm-pr-command-toolbar label { display: grid; gap: 5px; margin: 0; color: #506157; font-size: 12px; font-weight: 800; }
.crm-pr-command-toolbar input, .crm-pr-command-toolbar select { width: 100%; min-height: 36px; border: 1px solid #cbd8d1; border-radius: 8px; padding: 7px 9px; background: #fff; color: #17231e; font: inherit; }
.crm-pr-command-search { grid-column: span 2; }
.crm-pr-command-summary { padding: 10px 0; color: #52645a; font-size: 13px; font-weight: 700; }
.crm-pr-command-layout { min-height: 0; }
.crm-pr-command-list, .crm-pr-command-detail { min-width: 0; }
.crm-pr-command-cards { align-content: start; max-height: min(62vh, 680px); overflow: auto; padding-right: 4px; }
.crm-pr-command-card { display: grid; gap: 12px; min-width: 0; padding: 14px; border: 1px solid #d9e2ec; border-left: 4px solid #6da18c; border-radius: 8px; background: #fff; box-shadow: 0 7px 20px rgba(23, 32, 51, .05); }
.crm-pr-command-card.is-cancelled { border-left-color: #a8b0b8; background: #f8fafc; }
.crm-pr-command-status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.crm-pr-command-preview { display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.crm-pr-command-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 32px; padding: 5px 7px; border: 1px solid #dfe8e3; border-radius: 7px; background: #fbfdfc; color: #263b33; font-size: 12px; }
.crm-pr-command-chip strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-pr-command-chip small { color: #64756c; }
.crm-pr-command-chip.is-linked { border-color: #b7d7c3; background: #edf8f0; }
.crm-pr-command-chip.is-unlinked { border-color: #ecd083; background: #fff8df; }
.crm-pr-command-chip.is-matched { box-shadow: 0 0 0 2px rgba(25, 91, 71, .16); }
.crm-pr-command-chip.is-selected { border-color: #195b47; background: #e8f5ee; box-shadow: 0 0 0 2px rgba(25, 91, 71, .14); }
.crm-pr-command-select { display: inline-flex; align-items: center; gap: 0; margin: 0; }
.crm-pr-command-select input { width: 16px; height: 16px; min-height: 16px; padding: 0; accent-color: #195b47; }
.crm-pr-command-icon { min-height: 26px; padding: 4px 6px; font-size: 11px; }
.crm-pr-bulk-selection-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 12px; padding: 12px 14px; border: 1px solid #b9d8ca; border-left: 4px solid #195b47; border-radius: 8px; background: #f2faf6; }
.crm-pr-bulk-selection-bar[hidden], .crm-pr-bulk-link-panel[hidden], .crm-pr-relink-panel[hidden] { display: none; }
.crm-pr-bulk-selection-bar > div:first-child, .crm-pr-bulk-link-panel, .crm-pr-relink-panel { min-width: 0; }
.crm-pr-bulk-selection-bar strong { display: block; color: #183c31; }
.crm-pr-bulk-link-panel, .crm-pr-relink-panel { margin: 0 0 12px; padding: 12px; border: 1px solid #d8e4de; border-radius: 8px; background: #fbfdfc; }
.crm-pr-command-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 10px 0 0; }
.crm-pr-command-detail { max-height: min(68vh, 740px); overflow: auto; padding-right: 4px; }
.purchase-request-list { min-height: 0; overflow-y: auto; padding: 2px 4px 8px 0; }
.purchase-request-list > h3 { margin-bottom: 3px; }
.purchase-request-list > p { margin-top: 0; }
.purchase-request-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.purchase-request-summary-card { display: grid; gap: 14px; min-width: 0; padding: 17px; border: 1px solid #d9e2ec; border-left: 5px solid #d69e13; border-radius: 12px; background: #fff; box-shadow: 0 7px 20px rgba(23, 32, 51, .06); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.purchase-request-summary-card:hover, .purchase-request-summary-card:focus-visible { border-color: #6da18c; outline: 3px solid rgba(25, 91, 71, .12); outline-offset: 1px; transform: translateY(-1px); }
.purchase-request-summary-card.is-selected { border-color: #195b47; border-left-color: #195b47; background: #f2faf6; box-shadow: 0 0 0 2px rgba(25, 91, 71, .13), 0 9px 24px rgba(23, 32, 51, .08); }
.purchase-request-card-head, .purchase-request-card-head > div { display: flex; align-items: center; justify-content: space-between; gap: 9px; flex-wrap: wrap; }
.purchase-request-card-head strong { font-size: 16px; }
.purchase-request-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.purchase-request-facts div { min-width: 0; }
.purchase-request-facts .wide { grid-column: 1 / -1; }
.purchase-request-facts dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.purchase-request-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; color: #293b34; font-size: 13px; font-weight: 650; }
.purchase-request-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid #e4ebe7; }
.purchase-request-actions button { flex: 1 1 180px; }
.purchase-confirm-modal { width: min(500px, 100%); }
.purchase-confirm-modal h2 { margin-top: 0; }

.pm-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--pm-border, #d7e3dd);
  border-radius: var(--pm-radius, 8px);
  background: var(--pm-surface, #fff);
  box-shadow: 0 8px 22px rgba(23, 35, 30, .06);
}
.pm-card h3 { margin: 0 0 10px; color: var(--pm-text, #17231e); font-size: 14px; }
.pm-section { display: grid; gap: 12px; }
.pm-file-drop {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--pm-border, #d7e3dd);
  border-radius: var(--pm-radius, 8px);
  background: var(--pm-surface-muted, #f4f8f6);
}
.pm-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  overflow: auto;
}
.pm-review-list { display: grid; gap: 8px; }
.pm-review-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e1e9e5;
  border-left: 4px solid var(--pm-info, #2563eb);
  border-radius: 7px;
  background: #fff;
}
.pm-review-item.ready { border-left-color: var(--pm-success, #18864b); }
.pm-review-item.missing, .pm-review-item.issue { border-left-color: var(--pm-warning, #b7791f); }
.pm-review-item.ignored { border-left-color: #8a9a93; }
.pm-review-item strong { overflow-wrap: anywhere; }
.pm-review-item span { color: var(--pm-text-muted, #5f7168); font-size: 12px; }
.pm-alert {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #c9d9d2;
  border-radius: var(--pm-radius, 8px);
  background: var(--pm-surface-muted, #f4f8f6);
  color: var(--pm-text, #17231e);
  font-size: 13px;
}
.purchase-processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 26, 21, .46);
  backdrop-filter: blur(2px);
}
.purchase-processing-overlay[hidden] { display: none; }
.purchase-processing-box {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(360px, 100%);
  padding: 24px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--pm-radius, 8px);
  background: #fff;
  color: var(--pm-text, #17231e);
  box-shadow: var(--pm-shadow, 0 14px 34px rgba(23, 35, 30, .12));
  text-align: center;
}
.purchase-processing-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d6e5df;
  border-top-color: var(--pm-primary, #155b45);
  border-radius: 50%;
  animation: pmSpin .8s linear infinite;
}
@keyframes pmSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .purchase-shell .purchase-status-tile,
  .purchase-shell .purchase-quick-toggle > span:last-child,
  .purchase-shell .purchase-processing-spinner {
    transition: none;
    animation: none;
  }

  .purchase-shell .purchase-status-tile:hover {
    transform: none;
  }
}

#pmClaimModal .workflow-modal { padding: 20px; }
#pmClaimModal form { min-height: 0; overflow-y: auto; padding: 10px 5px 12px; align-content: start; }
#pmClaimModal form > label { min-width: 0; padding-top: 2px; }
#pmClaimModal .claim-product-filters { margin-top: 8px; align-items: end; }

.claim-track { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 10px; }
.claim-track.is-complete { border-color: #86c89a; background: #f1fbf4; }
.claim-track.is-pending { background: #f8fafc; }
.claim-completion { display: grid; gap: 4px; }
.claim-completion span { color: var(--muted); font-size: 0.86rem; }
.claim-error { color: #b42318 !important; font-weight: 700; }
#pmClaimModal .compact-table { margin-top: 12px; }
#pmClaimModal .compact-table input, #pmClaimModal .compact-table textarea { min-width: 110px; }

@media (max-width: 900px) {
  .purchase-action-strip, .purchase-workflow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pm-review-grid { grid-template-columns: 1fr; }
  .purchase-request-card-grid { grid-template-columns: 1fr; }
  .purchase-topbar { align-items: flex-start; }
  .purchase-header-actions { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .purchase-shell .main { padding: 16px; }
  .topbar {
    height: auto;
    display: grid;
    gap: 12px;
  }
  .purchase-header-actions { width: 100%; justify-content: stretch; }
  .purchase-quick-portal, .purchase-quick-toggle { width: 100%; }
  .purchase-quick-links { left: 0; right: auto; width: min(100%, calc(100vw - 32px)); }
  .user-pill {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: space-between;
    border-radius: 8px;
  }
  .purchase-action-strip, .purchase-workflow-grid { grid-template-columns: 1fr; }
  .purchase-section-kicker, .purchase-workflow-heading { display: grid; align-items: start; }
  .purchase-request-facts { grid-template-columns: 1fr; }
  .purchase-request-facts .wide { grid-column: auto; }
  .purchase-request-actions { display: grid; }
  #pmClaimModal form { grid-template-columns: 1fr; }
  #pmClaimModal form > * { grid-column: 1 !important; }
}

.inventory-modal {
  width: min(1180px, 100%);
}

.inventory-toolbar {
  align-items: center;
}

.inventory-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.inventory-modal .table-wrap {
  min-height: min(58vh, 560px);
  max-height: calc(86vh - 145px);
  overflow: auto;
  scrollbar-gutter: stable;
}

#inventoryViewerTable {
  table-layout: fixed;
}

#inventoryViewerTable th,
#inventoryViewerTable td {
  overflow-wrap: anywhere;
}

#inventoryViewerTable thead th,
.selected-lines-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #173f3a;
  color: #fff;
  box-shadow: 0 1px 0 var(--line);
}

.workflow-modal {
  width: min(98vw, 1760px);
  height: min(94vh, 980px);
  max-height: 94vh;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
  background: #fff;
}

#sracPurchaseCorrectionsModal .workflow-modal {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px 20px 14px;
}

.workflow-modal > .panel-header {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -20px -20px 0;
  padding: 18px 20px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.06);
}

#sracPurchaseCorrectionsModal .workflow-modal > .panel-header {
  position: static;
  margin: 0;
  padding: 0 0 12px;
}

#sracPurchaseCorrectionFilters {
  grid-template-columns: minmax(320px, 1fr) minmax(140px, 180px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 0;
  padding: 0 0 2px;
}

#sracPurchaseCorrectionFilters > * {
  min-width: 0;
}

.srac-stock-audit-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px 20px 16px;
}

.srac-stock-audit-modal > .panel-header {
  position: static;
  margin: 0;
  padding: 0 0 12px;
}

.srac-audit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.srac-audit-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  padding: 9px 12px;
}

.srac-audit-tabs button.active {
  border-color: var(--brand);
  background: #e8f4ef;
  color: var(--brand-dark);
}

.srac-stock-audit-modal [data-stock-audit-panel] {
  min-height: 0;
  overflow: auto;
}

.srac-stock-audit-table {
  min-height: 260px;
  max-height: min(58vh, 620px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.srac-stock-audit-table table {
  min-width: 1320px;
}

.srac-stock-audit-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #173f3a;
  color: #fff;
}

.srac-stock-audit-table td {
  vertical-align: top;
}

.srac-purchase-table-wrap {
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.srac-purchase-table-wrap table {
  min-width: 1280px;
}

.srac-purchase-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--line);
}

.srac-purchase-table-wrap td {
  vertical-align: middle;
}

.srac-purchase-table-wrap th:nth-child(1),
.srac-purchase-table-wrap td:nth-child(1) {
  min-width: 180px;
}

.srac-purchase-table-wrap th:nth-child(5),
.srac-purchase-table-wrap td:nth-child(5) {
  min-width: 360px;
}

.srac-purchase-table-wrap th:nth-child(10),
.srac-purchase-table-wrap td:nth-child(10) {
  min-width: 150px;
}

.srac-purchase-pager {
  align-items: center;
  padding-top: 2px;
}

.workflow-modal > .order-card-grid,
.workflow-modal > .correction-chunk-grid,
.workflow-modal > .modal-work-grid,
.workflow-modal > .sales-screen-grid {
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 4px 0;
}

.workflow-modal > .correction-chunk-grid {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 12px;
}

#orderCorrectionModal .workflow-modal {
  grid-template-rows: auto auto minmax(0, 1fr);
}

#orderCorrectionDetailModal .panel-header > div {
  min-width: 0;
}

#orderCorrectionDetailTitle,
#orderCorrectionDetailSubtext {
  overflow-wrap: anywhere;
}

#salesOrderModal .workflow-modal {
  width: min(96vw, 1760px);
  max-height: 94vh;
  overflow: hidden;
}

#salesOrderModal label,
#salesOrderModal input,
#salesOrderModal select,
#salesOrderModal textarea,
#salesOrderModal button {
  font-size: 14px;
}

.sales-screen-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
  grid-template-areas:
    "setup entry"
    "lines lines"
    "staged staged";
  gap: 16px;
}

.sales-setup-panel,
.sales-entry-panel,
.selected-lines-panel,
.staged-sales-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.sales-setup-panel {
  grid-area: setup;
  display: grid;
  gap: 12px;
  align-self: start;
}

.sales-entry-panel {
  grid-area: entry;
}

.sales-screen-grid .selected-lines-panel {
  grid-area: lines;
  min-height: 260px;
}

.staged-sales-panel {
  grid-area: staged;
}

.sales-condition-grid,
.sales-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sales-product-grid .wide {
  grid-column: 1 / -1;
}

.staged-sales-orders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.staged-sales-card {
  border: 1px solid var(--line);
  border-top: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  position: relative;
}

.staged-sales-cancel {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border: 1px solid #dc2626;
  border-radius: 50%;
  background: #fff;
  color: #dc2626;
  font-size: 20px;
  line-height: 22px;
  font-weight: 800;
  z-index: 2;
}

.staged-sales-cancel:hover,
.staged-sales-cancel:focus-visible {
  background: #dc2626;
  color: #fff;
}

.staged-sales-card:hover,
.staged-sales-card:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 6px 18px rgba(15, 52, 67, .13);
  outline: none;
}

.staged-sales-card.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24, 111, 101, .18);
  background: #f3fbf9;
}

.staged-sales-card h3 {
  margin: 0;
  font-size: 16px;
}

.staged-sales-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
}

.staged-sales-meta span {
  color: var(--muted);
}

.scheduler-layout {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(360px, 1.2fr);
  gap: 20px;
}

.scheduler-form {
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfb;
}

.scheduler-task-list { display: grid; gap: 10px; max-height: 60vh; overflow: auto; }
.scheduler-task-card { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 9px; padding: 12px; background: #fff; }
.scheduler-task-card.is-disabled { opacity: .62; border-left-color: #8a9498; }
.scheduler-task-card h3 { margin: 0 0 5px; }
.scheduler-task-card .actions { margin-top: 10px; }

.scheduler-reminder-stack {
  position: fixed;
  z-index: 1200;
  right: 18px;
  bottom: 18px;
  width: min(390px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.scheduler-reminder {
  pointer-events: auto;
  border: 1px solid #d69c2f;
  border-left: 6px solid #d69c2f;
  border-radius: 10px;
  padding: 14px;
  background: #fffaf0;
  box-shadow: 0 12px 35px rgba(26, 39, 44, .24);
}
.scheduler-reminder h3 { margin: 3px 0 6px; }
.scheduler-reminder .actions { margin-top: 10px; }

@media (max-width: 800px) {
  .scheduler-layout { grid-template-columns: 1fr; }
}

.staged-sales-meta strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.modal-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.sales-work-grid {
  grid-template-columns: minmax(620px, 1.35fr) minmax(420px, 0.95fr);
  align-items: start;
}

.demand-work-grid {
  grid-template-columns: minmax(580px, 1.2fr) minmax(440px, 0.95fr) minmax(260px, 0.55fr);
}

.demand-file-modal {
  width: min(98vw, 1900px);
  height: 96vh;
  max-height: 96vh;
  padding: 0;
  gap: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.demand-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.demand-modal-body {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px;
  background: #f8fafc;
}

.demand-order-context {
  display: grid;
  grid-template-columns: minmax(320px, 680px) 1fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.demand-fast-entry {
  position: sticky;
  top: -16px;
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 160px auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin: 0 -4px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(16, 37, 31, 0.08);
}

.demand-fast-entry button {
  min-height: 42px;
}

.demand-tall-suggestions {
  max-height: 60vh;
  z-index: 20;
}

.demand-tall-suggestions .suggestion {
  padding: 8px 12px;
}

.demand-selected-section {
  min-height: 340px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.demand-selected-section .selected-lines-list {
  max-height: none;
}

#demandLinesTable {
  min-width: 680px;
}

#demandLinesTable .item-name-col {
  width: auto;
}

.demand-modal-footer {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 -4px 14px rgba(16, 37, 31, 0.08);
}

.demand-totals {
  display: flex;
  gap: 18px;
  white-space: nowrap;
}

.demand-update-alert-card {
  border-top: 4px solid #d97706;
}

.change-positive {
  color: #087443;
}

.change-negative {
  color: #b42318;
}

.demand-review-modal .table-wrap {
  max-height: 58vh;
  overflow: auto;
}

.selected-lines-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
  align-self: stretch;
  min-height: 420px;
}

.demand-entry-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.demand-entry-grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

.demand-filter-row,
.demand-line-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.demand-line-row {
  grid-template-columns: minmax(190px, 1.4fr) minmax(130px, 0.9fr) minmax(96px, 0.45fr) auto;
}

.demand-line-row button {
  min-height: 42px;
}

.order-correction-card {
  border-top: 4px solid #f97316;
}

.selected-pack-panel {
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
}

.selected-pack-panel h3 {
  margin: 0 0 8px;
}

.selected-pack-panel .pack-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.selected-pack-panel .pack-meta span {
  color: var(--muted);
  font-size: 12px;
}

.selected-pack-panel .pack-meta strong {
  display: block;
  color: var(--ink);
  margin-top: 2px;
}

.selected-lines-list {
  display: grid;
  gap: 10px;
  max-height: calc(86vh - 185px);
  overflow: auto;
  padding-right: 4px;
}

.selected-lines-table-wrap {
  overflow-y: auto;
  overflow-x: auto;
}

.selected-lines-table {
  table-layout: fixed;
  min-width: 1180px;
}

.selected-lines-table th,
.selected-lines-table td {
  padding: 8px 7px;
  font-size: 12px;
  vertical-align: middle;
}

.selected-lines-table .item-name-col {
  width: 260px;
}

.selected-lines-table .qty-col {
  width: 82px;
}

.selected-lines-table .rate-col {
  width: 90px;
}

.selected-lines-table .action-col {
  width: 70px;
}

.item-name-cell {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.line-qty-input {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  padding: 7px 6px;
}

.icon-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.sales-rate-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sales-rate-status {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 700;
}

.sales-rate-status.pending {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}

.sales-rate-status.ready {
  color: #067647;
  background: #ecfdf3;
  border-color: #abefc6;
}

.sales-rates-modal {
  width: min(720px, 100%);
}

.sales-rates-message {
  color: var(--muted);
}

.sales-rates-table {
  min-width: 100%;
}

.sales-rates-table th:last-child,
.sales-rates-table td:last-child {
  width: 180px;
}

.sales-rates-table input {
  min-width: 140px;
}

#salesOrderModal {
  padding: 6px;
  background: rgba(8, 22, 18, 0.84);
}

#salesOrderModal .modal {
  width: min(1640px, calc(100vw - 12px));
  max-width: none;
  height: calc(100vh - 12px);
  max-height: calc(100vh - 12px);
  padding: 12px 16px 8px;
  gap: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #fff;
  border-color: #c8d6d1;
}

#salesOrderModal .workflow-modal > .panel-header {
  flex: 0 0 auto;
  margin: -12px -16px 0;
  padding: 8px 16px 7px;
}

#salesOrderModal .workflow-modal > .panel-header h2 {
  font-size: 20px;
}

#salesOrderModal .sales-screen-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 2px 10px 0;
  grid-template-columns: minmax(360px, 0.82fr) minmax(460px, 1.18fr);
  grid-template-areas:
    "setup entry"
    "lines lines"
    "staged staged";
  /* Size the setup row from its controls so they cannot spill into the lines panel. */
  grid-template-rows: max-content minmax(430px, 52vh) minmax(320px, auto);
  gap: 8px;
  align-items: stretch;
  scrollbar-color: #8aa39b #eef3f1;
  scrollbar-width: thin;
}

#salesOrderModal.is-workspace-mounted {
  position: static;
  inset: auto;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
}

#salesOrderModal.is-workspace-mounted .modal {
  width: 100%;
  height: auto;
  max-height: none;
  min-height: calc(100vh - 132px);
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.ntw-workspace-content #salesOrderModal.is-workspace-mounted .modal {
  width: 100%;
}

#salesOrderModal.is-workspace-mounted .workflow-modal > .panel-header {
  display: none;
}

#salesOrderModal.is-workspace-mounted .sales-screen-grid {
  overflow: visible;
  padding: 0 0 16px;
  grid-template-columns: minmax(420px, 0.8fr) minmax(540px, 1.2fr);
}

#salesOrderModal .sales-setup-panel,
#salesOrderModal .sales-entry-panel,
#salesOrderModal .selected-lines-panel,
#salesOrderModal .staged-sales-panel {
  padding: 8px;
}

#salesOrderModal label {
  gap: 3px;
  font-size: 11px;
  line-height: 1.2;
}

#salesOrderModal input,
#salesOrderModal select,
#salesOrderModal textarea {
  min-height: 30px;
  padding: 6px 8px;
  border-radius: 6px;
}

#salesOrderModal button {
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 6px;
}

#salesOrderModal .sales-setup-panel {
  gap: 6px;
}

#salesOrderModal .sales-condition-grid {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
}

#salesOrderModal .sales-condition-grid label,
#salesOrderModal .sales-product-grid label {
  min-width: 0;
}

#salesOrderModal .sales-condition-grid label {
  overflow: hidden;
}

#salesOrderModal .sales-target-actions {
  gap: 6px;
}

#salesOrderModal .sales-product-grid {
  grid-template-columns: repeat(12, minmax(40px, 1fr));
  gap: 6px;
  align-items: end;
}

#salesOrderModal #salesOrderForm > label:nth-child(1),
#salesOrderModal #salesOrderForm > label:nth-child(2),
#salesOrderModal #salesOrderForm > label:nth-child(3) {
  grid-column: span 4;
}

#salesOrderModal .sales-product-search-field {
  grid-column: span 5;
}

#salesOrderModal .sales-selected-product-field {
  grid-column: span 4;
}

#salesOrderModal .sales-qty-field {
  grid-column: span 1;
}

#salesOrderModal #addSalesLine {
  grid-column: span 2;
}

#salesOrderModal .selected-lines-panel,
#salesOrderModal .staged-sales-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#salesOrderModal .selected-lines-panel {
  min-height: 430px;
}

#salesOrderModal .sales-entry-panel {
  position: relative;
  z-index: 5;
}

#salesOrderModal #salesLinesList {
  flex: 1 1 auto;
  min-height: 310px;
  max-height: none;
  overflow: auto;
}

#salesOrderModal .staged-sales-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 320px;
  overflow: visible;
}

#salesOrderModal .staged-sales-panel > .panel-header {
  margin-bottom: 0;
}

#salesOrderModal .sales-staged-workspace {
  flex: 0 0 auto;
  min-height: 190px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 10px;
  align-items: stretch;
}

#salesOrderModal #stagedSalesOrders {
  min-height: 190px;
  max-height: none;
  overflow: visible;
  padding: 2px 4px 8px 2px;
}

#salesOrderModal .sales-staged-notes {
  min-width: 0;
  min-height: 190px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}

#salesOrderModal .order-remark-field textarea {
  min-height: 148px;
  height: 100%;
  resize: vertical;
}

#salesOrderModal .staged-sales-panel .actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

#salesOrderModal .sales-action-hint {
  margin-right: auto;
  color: #b45309;
  font-size: 12px;
  font-weight: 800;
}

#salesOrderModal .sales-action-hint.ready {
  color: #067647;
}

#salesOrderModal #addSalesOrderDraft.is-ready {
  box-shadow: 0 0 0 3px rgba(22, 128, 60, 0.14);
}

#salesOrderModal .order-remark-field {
  margin: 0;
}

#salesOrderModal #salesDraftStatus {
  flex: 0 0 auto;
}

#salesOrderModal .selected-lines-panel > .panel-header,
#salesOrderModal .staged-sales-panel > .panel-header {
  flex: 0 0 auto;
  gap: 8px;
  margin-bottom: 6px;
}

#salesOrderModal .selected-lines-panel > .panel-header h2,
#salesOrderModal .staged-sales-panel > .panel-header h2 {
  font-size: 18px;
}

#salesOrderModal .selected-lines-table {
  margin-bottom: 0;
  min-width: 1480px;
}

#salesOrderModal .selected-lines-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#salesOrderModal .selected-lines-table thead th {
  top: 0;
}

#salesOrderModal .selected-lines-table th,
#salesOrderModal .selected-lines-table td {
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.25;
}

#salesOrderModal .item-name-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#salesOrderModal .inline-input,
#salesOrderModal .line-qty-input {
  min-height: 28px;
  padding: 4px 6px;
}

#salesOrderModal .staged-sales-orders {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-content: start;
  align-items: start;
  grid-auto-rows: auto;
  gap: 10px;
  margin-bottom: 0;
}

#salesOrderModal .staged-sales-card {
  width: auto;
  min-width: 0;
  height: auto;
  padding: 11px;
  border-color: #c8ded4;
  background: #f8fffb;
}

#salesOrderModal .staged-sales-card .selected-line-top {
  min-width: 0;
  padding-right: 34px;
  flex-wrap: wrap;
  gap: 6px 8px;
}

#salesOrderModal .staged-sales-card.is-newly-staged {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
  background: #f0fdf4;
}

#salesOrderModal .staged-sales-meta {
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  gap: 8px 10px;
  font-size: 12px;
  line-height: 1.3;
}

#salesOrderModal .staged-sales-meta span {
  min-width: 0;
}

#salesOrderModal .staged-sales-card h3 {
  min-width: 0;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#salesOrderModal .sales-rate-actions {
  flex: 0 0 auto;
}

#salesOrderModal .sales-existing-info {
  margin: 2px 0 0;
}

#salesOrderModal .sales-rate-status {
  padding: 5px 8px;
}

@media (max-width: 1280px) {
  #salesOrderModal.is-workspace-mounted .sales-screen-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "setup"
      "entry"
      "lines"
      "staged";
    grid-template-rows: auto auto minmax(360px, 1fr) minmax(260px, auto);
  }

  #salesOrderModal.is-workspace-mounted .selected-lines-panel {
    min-height: 360px;
  }
}

@media (max-width: 900px) {
  #salesOrderModal .sales-screen-grid {
    overflow: auto;
    grid-template-columns: 1fr;
    grid-template-areas:
      "setup"
      "entry"
      "lines"
      "staged";
    grid-template-rows: auto auto minmax(360px, 1fr) minmax(260px, auto);
  }

  #salesOrderModal .staged-sales-panel {
    min-height: 0;
  }

  #salesOrderModal .sales-staged-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  #salesOrderModal #stagedSalesOrders {
    max-height: none;
  }

  #salesOrderModal .sales-staged-notes,
  #salesOrderModal .order-remark-field textarea {
    min-height: 130px;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  #salesOrderModal .workflow-modal > .panel-header {
    padding: 7px 14px 6px;
  }

  #salesOrderModal .sales-screen-grid {
    grid-template-rows: max-content minmax(380px, 54vh) minmax(290px, auto);
    gap: 6px;
  }

  #salesOrderModal .selected-lines-panel {
    min-height: 380px;
  }

  #salesOrderModal #salesLinesList {
    min-height: 280px;
  }

  #salesOrderModal .staged-sales-panel > .panel-header .small {
    display: none;
  }

  #salesOrderModal .order-remark-field textarea {
    min-height: 120px;
  }
}

@media (max-width: 640px) {
  #salesOrderModal .sales-product-grid {
    grid-template-columns: 1fr;
  }

  #salesOrderModal #salesOrderForm > label:nth-child(1),
  #salesOrderModal #salesOrderForm > label:nth-child(2),
  #salesOrderModal #salesOrderForm > label:nth-child(3),
  #salesOrderModal .sales-product-search-field,
  #salesOrderModal .sales-selected-product-field,
  #salesOrderModal .sales-qty-field,
  #salesOrderModal #addSalesLine {
    grid-column: 1;
  }

  #salesOrderModal #addSalesLine {
    width: 100%;
  }
}

#crmPurchaseWorkspaceModal .purchase-process-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--line);
}

#crmPurchaseWorkspaceModal .purchase-process-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  height: auto;
  width: auto;
  min-width: 136px;
  max-width: max-content;
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 10px;
  background: #eef6f2;
  color: var(--brand);
  border: 1px solid #cfe4db;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: none;
}

#crmPurchaseWorkspaceModal .purchase-process-tab:hover {
  background: #dfeee8;
}

#crmPurchaseWorkspaceModal .purchase-process-tab.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

#crmPurchaseWorkspaceModal .purchase-process-tab.is-active:hover {
  background: var(--brand-dark);
}

#crmPurchaseWorkspaceModal .purchase-process-tab span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand);
  font-size: 11px;
  line-height: 1;
}

#crmPurchaseWorkspaceModal .purchase-process-tab.is-active span {
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand);
}

.purchase-process-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.purchase-process-summary span,
.purchase-linked-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.purchase-linked-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--ink);
}

.purchase-linked-panel.pending {
  color: var(--amber);
  background: #fffaeb;
  border-color: #fedf89;
}

#crmPurchaseWorkspaceModal .workflow-modal {
  width: min(1500px, 96vw);
  gap: 6px;
  overflow: auto;
}

#crmPurchaseWorkspaceModal .workflow-modal > .panel-header {
  padding-bottom: 10px;
}

#crmPurchaseWorkspaceModal #crmPurchaseRequestStatusCards {
  margin-top: 0;
  padding-top: 0;
}

#crmPurchaseWorkspaceModal #crmPurchaseRequestStatusCards,
#crmPurchaseWorkspaceModal #crmPurchaseProcessCards {
  max-height: 52vh;
  overflow: auto;
  padding-right: 4px;
}

#crmPurchaseRequestDetail {
  max-height: 42vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.purchase-linked-card {
  opacity: 0.9;
}

.crm-purchase-request-card-top {
  align-items: flex-start;
  gap: 10px;
}

.crm-purchase-request-no {
  max-width: min(190px, 58%);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-purchase-request-status {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.crm-purchase-request-status .badge {
  font-size: 11px;
  line-height: 1.1;
  padding: 6px 10px;
}

.purchase-request-inline-detail {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.purchase-request-group-detail {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.purchase-request-group-detail.is-locked {
  background: #f8fafc;
}

.purchase-request-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.purchase-request-group-head h4 {
  margin: 0 0 4px;
}

.purchase-inline-editor {
  display: grid;
  gap: 10px;
}

.purchase-inline-add {
  position: relative;
  display: grid;
  gap: 8px;
}

.purchase-inline-suggestions {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.purchase-inline-suggestions .suggestion {
  min-height: 54px;
}

#crmPurchaseWorkspaceModal {
  overflow: hidden;
}

#crmPurchaseWorkspaceModal .crm-purchase-process-modal {
  width: min(98vw, 1840px);
  height: min(96vh, 1040px);
  max-width: none;
  max-height: 96vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  box-sizing: border-box;
}

#crmPurchaseWorkspaceModal .crm-pr-workspace {
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-purchase-process-modal *,
#crmPurchaseWorkspaceModal .crm-purchase-process-modal *::before,
#crmPurchaseWorkspaceModal .crm-purchase-process-modal *::after {
  box-sizing: border-box;
}

#crmPurchaseWorkspaceModal .crm-purchase-process-header {
  position: sticky;
  top: 0;
  z-index: 4;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #d8e3dd;
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-purchase-process-header h2 {
  font-size: 20px;
  letter-spacing: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(140px, 0.8fr)) auto;
  gap: 10px;
  align-items: end;
  width: 100%;
  min-width: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid #d8e3dd;
  background: #f3f6f5;
}

#crmPurchaseWorkspaceModal .crm-pr-toolbar label,
#crmPurchaseWorkspaceModal .crm-pr-create label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #52635c;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

#crmPurchaseWorkspaceModal .crm-pr-toolbar input,
#crmPurchaseWorkspaceModal .crm-pr-toolbar select,
#crmPurchaseWorkspaceModal .crm-pr-create input,
#crmPurchaseWorkspaceModal .crm-pr-create select,
#crmPurchaseWorkspaceModal .crm-pr-create textarea {
  width: 100%;
  min-width: 0;
}

#crmPurchaseWorkspaceModal .purchase-process-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  margin: 0;
  padding: 10px 18px;
  border-bottom: 1px solid #d8e3dd;
  background: #f7faf8;
}

#crmPurchaseWorkspaceModal .purchase-process-tab {
  min-height: 34px;
  min-width: auto;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .purchase-process-tab:focus-visible,
#crmPurchaseWorkspaceModal .crm-pr-summary-button:focus-visible,
#crmPurchaseWorkspaceModal .purchase-request-group-head button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

#crmPurchaseWorkspaceModal .crm-purchase-process-body {
  display: grid;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  padding: 12px 18px 18px;
  background: #f3f6f5;
}

#crmPurchaseWorkspaceModal .crm-pr-create,
#crmPurchaseWorkspaceModal .crm-pr-list-pane {
  min-width: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-list-pane[hidden],
#crmPurchaseWorkspaceModal .crm-pr-create[hidden] {
  display: none;
}

#crmPurchaseWorkspaceModal .crm-pr-list-pane {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-width: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-create {
  min-height: 100%;
}

#crmPurchaseWorkspaceModal .crm-pr-create .purchase-request-form {
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  align-items: start;
  gap: 14px;
}

#crmPurchaseWorkspaceModal .crm-pr-create-head,
#crmPurchaseWorkspaceModal .crm-pr-buyer-field,
#crmPurchaseWorkspaceModal .crm-pr-remark-field,
#crmPurchaseWorkspaceModal .crm-pr-item-source,
#crmPurchaseWorkspaceModal .crm-pr-excel-entry,
#crmPurchaseWorkspaceModal .crm-pr-create-actions {
  grid-column: 1 / -1;
}

#crmPurchaseWorkspaceModal .crm-pr-create .panel-header {
  align-items: center;
  padding: 0 0 6px;
}

#crmPurchaseWorkspaceModal .crm-pr-create h3 {
  margin: 0;
  color: #10251f;
  font-size: 16px;
}

#crmPurchaseWorkspaceModal .crm-pr-item-source {
  border: 1px solid #d7e2dd;
  background: #f8faf9;
  border-radius: 8px;
  padding: 12px;
}

#crmPurchaseWorkspaceModal .crm-pr-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-source-head h4 {
  margin: 0 0 2px;
  color: #10251f;
  font-size: 15px;
}

#crmPurchaseWorkspaceModal .crm-pr-source-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

#crmPurchaseWorkspaceModal .crm-pr-source-selector button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #c8d8d1;
  border-radius: 6px;
  background: #fff;
  color: #445951;
}

#crmPurchaseWorkspaceModal .crm-pr-source-selector button.is-active {
  border-color: #1b6f5a;
  background: #e9f7f2;
  color: #0f4f40;
  box-shadow: inset 0 0 0 1px #1b6f5a;
}

#crmPurchaseWorkspaceModal .crm-pr-buyer-field {
  max-width: 620px;
}

#crmPurchaseWorkspaceModal .crm-pr-create-main,
#crmPurchaseWorkspaceModal .crm-pr-draft-review {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #d7e2dd;
  border-radius: 8px;
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-pr-create-main {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#crmPurchaseWorkspaceModal .crm-pr-draft-review {
  align-self: stretch;
  min-height: 320px;
  background: #f8faf9;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-entry {
  display: grid;
  gap: 10px;
  min-width: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-entry[hidden] {
  display: none;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-dropzone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px dashed #9bb0a8;
  border-radius: 8px;
  background: #f8faf9;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-dropzone strong,
#crmPurchaseWorkspaceModal .crm-pr-excel-dropzone span {
  display: block;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-filename,
#crmPurchaseWorkspaceModal .crm-pr-excel-summary {
  min-width: 0;
  color: #50645c;
  font-size: 13px;
  overflow-wrap: anywhere;
}

#crmPurchaseWorkspaceModal .crm-pr-excel-summary {
  color: #0f6b55;
  font-weight: 800;
}

#crmPurchaseWorkspaceModal .crm-pr-create-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  margin: 0 -18px -18px;
  padding: 10px 18px;
  border-top: 1px solid #d8e3dd;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  color: #50645c;
  font-size: 13px;
  font-weight: 850;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e1e9e5;
  border-radius: 8px;
  background: #f8faf9;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-group + .crm-pr-draft-group {
  margin-top: 8px;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-group-head,
#crmPurchaseWorkspaceModal .crm-pr-draft-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-group-head {
  color: #52635c;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-line {
  padding: 8px;
  border: 1px solid #e7eeea;
  border-radius: 7px;
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-line div {
  display: grid;
  min-width: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-line strong,
#crmPurchaseWorkspaceModal .crm-pr-draft-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#crmPurchaseWorkspaceModal .crm-pr-draft-line label {
  width: 82px;
}

#crmPurchaseWorkspaceModal .crm-pr-card-skeleton {
  min-height: 154px;
  border: 1px solid #d7e2dd;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef3f1 0%, #fbfcfd 46%, #eef3f1 100%);
  background-size: 220% 100%;
  animation: crm-pr-skeleton 1.2s ease-in-out infinite;
}

#crmPurchaseWorkspaceModal .crm-pr-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@keyframes crm-pr-skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

#crmPurchaseWorkspaceModal .purchase-process-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin: 0 0 12px;
  padding: 10px 0 0;
  border-bottom: 1px solid #dde6e1;
  background: transparent;
}

#crmPurchaseWorkspaceModal .purchase-process-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #d7e2dd;
  border-radius: 7px;
  background: #fff;
  color: #50645c;
  font-size: 12px;
  font-weight: 700;
}

#crmPurchaseWorkspaceModal .purchase-process-summary strong {
  color: #173f33;
  font-size: 14px;
}

#crmPurchaseWorkspaceModal #crmPurchaseRequestStatusCards,
#crmPurchaseWorkspaceModal #crmPurchaseProcessCards {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

#crmPurchaseWorkspaceModal .crm-purchase-request-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
}

#crmPurchaseWorkspaceModal .crm-pr-request-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7e2dd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(23, 32, 51, 0.045);
}

#crmPurchaseWorkspaceModal .crm-pr-status-rail {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #8aa29a;
}

#crmPurchaseWorkspaceModal .crm-pr-status-rail.needs-action {
  background: #b7791f;
}

#crmPurchaseWorkspaceModal .crm-pr-status-rail.linked {
  background: #16803c;
}

#crmPurchaseWorkspaceModal .crm-pr-status-rail.cancelled {
  background: #98a2b3;
}

#crmPurchaseWorkspaceModal .crm-pr-request-card.is-cancelled {
  border-color: #d0d5dd;
  background: #f8fafc;
}

#crmPurchaseWorkspaceModal .crm-pr-request-card.is-cancelled .crm-pr-summary-button:hover {
  background: #f2f4f7;
}

#crmPurchaseWorkspaceModal .crm-pr-summary-button {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(150px, 0.7fr) minmax(310px, 1.2fr) minmax(180px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 13px 14px 13px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

#crmPurchaseWorkspaceModal .crm-pr-summary-button:hover {
  background: #f8fbfa;
}

#crmPurchaseWorkspaceModal .crm-pr-title-block,
#crmPurchaseWorkspaceModal .crm-pr-time-block,
#crmPurchaseWorkspaceModal .crm-pr-status-stack {
  min-width: 0;
  display: grid;
  gap: 4px;
}

#crmPurchaseWorkspaceModal .crm-pr-title-block strong {
  overflow: hidden;
  color: #10251f;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#crmPurchaseWorkspaceModal .crm-pr-title-block small,
#crmPurchaseWorkspaceModal .crm-pr-time-block small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#crmPurchaseWorkspaceModal .crm-pr-time-block strong {
  color: #344054;
  font-size: 12px;
  font-weight: 750;
}

#crmPurchaseWorkspaceModal .crm-pr-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 6px;
}

#crmPurchaseWorkspaceModal .crm-pr-stat-grid span {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #e2e8e5;
  border-radius: 7px;
  background: #f7faf8;
}

#crmPurchaseWorkspaceModal .crm-pr-stat-grid b {
  color: #10251f;
  font-size: 15px;
  line-height: 1;
}

#crmPurchaseWorkspaceModal .crm-pr-stat-grid small {
  color: #667085;
  font-size: 10px;
  font-weight: 800;
}

#crmPurchaseWorkspaceModal .crm-pr-status-stack {
  justify-items: start;
}

#crmPurchaseWorkspaceModal .crm-pr-status-stack .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#crmPurchaseWorkspaceModal .buyer-highlight,
#crmPurchaseWorkspaceModal .purchase-group-list,
#crmPurchaseWorkspaceModal .crm-pr-group-chip {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

#crmPurchaseWorkspaceModal .crm-pr-chevron {
  justify-self: end;
  padding: 7px 9px;
  border: 1px solid #cfe4db;
  border-radius: 7px;
  background: #eef6f2;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

#crmPurchaseWorkspaceModal .crm-pr-remark-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  margin: -4px 14px 0 20px;
  padding: 9px 10px;
  border-top: 1px solid #edf2ef;
  background: #fbfcfd;
}

#crmPurchaseWorkspaceModal .crm-pr-remark-row span {
  color: #6b7c75;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

#crmPurchaseWorkspaceModal .crm-pr-remark-row p {
  min-width: 0;
  margin: 0;
  color: #33443d;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#crmPurchaseWorkspaceModal .purchase-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 13px 20px;
}

#crmPurchaseWorkspaceModal .crm-pr-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #dfe8e3;
  border-radius: 7px;
  background: #fff;
  color: #263b33;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-pr-group-chip strong {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#crmPurchaseWorkspaceModal .crm-pr-group-chip small {
  color: var(--muted);
}

#crmPurchaseWorkspaceModal .purchase-request-inline-detail {
  display: grid;
  gap: 12px;
  padding: 0 14px 15px 20px;
}

#crmPurchaseWorkspaceModal .crm-pr-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 11px;
  border: 1px solid #e0e8e4;
  border-radius: 8px;
  background: #f8fafc;
}

#crmPurchaseWorkspaceModal .crm-pr-overview .wide {
  grid-column: 1 / -1;
}

#crmPurchaseWorkspaceModal .crm-pr-overview div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

#crmPurchaseWorkspaceModal .crm-pr-overview span {
  color: #667085;
  font-size: 11px;
  font-weight: 850;
}

#crmPurchaseWorkspaceModal .crm-pr-overview strong {
  min-width: 0;
  color: #172033;
  font-size: 13px;
  overflow-wrap: anywhere;
}

#crmPurchaseWorkspaceModal .crm-pr-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff;
  color: #667085;
  font-size: 12px;
  font-weight: 750;
}

#crmPurchaseWorkspaceModal .crm-pr-danger-action {
  border-color: #fecdca;
  color: #b42318;
  background: #fffbfa;
}

#crmPurchaseWorkspaceModal .crm-pr-danger-action:hover,
#crmPurchaseWorkspaceModal .crm-pr-danger-action:focus-visible {
  background: #fef3f2;
  color: #912018;
}

#crmPurchaseWorkspaceModal .crm-pr-cancel-panel {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #fda29b;
  border-radius: 8px;
  background: #fffbfa;
}

#crmPurchaseWorkspaceModal .crm-pr-cancel-panel strong {
  color: #912018;
  font-size: 13px;
}

#crmPurchaseWorkspaceModal .crm-pr-cancel-panel label {
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

#crmPurchaseWorkspaceModal .crm-pr-cancel-reason {
  min-height: 84px;
  resize: vertical;
}

#crmPurchaseWorkspaceModal .purchase-request-group-detail {
  border-radius: 8px;
  border-color: #dce6e1;
  padding: 12px;
}

#crmPurchaseWorkspaceModal .purchase-request-group-head {
  align-items: center;
}

#crmPurchaseWorkspaceModal .purchase-request-group-head h4 {
  color: #10251f;
  font-size: 15px;
}

#crmPurchaseWorkspaceModal .crm-pr-group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: #667085;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-pr-items-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}

#crmPurchaseWorkspaceModal .crm-pr-items-table th,
#crmPurchaseWorkspaceModal .crm-pr-items-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #edf2ef;
  font-size: 12px;
  vertical-align: top;
}

#crmPurchaseWorkspaceModal .crm-pr-items-table th {
  color: #5f7068;
  background: #f8faf8;
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
}

#crmPurchaseWorkspaceModal .crm-pr-items-table td:first-child {
  width: 42%;
  overflow-wrap: anywhere;
}

#crmPurchaseWorkspaceModal .crm-pr-edit-note {
  padding: 8px 10px;
  border: 1px solid #fedf89;
  border-radius: 7px;
  background: #fffaeb;
  color: #8a4b0b;
  font-size: 12px;
  font-weight: 750;
}

#crmPurchaseWorkspaceModal .crm-pr-linked-row,
#crmPurchaseWorkspaceModal .purchase-linked-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#crmPurchaseWorkspaceModal .crm-pr-linked-row {
  padding: 8px;
  border-radius: 7px;
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-po-journey-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #b8d9cc;
  border-radius: 8px;
  background: #f7fbf9;
}

#crmPurchaseWorkspaceModal .crm-po-journey-panel.error {
  border-color: #fda29b;
  background: #fffbfa;
  color: #912018;
}

#crmPurchaseWorkspaceModal .crm-po-journey-head,
#crmPurchaseWorkspaceModal .crm-po-doc-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#crmPurchaseWorkspaceModal .crm-po-journey-head div {
  display: grid;
  gap: 3px;
}

#crmPurchaseWorkspaceModal .crm-po-journey-head strong {
  color: #10251f;
  font-size: 14px;
}

#crmPurchaseWorkspaceModal .crm-po-journey-head span,
#crmPurchaseWorkspaceModal .crm-po-summary-grid span,
#crmPurchaseWorkspaceModal .crm-po-relink-history small {
  color: #667085;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-po-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#crmPurchaseWorkspaceModal .crm-po-summary-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e3ebe7;
  border-radius: 7px;
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-po-summary-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1f342e;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-po-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #e3ebe7;
  border-radius: 8px;
  background: #fff;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li span {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 10px;
  font-weight: 850;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li.completed span {
  background: #dcfae6;
  color: #067647;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li.current {
  border-color: #84caff;
  background: #eff8ff;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li.current span {
  background: #d1e9ff;
  color: #175cd3;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li strong,
#crmPurchaseWorkspaceModal .crm-po-timeline li small {
  min-width: 0;
  overflow-wrap: anywhere;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li strong {
  color: #1d2939;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-po-timeline li small {
  color: #667085;
  font-size: 11px;
}

#crmPurchaseWorkspaceModal .crm-po-relink-history {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid #dce6e1;
}

#crmPurchaseWorkspaceModal .crm-po-relink-history div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 8px;
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
}

#crmPurchaseWorkspaceModal .crm-purchase-linked-section {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

#crmPurchaseWorkspaceModal .crm-purchase-linked-section[hidden] {
  display: none;
}

#crmPurchaseWorkspaceModal .crm-purchase-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #dce6e1;
}

#crmPurchaseWorkspaceModal .crm-purchase-section-title h3 {
  margin: 0;
  font-size: 15px;
}

#crmPurchaseWorkspaceModal .crm-purchase-linked-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#crmPurchaseWorkspaceModal .purchase-linked-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #d7e2dd;
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 1180px) {
  #crmPurchaseWorkspaceModal .crm-pr-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #crmPurchaseWorkspaceModal .crm-pr-create .purchase-request-form,
  #crmPurchaseWorkspaceModal .crm-pr-create-main {
    grid-template-columns: 1fr;
  }

  #crmPurchaseWorkspaceModal .crm-pr-excel-dropzone {
    align-items: stretch;
    flex-direction: column;
  }

  #crmPurchaseWorkspaceModal .crm-pr-summary-button {
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1fr) auto;
  }

  #crmPurchaseWorkspaceModal .crm-pr-time-block,
  #crmPurchaseWorkspaceModal .crm-pr-status-stack {
    grid-column: 1 / -1;
    grid-template-columns: auto auto;
    align-items: center;
  }

  #crmPurchaseWorkspaceModal .crm-pr-overview,
  #crmPurchaseWorkspaceModal .crm-pr-linked-row,
  #crmPurchaseWorkspaceModal .crm-po-summary-grid,
  #crmPurchaseWorkspaceModal .crm-po-timeline,
  #crmPurchaseWorkspaceModal .purchase-linked-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #crmPurchaseWorkspaceModal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  #crmPurchaseWorkspaceModal .crm-purchase-process-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  #crmPurchaseWorkspaceModal .crm-purchase-process-header,
  #crmPurchaseWorkspaceModal .crm-pr-toolbar,
  #crmPurchaseWorkspaceModal .crm-purchase-process-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  #crmPurchaseWorkspaceModal .crm-pr-toolbar {
    grid-template-columns: 1fr;
  }

  #crmPurchaseWorkspaceModal .crm-pr-source-head,
  #crmPurchaseWorkspaceModal .crm-pr-excel-dropzone {
    align-items: stretch;
    flex-direction: column;
  }

  #crmPurchaseWorkspaceModal .crm-pr-source-selector,
  #crmPurchaseWorkspaceModal .crm-pr-excel-actions {
    justify-content: stretch;
  }

  #crmPurchaseWorkspaceModal .crm-pr-source-selector button,
  #crmPurchaseWorkspaceModal .crm-pr-excel-actions button,
  #crmPurchaseWorkspaceModal .crm-pr-excel-actions .ghost-button {
    width: 100%;
  }

  #crmPurchaseWorkspaceModal .purchase-process-summary {
    padding-left: 12px;
    padding-right: 12px;
  }

  #crmPurchaseWorkspaceModal .crm-pr-summary-button,
  #crmPurchaseWorkspaceModal .crm-pr-overview,
  #crmPurchaseWorkspaceModal .crm-pr-linked-row,
  #crmPurchaseWorkspaceModal .crm-po-summary-grid,
  #crmPurchaseWorkspaceModal .crm-po-timeline,
  #crmPurchaseWorkspaceModal .purchase-linked-panel,
  #crmPurchaseWorkspaceModal .crm-pr-draft-group-head,
  #crmPurchaseWorkspaceModal .crm-pr-draft-line {
    grid-template-columns: 1fr;
  }

  #crmPurchaseWorkspaceModal .crm-pr-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #crmPurchaseWorkspaceModal .crm-pr-remark-row {
    grid-template-columns: 1fr;
  }

  #crmPurchaseWorkspaceModal .purchase-request-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  #crmPurchaseWorkspaceModal .crm-pr-items-table,
  #crmPurchaseWorkspaceModal .crm-pr-items-table thead,
  #crmPurchaseWorkspaceModal .crm-pr-items-table tbody,
  #crmPurchaseWorkspaceModal .crm-pr-items-table tr,
  #crmPurchaseWorkspaceModal .crm-pr-items-table th,
  #crmPurchaseWorkspaceModal .crm-pr-items-table td {
    display: block;
  }

  #crmPurchaseWorkspaceModal .crm-pr-items-table thead {
    display: none;
  }

  #crmPurchaseWorkspaceModal .crm-pr-items-table tr {
    padding: 8px 0;
    border-bottom: 1px solid #edf2ef;
  }

  #crmPurchaseWorkspaceModal .crm-pr-items-table td {
    width: 100% !important;
    border-bottom: 0;
    padding: 4px 0;
  }

  #crmPurchaseWorkspaceModal .crm-pr-create-actions {
    align-items: stretch;
    flex-direction: column;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
}

.selected-lines-table-wrap {
  overflow: auto;
}

.selected-lines-table thead th,
.sales-rates-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

#salesRatesModal .sales-rates-modal {
  width: min(1180px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

#salesRatesModal .selected-lines-table-wrap {
  max-height: 68vh;
  overflow: auto;
}

#salesRatesModal .actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.sales-rate-group-row td {
  vertical-align: middle;
}

.sales-rate-toggle {
  margin-right: 8px;
}

.sales-rate-item-row td {
  background: #f8fafc;
}

.sales-rate-item-name {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.order-remark-field {
  margin: 12px 0;
}

.order-remark-field textarea {
  resize: vertical;
}

.selected-line {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.selected-line-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.selected-line-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.selected-line-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.selected-line-meta span {
  display: grid;
  gap: 2px;
}

.selected-line-meta strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.sales-entry-panel {
  min-width: 0;
}

.sales-existing-info {
  margin: 12px 0 0;
}

.summary-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
  align-self: start;
}

.purchase-request-layout {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) minmax(560px, 1.25fr);
  gap: 22px;
  align-items: start;
}

.purchase-request-modal {
  width: min(1320px, calc(100vw - 32px));
  max-height: 92vh;
}

.purchase-request-entry,
.purchase-request-selected {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  padding: 16px;
}

.purchase-request-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.purchase-product-search input {
  min-height: 44px;
  font-size: 15px;
}

.purchase-suggestions {
  position: static;
  margin-top: 6px;
  max-height: 340px;
  box-shadow: none;
  border-radius: 8px;
}

.purchase-suggestions .suggestion {
  min-height: 62px;
  justify-content: center;
}

.purchase-suggestions .suggestion strong {
  font-size: 14px;
  line-height: 1.35;
}

.purchase-selected-product-wrap {
  display: grid;
  gap: 7px;
}

.purchase-field-label {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.purchase-selected-product {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 11px 13px;
  border: 2px solid var(--brand);
  border-radius: 8px;
  background: #ecfdf5;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.4;
}

.purchase-selected-product.is-empty {
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
}

.purchase-qty-action {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(180px, 1fr);
  gap: 14px;
  align-items: end;
}

.purchase-qty-action button {
  min-height: 42px;
}

.purchase-request-selected .table-wrap {
  max-height: 58vh;
  overflow: auto;
}

.purchase-request-selected thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #173f3a;
  color: #fff;
}

.inline-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.inline-check input {
  width: auto;
}

.purchase-group-muted {
  background: #f8fafc;
  opacity: 0.82;
}

.inventory-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.inventory-scope-controls {
  display: flex;
  flex: 1 1 620px;
  gap: 14px;
  align-items: end;
  min-width: 0;
}

.inventory-category {
  flex: 0 1 260px;
  min-width: min(240px, 100%);
}

.inventory-search {
  flex: 1 1 360px;
  min-width: min(360px, 100%);
}

.inventory-search input:disabled {
  cursor: not-allowed;
  background: #f3f6f5;
  color: var(--muted);
}

@media (max-width: 720px) {
  .inventory-scope-controls {
    display: grid;
    grid-template-columns: 1fr;
    flex-basis: 100%;
  }

  .inventory-category,
  .inventory-search {
    min-width: 0;
    width: 100%;
  }
}

.inventory-status {
  min-height: 20px;
  margin: -4px 0 10px;
}

.inventory-status--error {
  color: #9b2c2c;
  font-weight: 700;
}

.inventory-status--loading,
.inventory-status--empty {
  color: var(--muted);
}

.inventory-sort-button {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.inventory-sort-button:focus-visible {
  outline: 3px solid #f4cf72;
  outline-offset: 3px;
  border-radius: 2px;
}

.column-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.column-picker label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.column-picker input {
  width: auto;
}

.inventory-workflow-actions { display: grid; grid-template-columns: auto minmax(190px,.6fr) minmax(240px,1fr) auto auto; align-items: end; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7faf8; }
.inventory-workflow-actions label { grid-column: 2 / 4; margin: 0; }
.inventory-workflow-actions input { grid-column: 2 / 4; margin: 0; }
.inventory-update-status { min-height: 22px; margin-bottom: 8px; font-weight: 700; }
.inventory-preview { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.inventory-preview .metric-grid { margin-bottom: 10px; }
.inventory-stock-old { color: var(--muted); }
.inventory-preview-changed { color: #176d3c; }
.inventory-preview-changed-row { background: #f2faf5; }
.inventory-preview-invalid { background: #fff1ef; color: #8e2f28; }

@media (max-width: 900px) {
  .inventory-workflow-actions { grid-template-columns: 1fr 1fr; }
  .inventory-workflow-actions label, .inventory-workflow-actions input { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .inventory-workflow-actions { grid-template-columns: 1fr; }
  .inventory-workflow-actions > * { width: 100%; grid-column: 1 !important; }
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.image-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.image-grid img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #fff;
}

.file-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 16px;
  background: #eef6f2;
  color: var(--brand);
  font-weight: 900;
  text-align: center;
}

.file-card-error .file-preview {
  background: #fff1f2;
  color: var(--red);
}

.image-grid figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.image-grid figcaption span {
  min-width: 0;
}

.image-download {
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 12px;
}

.error-text {
  color: var(--red);
  margin-top: 10px;
}

.scot-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.scot-call-card {
  border: 1px solid var(--line);
  border-left: 6px solid #94a3b8;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.scot-call-card.party-red { border-left-color: #dc2626; }
.scot-call-card.party-yellow { border-left-color: #eab308; }
.scot-call-card.party-green { border-left-color: #16a34a; }
.scot-call-card h3 { margin: 0 0 8px; }
.scot-call-card .actions { margin-top: 12px; }
.file-button { display: inline-flex; cursor: pointer; }

#scotSfField[hidden],
#scotSfField input[hidden] {
  display: none !important;
}

@media (max-width: 1280px) {
  .weight-calculator-layout,
  .weight-order-panel {
    grid-template-columns: 1fr;
  }

  .weight-add-panel,
  .weight-table-panel {
    grid-column: 1 / -1;
  }

  .sales-work-grid {
    grid-template-columns: minmax(480px, 1fr) minmax(380px, 0.9fr);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .purchase-action-strip,
  .purchase-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .po360-header { align-items: stretch; flex-direction: column; padding: 14px; }
  .po360-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 14px; }
  .po360-search-field { grid-column: 1 / -1; }
  .po360-results { padding: 0 14px 112px; }
  .po360-pagination { padding: 12px 14px; }
  .po360-drawer-panel { width: min(640px, 100%); }
  .crm-pr-command-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-pr-command-search { grid-column: 1 / -1; }
  .crm-pr-command-cards, .crm-pr-command-detail { max-height: none; overflow: visible; padding-right: 0; }
  .crm-pr-command-status, .crm-pr-command-pagination { justify-content: flex-start; }
  .crm-pr-bulk-selection-bar { align-items: flex-start; flex-direction: column; }

  .sidebar {
    position: static;
    height: auto;
  }

  .span-4,
  .span-6,
  .span-8,
  .span-12 {
    grid-column: span 12;
  }

  .form-grid,
  .sales-screen-grid,
  .sales-condition-grid,
  .sales-product-grid,
  .result-grid,
  .metric-grid,
  .cards-five,
  .cards-six,
  .cards-admin,
  .cleanup-preview-grid,
  .filter-grid,
  .modal-work-grid,
  .purchase-grid,
  .purchase-request-layout {
    grid-template-columns: 1fr;
  }

  .purchase-request-form,
  .purchase-qty-action {
    grid-template-columns: 1fr;
  }

  #crmCards {
    min-height: 1814px;
  }

  .sales-screen-grid {
    grid-template-areas:
      "setup"
      "entry"
      "lines"
      "staged";
  }

  .maintenance-card {
    align-items: stretch;
    flex-direction: column;
  }

  .demand-filter-row,
  .demand-line-row {
    grid-template-columns: 1fr;
  }

  .selected-lines-table .qty-cell,
  .selected-lines-table .action-cell {
    position: sticky;
    background: #fff;
    z-index: 1;
  }

  .selected-lines-table .action-cell {
    right: 0;
  }

  .selected-lines-table .qty-cell {
    right: 58px;
  }
}

@media (max-width: 620px) {
  .purchase-action-strip,
  .purchase-workflow-grid {
    grid-template-columns: 1fr;
  }

  .po360-toolbar { grid-template-columns: 1fr; }
  .crm-pr-command-toolbar { grid-template-columns: 1fr; }
  .crm-pr-command-card .order-card-top, .crm-pr-command-card .purchase-request-actions, .crm-pr-command-pagination, .crm-pr-bulk-selection-bar .modal-actions { align-items: stretch; flex-direction: column; }
  .crm-pr-command-card .purchase-request-actions button, .crm-pr-command-pagination button { width: 100%; }
  .crm-pr-command-chip { width: 100%; justify-content: space-between; }
  .crm-pr-command-chip strong { max-width: 58vw; }
  .po360-toolbar-actions,
  .po360-header-actions,
  .po360-pagination { align-items: stretch; flex-direction: column; }
  .po360-toolbar-actions > *,
  .po360-header-actions > *,
  .po360-pagination > * { width: 100%; }
  .po360-facts { grid-template-columns: 1fr; }
  .po360-drawer-head { flex-direction: column; }

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

@media (max-width: 900px) {
  .demand-fast-entry,
  .demand-order-context,
  .demand-modal-footer {
    grid-template-columns: 1fr;
  }

  .demand-file-modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .demand-modal-footer .modal-actions {
    flex-wrap: wrap;
  }
}
.bulk-po-panel { display: grid; gap: 16px; }
.bulk-po-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style-position: inside; }
.bulk-po-steps li, .bulk-po-group { padding: 10px; border: 1px solid #d9e5df; border-radius: 9px; background: #f7fbf9; }
.bulk-po-dropzone { display: grid; gap: 10px; padding: 22px; border: 2px dashed #78a995; border-radius: 12px; background: #f4faf7; }
.bulk-po-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.bulk-po-group { display: grid; gap: 5px; }
@media (max-width: 760px) { .bulk-po-steps { grid-template-columns: 1fr 1fr; } }

/* Warehouse operations desk */
.warehouse-page { --wh-surface: #f7f9f8; --wh-ink: #14251f; background: #edf2ef; }
.warehouse-page.modal-open { overflow: hidden; }
.warehouse-shell { min-height: 100vh; background: linear-gradient(110deg, #edf2ef 0%, #f7f9f8 72%); }
.warehouse-sidebar { background: #133a2f; border-right: 0; color: #eaf4ef; }
.warehouse-sidebar .brand { color: #fff; }
.warehouse-sidebar .brand span { color: #a9c8bb; }
.warehouse-shift-mark { display: flex; align-items: center; gap: 8px; margin: 22px 12px 8px; color: #b9d0c6; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.warehouse-shift-mark span { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.13); }
.warehouse-nav { display: grid; gap: 5px; padding-top: 8px; }
.warehouse-nav button, .warehouse-nav a { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid transparent; background: transparent; color: #c6d9d1; text-align: left; text-decoration: none; }
.warehouse-nav button:hover, .warehouse-nav button:focus-visible, .warehouse-nav a:hover, .warehouse-nav a:focus-visible { background: rgba(255,255,255,.08); color: #fff; }
.warehouse-nav button.active { background: #f3f7f5; color: #153e32; box-shadow: inset 4px 0 #c08b45; }
.warehouse-nav b { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.13); font-size: 11px; }
.warehouse-nav button.active b { background: #dceae4; }
.warehouse-sidebar-foot { display: flex; align-items: flex-start; gap: 8px; margin-top: auto; padding: 18px 12px; color: #a9c8bb; font-size: 11px; line-height: 1.4; }
.warehouse-main { max-width: 1700px; }
.warehouse-topbar { align-items: center; padding-bottom: 14px; border-bottom: 1px solid #d7e0db; }
.warehouse-kicker { margin: 0 0 5px; color: #8b6334; font-size: 11px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.warehouse-topbar h1 { color: var(--wh-ink); font-size: clamp(26px, 2.6vw, 38px); letter-spacing: -.035em; }
.warehouse-user-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #173f33; color: #fff; font-size: 11px; letter-spacing: .05em; }
.warehouse-user-mark + span { display: grid; gap: 2px; }
.warehouse-user-mark + span small { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.warehouse-summary { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); margin: 17px 0; overflow: hidden; border: 1px solid #d7e0db; border-radius: 12px; background: #fff; box-shadow: 0 10px 28px rgba(20,47,38,.05); }
.warehouse-summary-card { position: relative; display: grid; min-height: 94px; padding: 15px 16px; border-right: 1px solid #e1e7e4; }
.warehouse-summary-card:last-child { border-right: 0; }
.warehouse-summary-card span { color: #66766f; font-size: 11px; font-weight: 800; line-height: 1.3; }
.warehouse-summary-card strong { align-self: end; color: var(--wh-ink); font-size: 29px; line-height: 1; }
.warehouse-summary-card small { color: #b45309; font-size: 10px; font-weight: 700; }
.warehouse-summary-card::after { content: ""; position: absolute; inset: auto 12px 0; height: 3px; border-radius: 3px 3px 0 0; background: #94a39d; }
.warehouse-summary-card.blue::after { background: #3b82f6; }.warehouse-summary-card.amber::after { background: #d99a3b; }.warehouse-summary-card.red::after { background: #dc4c43; }.warehouse-summary-card.green::after { background: #269a5b; }
.warehouse-summary-skeleton { grid-column: 1/-1; height: 94px; background: linear-gradient(90deg,#f3f6f4 25%,#e8eeeb 40%,#f3f6f4 65%); background-size: 400% 100%; animation: warehouseShimmer 1.25s infinite; }
.warehouse-workspace { min-height: 500px; padding: 22px; border: 1px solid #d7e0db; border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 16px 40px rgba(20,47,38,.06); }
.warehouse-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.warehouse-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.warehouse-section-head h2 { margin: 0 0 4px; color: var(--wh-ink); font-size: 22px; letter-spacing: -.02em; }
.warehouse-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 16px; padding-top: 15px; border-top: 1px solid #e2e8e5; }
.warehouse-status-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.warehouse-status-filters button { min-height: 32px; padding: 6px 11px; border: 1px solid #d7e0db; border-radius: 999px; background: #fff; color: #52635c; font-size: 12px; }
.warehouse-status-filters button.active { border-color: #214f40; background: #214f40; color: #fff; }
.warehouse-search { position: relative; display: block; width: min(330px,100%); }
.warehouse-search input { margin: 0; padding-right: 40px; }
.warehouse-search kbd { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); padding: 1px 6px; border: 1px solid #d5ddd9; border-radius: 4px; background: #f5f7f6; color: #7b8983; font: 11px inherit; }
.warehouse-content { display: grid; gap: 10px; }
.warehouse-op-card { --status-rail: #94a39d; position: relative; display: grid; grid-template-columns: minmax(180px,.75fr) minmax(260px,1.4fr) minmax(180px,.7fr) auto; align-items: center; gap: 18px; min-height: 112px; padding: 16px 16px 16px 21px; overflow: hidden; border: 1px solid #dbe3df; border-radius: 10px; background: #fff; }
.warehouse-op-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--status-rail); }
.warehouse-op-card.status-in-progress { --status-rail:#3b82f6; }.warehouse-op-card.status-at-risk { --status-rail:#d99a3b; }.warehouse-op-card.status-overdue { --status-rail:#dc4c43; }.warehouse-op-card.status-completed { --status-rail:#269a5b; }
.warehouse-op-card:hover { border-color: #afc2b9; box-shadow: 0 9px 24px rgba(20,47,38,.07); }
.warehouse-card-id { display: grid; gap: 5px; min-width: 0; }
.warehouse-card-id strong { overflow: hidden; color: var(--wh-ink); font-size: 16px; text-overflow: ellipsis; }
.warehouse-card-id small { color: #6b7973; }
.warehouse-card-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 14px; color: #62716b; font-size: 12px; }
.warehouse-card-meta b { color: #263c34; font-weight: 700; }
.warehouse-card-sla { display: grid; gap: 6px; justify-items: start; }
.warehouse-card-sla strong { font-size: 12px; }
.warehouse-card-sla small { color: var(--muted); }
.warehouse-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.warehouse-card-actions button { white-space: nowrap; }
.warehouse-status { display: inline-flex; align-items: center; gap: 6px; width: fit-content; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #eef2f0; color: #52635c; font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.warehouse-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.warehouse-status.in-progress { background:#e5efff;color:#2563eb; }.warehouse-status.at-risk { background:#fff3d9;color:#a96510; }.warehouse-status.overdue { background:#fee8e6;color:#b42318; }.warehouse-status.completed { background:#e2f6e9;color:#16803c; }
.warehouse-card-skeleton { height: 112px; border-radius: 10px; background: linear-gradient(90deg,#f3f6f4 25%,#e8eeeb 40%,#f3f6f4 65%); background-size: 400% 100%; animation: warehouseShimmer 1.25s infinite; }
@keyframes warehouseShimmer { to { background-position: -400% 0; } }
.warehouse-error-state { padding: 34px; border: 1px solid #f1c4c0; border-radius: 10px; background: #fff6f5; color: #8e2f28; text-align: center; }
.warehouse-confirm-modal { width: min(520px,100%); text-align: left; }
.warehouse-confirm-modal h2 { margin: 12px 0 7px; }
.warehouse-modal-symbol { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 11px; background: #e5efe9; color: #174f3e; font-size: 12px; font-weight: 900; letter-spacing: .06em; }
.warehouse-modal-symbol.alert { background:#feebe9;color:#b42318; }
.warehouse-check { display: flex; align-items: center; gap: 9px; }
.warehouse-check input { width: auto; margin: 0; }
.warehouse-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 14px; border-bottom: 1px solid #e2e8e5; }
.warehouse-modal-head h2 { margin: 0 0 4px; }
.warehouse-audit-modal { max-height: 92vh; overflow: auto; }
.warehouse-audit-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; }
.warehouse-success-action { border-color: #72b48d; color: #176d3c; }
.warehouse-item-toolbar { display: grid; grid-template-columns: minmax(160px,.5fr) minmax(220px,1fr) auto auto; align-items: end; gap: 10px; margin-bottom: 12px; }
.warehouse-item-toolbar select, .warehouse-item-toolbar input { margin: 0; }
.warehouse-audit-table { max-height: 52vh; }
.warehouse-audit-table th { position: sticky; top: 0; z-index: 1; }
.warehouse-corrections-modal { max-height: 94vh; overflow: auto; }
.warehouse-correction-grid { display: grid; grid-template-columns: minmax(280px,.65fr) minmax(460px,1.35fr); gap: 18px; margin: 16px 0; }
.warehouse-product-finder { align-self: start; padding: 15px; border: 1px solid #dce5e0; border-radius: 10px; background: #f7faf8; }
.warehouse-selected-head { display: flex; align-items: center; justify-content: space-between; }
.warehouse-selected-head h3 { margin: 0; }.warehouse-selected-head span { color: var(--muted); font-size: 12px; }
.warehouse-correction-lines { display: grid; gap: 8px; margin-top: 10px; }
.warehouse-correction-line { display: grid; grid-template-columns: minmax(180px,1fr) 110px 120px auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid #dce5e0; border-radius: 9px; background: #fff; }
.warehouse-correction-line strong { display:block;font-size:13px; }.warehouse-correction-line small { color:var(--muted); }
.warehouse-correction-line input { margin: 0; }
.warehouse-qty-block { display:grid;gap:2px;padding:7px 9px;border-radius:7px;background:#f1f5f3;font-size:11px; }.warehouse-qty-block b { font-size:14px; }
.warehouse-correction-line .remove { padding:7px;background:transparent;color:var(--red); }
.warehouse-history-card { grid-template-columns: minmax(210px,.8fr) minmax(260px,1.4fr) auto; }
.warehouse-reserved-modal { max-height: 92vh; overflow: auto; }
.warehouse-reserved-search { display: block; margin: 14px 0; }
.warehouse-reserved-result { display: grid; gap: 10px; }
.warehouse-reserved-panel { display: grid; gap: 12px; }
.warehouse-reserved-panel h3 { margin: 0; color: var(--wh-ink); font-size: 17px; }
.warehouse-reserved-candidates { display: grid; gap: 8px; }
.warehouse-reserved-candidates button { display: grid; gap: 4px; width: 100%; min-height: 54px; padding: 10px 12px; border: 1px solid #dce5e0; border-radius: 8px; background: #fff; color: var(--wh-ink); text-align: left; }
.warehouse-reserved-candidates button:hover { border-color: #214f40; background: #f7faf8; }
.warehouse-reserved-candidates span, .warehouse-reserved-title span { color: var(--muted); font-size: 12px; }
.warehouse-reserved-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.warehouse-reserved-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.warehouse-reserved-stats div { padding: 10px; border: 1px solid #dce5e0; border-radius: 8px; background: #f7faf8; }
.warehouse-reserved-stats span { display: block; color: #66766f; font-size: 11px; font-weight: 800; }
.warehouse-reserved-stats strong { color: var(--wh-ink); font-size: 20px; }
.warehouse-reserved-table { max-height: 42vh; }
.sr-only { position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important; }
.warehouse-page :focus-visible { outline: 3px solid rgba(37,99,235,.27); outline-offset: 2px; }

@media (max-width: 1200px) {
  .warehouse-summary { grid-template-columns: repeat(3,1fr); }
  .warehouse-summary-card:nth-child(3) { border-right:0; }.warehouse-summary-card:nth-child(-n+3) { border-bottom:1px solid #e1e7e4; }
  .warehouse-op-card { grid-template-columns: minmax(170px,.8fr) minmax(250px,1.2fr) auto; }
  .warehouse-card-sla { grid-column:2; }.warehouse-card-actions { grid-column:3;grid-row:1/3; }
}
@media (max-width: 900px) {
  .warehouse-sidebar { width: 210px; }
  .warehouse-op-card { grid-template-columns: 1fr auto; }.warehouse-card-meta,.warehouse-card-sla { grid-column:1; }.warehouse-card-actions { grid-column:2;grid-row:1/4;align-content:center; }
  .warehouse-correction-grid { grid-template-columns:1fr; }.warehouse-item-toolbar { grid-template-columns:1fr 1fr; }
  .warehouse-reserved-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .warehouse-shell { display:block; }.warehouse-sidebar { position:static;width:100%;min-height:auto;padding-bottom:8px; }.warehouse-shift-mark,.warehouse-sidebar-foot { display:none; }
  .warehouse-nav { display:flex;overflow:auto;padding:6px 10px; }.warehouse-nav button, .warehouse-nav a { min-width:max-content; }
  .warehouse-main { padding:14px; }.warehouse-topbar { align-items:flex-start; }.warehouse-topbar .user-pill span:not(.warehouse-user-mark) { display:none; }
  .warehouse-summary { grid-template-columns:repeat(2,1fr); }.warehouse-summary-card { border-bottom:1px solid #e1e7e4; }.warehouse-summary-card:nth-child(2n) { border-right:0; }
  .warehouse-workspace { padding:15px; }.warehouse-toolbar { align-items:stretch;flex-direction:column; }.warehouse-search { width:100%; }
  .warehouse-op-card,.warehouse-history-card { grid-template-columns:1fr;gap:11px; }.warehouse-card-meta,.warehouse-card-sla,.warehouse-card-actions { grid-column:1;grid-row:auto;justify-content:flex-start; }
  .warehouse-item-toolbar { grid-template-columns:1fr; }.warehouse-correction-line { grid-template-columns:1fr 1fr; }.warehouse-correction-line > :first-child { grid-column:1/-1; }
  .warehouse-section-head { display: grid; }.warehouse-head-actions { justify-content: flex-start; }.warehouse-reserved-stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .warehouse-card-skeleton,.warehouse-summary-skeleton { animation:none; } }
.migration-confirmation { margin: 1rem 0; padding: .85rem 1rem; border-left: 4px solid var(--amber, #c98700); background: rgba(201, 135, 0, .08); }

/* Sales Order stock-conflict feedback */
#salesOrderModal .modal {
  position: relative;
}

.sales-order-modal-alert {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: start center;
  padding: 72px 18px 18px;
  background: rgba(17, 24, 39, .32);
}

.sales-order-modal-alert[data-state="processing"],
.sales-order-modal-alert[data-state="success"] {
  place-items: center;
  padding: 18px;
}

.sales-order-modal-alert[hidden] {
  display: none;
}

.sales-order-modal-alert__box {
  width: min(560px, 100%);
  padding: 16px;
  border: 1px solid #f1b6b0;
  border-radius: 8px;
  background: #fff7f6;
  color: #7f1d1d;
  box-shadow: 0 18px 48px rgba(127, 29, 29, .18);
}

.sales-order-modal-alert[data-state="processing"] .sales-order-modal-alert__box {
  border-color: #8fc3b4;
  background: #f3fbf8;
  color: #123f35;
  box-shadow: 0 18px 48px rgba(15, 118, 110, .2);
}

.sales-order-modal-alert[data-state="success"] .sales-order-modal-alert__box {
  border-color: #86d5a7;
  background: #f1fbf5;
  color: #14532d;
  text-align: center;
  box-shadow: 0 18px 48px rgba(22, 101, 52, .2);
}

.sales-order-modal-alert__box h3 {
  margin: 0 0 8px;
  color: #7f1d1d;
  font-size: 18px;
  letter-spacing: 0;
}

.sales-order-modal-alert[data-state="processing"] .sales-order-modal-alert__box h3 {
  color: #123f35;
}

.sales-order-modal-alert[data-state="success"] .sales-order-modal-alert__box h3 {
  color: #14532d;
}

.sales-order-modal-alert__details {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  font-size: 13px;
}

.sales-order-modal-alert__details div {
  padding: 8px 10px;
  border-radius: 6px;
  background: #fee2e2;
}

.sales-order-modal-alert[data-state="processing"] .sales-order-modal-alert__details div,
.sales-order-modal-alert[data-state="success"] .sales-order-modal-alert__details div {
  padding: 0;
  background: transparent;
}

.sales-submission-progress {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #d7ebe5;
}

.sales-submission-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #22c55e);
  animation: sales-submission-progress 1.1s ease-in-out infinite;
}

.sales-submission-progress__note {
  color: #315f54;
  font-weight: 700;
}

.sales-submission-success-mark {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  margin: 2px auto 0;
  border-radius: 999px;
  background: #15803d;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

@keyframes sales-submission-progress {
  0% { transform: translateX(-105%); }
  50% { transform: translateX(85%); }
  100% { transform: translateX(245%); }
}

@media (prefers-reduced-motion: reduce) {
  .sales-submission-progress span {
    animation: none;
    width: 100%;
  }
}

.sales-stock-conflict {
  background: #b91c1c !important;
  color: #fff;
}

.sales-stock-conflict input,
.sales-stock-conflict select {
  border-color: #fecaca;
  background: #fff;
  color: #111827;
}

.sales-stock-conflict .stock-shortage {
  color: #fff;
  font-weight: 800;
}

.staged-sales-conflict {
  border-color: #dc2626 !important;
  background: #fff1f2 !important;
  animation: salesConflictPulse 1.35s ease-in-out infinite;
}

.sales-conflict-list {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

@keyframes salesConflictPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .24); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, .12); }
}

@media (prefers-reduced-motion: reduce) {
  .warehouse-card-skeleton,
  .warehouse-summary-skeleton,
  .staged-sales-conflict {
    animation: none;
  }
}

:root {
  --nt-green-950: #10241c;
  --nt-green-900: #173428;
  --nt-green-800: #1f4a38;
  --nt-green-700: #286246;
  --nt-green-100: #e7f3ed;
  --nt-workspace-bg: #f6faf7;
  --nt-workspace-surface: #ffffff;
  --nt-workspace-border: #d7e4dc;
  --nt-workspace-text: #14231d;
  --nt-workspace-muted: #64746d;
  --nt-workspace-warning: #b7791f;
  --nt-workspace-danger: #b42318;
  --nt-workspace-info: #2563a8;
  --nt-workspace-radius-sm: 6px;
  --nt-workspace-radius-md: 8px;
  --nt-workspace-radius-lg: 12px;
  --nt-workspace-shadow-sm: 0 8px 22px rgba(18, 52, 38, .08);
}

.ntw-workspace-view {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 90px);
  color: var(--nt-workspace-text);
  background: var(--nt-workspace-bg);
}

.ntw-workspace-view[hidden] {
  display: none !important;
}

.ntw-workspace-back {
  min-width: 86px;
}

.crm-workspace-toolbar-search {
  display: grid;
  gap: 4px;
  min-width: min(320px, 100%);
  margin: 0;
}

.crm-workspace-toolbar-search span {
  color: var(--nt-workspace-muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.crm-workspace-toolbar-search input {
  min-height: 36px;
  margin: 0;
  padding: 7px 10px;
  border-color: #c9ded3;
  background: #fff;
}

.ntw-workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--nt-workspace-border);
  border-radius: var(--nt-workspace-radius-lg);
  background: var(--nt-green-900);
  color: #fff;
}

.ntw-workspace-hero h2 {
  margin: 6px 0;
  font-size: 24px;
  line-height: 1.18;
}

.ntw-workspace-hero p {
  margin: 0;
  color: #dcebe3;
}

.ntw-workspace-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 10px;
}

.ntw-workspace-hero-metrics span {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--nt-workspace-radius-md);
  background: rgba(255,255,255,.1);
}

.ntw-workspace-hero-metrics strong {
  font-size: 18px;
}

.ntw-workspace-hero-metrics small {
  color: #c9ded3;
}

.ntw-workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 2px 0 0;
  background: transparent;
}

.ntw-workspace-toolbar-actions {
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: flex-end;
}

.ntw-workspace-toolbar-actions[hidden],
.ntw-workspace-context-panel[hidden],
.ntw-workspace-hero[hidden] {
  display: none !important;
}

.ntw-workspace-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px;
  min-height: 0;
}

.ntw-workspace-body:has(.ntw-workspace-context-panel[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.ntw-workspace-content {
  min-width: 0;
}

.ntw-workspace-context-panel {
  align-self: start;
  padding: 14px;
  border: 1px solid var(--nt-workspace-border);
  border-radius: var(--nt-workspace-radius-md);
  background: var(--nt-workspace-surface);
}

.ntw-workspace-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--nt-workspace-border);
  border-radius: var(--nt-workspace-radius-md);
  background: var(--nt-workspace-surface);
  box-shadow: var(--nt-workspace-shadow-sm);
}

.ntw-workspace-card h2 {
  margin: 0;
  font-size: 18px;
}

.ntw-workspace-card p {
  margin: 0;
  color: var(--nt-workspace-muted);
}

.ntw-workspace-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #b8d5c5;
  border-radius: 999px;
  background: #eef8f1;
  color: var(--nt-green-800);
  font-size: 12px;
  font-weight: 750;
}

.ntw-workspace-state,
.ntw-workspace-empty {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 34px 20px;
  border: 1px dashed #bdd0c6;
  border-radius: var(--nt-workspace-radius-md);
  background: var(--nt-workspace-surface);
  color: var(--nt-workspace-muted);
  text-align: center;
}

.ntw-workspace-empty h2 {
  margin: 0;
  color: var(--nt-workspace-text);
}

.ntw-workspace-empty p {
  margin: 0;
}

.ntw-workspace-state-error {
  border-color: #efc1bb;
  background: #fff5f4;
  color: var(--nt-workspace-danger);
}

.ntw-workspace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ntw-workspace-table-wrap {
  overflow: auto;
  border: 1px solid var(--nt-workspace-border);
  border-radius: var(--nt-workspace-radius-md);
  background: var(--nt-workspace-surface);
}

.ntw-workspace-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.ntw-workspace-demo-modal {
  z-index: 1200;
}

.crm-order-excel-register {
  display: grid;
  gap: 10px;
}

.crm-order-excel-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(150px, .45fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--nt-workspace-border);
  border-radius: var(--nt-workspace-radius-md);
  background: var(--nt-workspace-surface);
  box-shadow: var(--nt-workspace-shadow-sm);
}

.crm-order-excel-row > div:first-child > strong {
  display: block;
  color: var(--nt-green-950);
  font-size: 16px;
}

.crm-order-excel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--nt-workspace-muted);
  font-size: 12px;
}

.crm-order-excel-status {
  display: grid;
  gap: 5px;
  justify-items: start;
}

.crm-order-excel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.crm-workspace-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 14px;
}

.crm-workspace-scot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.crm-workspace-scot-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #cddfd5;
  border-radius: var(--nt-workspace-radius-md);
  background: var(--nt-workspace-surface);
  box-shadow: var(--nt-workspace-shadow-sm);
}

.crm-workspace-scot-card h3 {
  margin: 0 0 4px;
  color: var(--nt-green-950);
  font-size: 17px;
  line-height: 1.22;
}

.crm-workspace-scot-meta {
  display: grid;
  gap: 5px;
  color: var(--nt-workspace-muted);
  font-size: 12px;
}

@media (max-width: 960px) {
  .ntw-workspace-body,
  .ntw-workspace-hero {
    grid-template-columns: 1fr;
  }

  .ntw-workspace-hero-metrics,
  .ntw-workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crm-order-excel-row {
    grid-template-columns: 1fr;
  }

  .crm-workspace-queue-grid,
  .crm-workspace-scot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crm-order-excel-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .ntw-workspace-toolbar,
  .ntw-workspace-toolbar-actions {
    align-items: stretch;
  }

  .ntw-workspace-toolbar-actions {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .crm-workspace-toolbar-search {
    width: 100%;
  }

  .ntw-workspace-hero-metrics,
  .ntw-workspace-grid,
  .crm-workspace-queue-grid,
  .crm-workspace-scot-grid {
    grid-template-columns: 1fr;
  }
}
