/* ==========================================================================
   Xiaoqiao ERP V2 — Xiaoqiao Green Collaborative Design System (2026-11-14)
   Core Standards:
   1. 页面简洁，员工一看就容易上手 (V2 left collapsible grouped tree sidebar +
      56px breadcrumb/omni-search topbar + Master-Detail inspector drawers)
   2. 排版布局合理 (Balanced 24px left/right workspace margins, 0px filter drift,
      3-column live math entry, conservation banner, upstream->downstream strip)
   3. 颜色风格简单明快，主色沿用小乔绿 (#176b4b primary, #2563eb blue,
      #52b6f5 light-blue, #f26522 orange + daylight neutrals; zero 5th accent)
   ========================================================================== */

:root {
  --green: #176b4b;
  --blue: #2563eb;
  --light-blue: #52b6f5;
  --orange: #f26522;
  --green-soft: rgba(23, 107, 75, .10);
  --blue-soft: rgba(37, 99, 235, .10);
  --light-blue-soft: rgba(82, 182, 245, .14);
  --orange-soft: rgba(242, 101, 34, .11);

  --ink: #111827;
  --ink-secondary: #344054;
  --muted: #667085;
  --paper: #f3f5f8;
  --surface: #f8fafc;
  --white: #ffffff;
  --line: #dce1e8;
  --line-soft: #eaecf0;
  --control-border: #cfd5df;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --shadow-elevated: 0 6px 18px rgba(16, 24, 40, .08);

  --v2-sidebar-width: 216px;
  --v2-topbar-height: 56px;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. V2 Left Collapsible Tree Sidebar (#176B4B Xiaoqiao Green Primary)
   -------------------------------------------------------------------------- */
.v2-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  width: var(--v2-sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.v2-sidebar-brand {
  height: var(--v2-topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.v2-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--white);
  border: 1px solid rgba(15, 23, 42, .06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .09);
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.v2-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.v2-brand-title {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: .03em;
  color: var(--ink);
  white-space: nowrap;
}

.v2-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 20px;
  scrollbar-width: thin;
}

.v2-menu-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.v2-menu-item,
.v2-menu-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
  box-sizing: border-box;
  transition: background-color .14s ease, color .14s ease;
}

.v2-menu-summary::-webkit-details-marker {
  display: none;
}

.v2-menu-item:hover,
.v2-menu-summary:hover {
  background: var(--surface);
  color: var(--green);
}

.v2-menu-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  transition: color .14s ease;
}

.v2-menu-item:hover .v2-menu-icon,
.v2-menu-summary:hover .v2-menu-icon {
  color: var(--green);
}

.v2-menu-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.v2-menu-chevron {
  width: 6px;
  height: 6px;
  border-right: 1.7px solid var(--muted);
  border-bottom: 1.7px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .16s ease, border-color .14s ease;
  margin-right: 2px;
  flex-shrink: 0;
}

.v2-menu-group[open] > .v2-menu-summary .v2-menu-chevron {
  transform: rotate(45deg);
}

.v2-menu-item.is-active {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--green);
}

.v2-menu-item.is-active .v2-menu-icon,
.v2-menu-group.is-group-active > .v2-menu-summary .v2-menu-icon {
  color: var(--green);
}

.v2-menu-group.is-group-active > .v2-menu-summary {
  color: var(--green);
  font-weight: 650;
}

.v2-menu-group.is-group-active > .v2-menu-summary .v2-menu-chevron {
  border-color: var(--green);
}

.v2-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 0 5px 12px;
  margin-left: 18px;
  border-left: 1px solid var(--line-soft);
}

.v2-submenu-link {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 7px;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .12s ease, color .12s ease;
}

.v2-submenu-link:hover {
  background: rgba(23, 107, 75, .05);
  color: var(--green);
}

.v2-submenu-link.is-active {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 650;
  box-shadow: inset 2.5px 0 0 var(--green);
}

/* --------------------------------------------------------------------------
   2. V2 Workspace Frame, 56px Breadcrumb + Omni-Search Topbar & Nav Contracts
   -------------------------------------------------------------------------- */
.v2-workspace-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body.v2-erp-authenticated .v2-workspace-frame {
  margin-left: var(--v2-sidebar-width);
}

body.erp-login-page .v2-workspace-frame,
body.login-page .v2-workspace-frame {
  margin-left: 0;
  flex: 1;
}

body.login-page .v2-workspace-frame > footer {
  display: none;
}

@media (min-width: 801px) {
  html:has(body:not(.erp-login-page):not(.login-page)) {
    scrollbar-gutter: stable;
  }
}

/* Unauthenticated topbar (login screen) */
.topbar {
  height: var(--v2-topbar-height);
  padding: 0 max(24px, calc((100% - 1040px) / 2 + 24px));
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Authenticated V2 topbar inside workspace frame */
body.v2-erp-authenticated .topbar.v2-topbar,
body.v2-erp-authenticated.ui-supply .topbar.v2-topbar,
body.v2-erp-authenticated.purchase-workspace .topbar.v2-topbar,
body.v2-erp-authenticated.app-wide-workspace .topbar.v2-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--v2-topbar-height);
  min-height: var(--v2-topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .10);
}

.brand-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.brand-name > strong {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
}

.brand-system {
  display: inline-flex;
  align-items: center;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.v2-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.v2-mobile-menu-btn {
  display: none;
}

.v2-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  white-space: nowrap;
  min-width: 0;
}

.v2-crumb-parent {
  color: var(--muted);
  font-weight: 500;
}

.v2-crumb-sep {
  color: var(--control-border);
}

.v2-crumb-current {
  color: var(--ink);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(340px, 30vw);
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  box-sizing: border-box;
  flex-shrink: 0;
  transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}

.v2-global-search:focus-within {
  background: var(--white);
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  color: var(--green);
}

.v2-global-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12.5px;
  color: var(--ink);
}

.v2-global-search input::placeholder {
  color: var(--muted);
}

.v2-topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.v2-notify-bell {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  text-decoration: none;
  transition: background-color .14s ease, color .14s ease;
}

.v2-notify-bell:hover {
  background: var(--surface);
  color: var(--green);
}

.v2-bell-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px var(--white);
}

.v2-topbar-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.v2-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Preserve <nav aria-label="主导航"> DOM contract while displaying clean V2 user controls */
body.v2-erp-authenticated .topbar .v2-topbar-right > nav,
body.v2-erp-authenticated.ui-supply .topbar .v2-topbar-right > nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  width: auto;
}

body.v2-erp-authenticated .v2-contract-link {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar [data-login-person] {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.v2-topbar-right > nav .v2-account-action {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .14s ease, color .14s ease;
}

.v2-topbar-right > nav .v2-account-action:hover,
.v2-topbar-right > nav .v2-account-action[aria-current="page"] {
  color: var(--green);
  background: var(--green-soft);
}

.v2-topbar-right > nav form[data-logout-form] {
  display: inline-flex;
  margin: 0;
}

.topbar .link-button {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  transition: background-color .14s ease, color .14s ease;
}

.topbar .link-button:hover {
  color: var(--orange);
  background: var(--orange-soft);
}

.v2-online-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

/* Balanced symmetric 24px workspace shell across all operational screens */
body:not(.erp-login-page):not(.login-page) .page-shell,
body.ui-supply .page-shell {
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 16px 24px 36px;
  flex: 1;
  box-sizing: border-box;
}

/* Warehouse secondary nav stays in DOM for tests while V2 left sidebar owns navigation */
body.v2-erp-authenticated .warehouse-navigation {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[data-warehouse-read-scope] {
  margin: 0 0 10px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-secondary);
  background: rgba(37, 99, 235, .05);
  border: 1px solid rgba(37, 99, 235, .16);
  border-radius: 8px;
}

/* Harmonize supply-flow & business-table-frame widths */
table.business-table-frame,
.product-archive-page .pa-table.business-table-frame {
  width: 100%;
  max-width: none;
}

.supply-ledger-page .supply-table.business-table-frame {
  width: calc(100% - 48px);
  max-width: none;
}

body.ui-supply .ui-title {
  margin: 0 0 12px;
  gap: 16px;
}

body.ui-supply .ui-title h1 {
  font-size: 20px;
  line-height: 1.3;
  margin: 0;
  font-weight: 700;
}

body.ui-supply .ui-title p {
  font-size: 12.5px;
  margin: 2px 0 0;
}

body.ui-supply .ui-card {
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

body.ui-supply .ui-tabs {
  padding: 0 20px;
  gap: 22px;
}

body.ui-supply .ui-tabs a,
body.ui-supply .ui-tabs button {
  font-size: 13.5px;
  padding: 11px 0 10px;
}

body.ui-supply .ui-filter {
  padding: 12px 20px;
  gap: 10px;
}

body.ui-supply .ui-field input:not([type="checkbox"]),
body.ui-supply .ui-field select,
body.ui-supply .ui-btn {
  min-height: 36px;
  height: 36px;
  padding-block: 0;
}

footer {
  padding: 14px 24px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   3. V2 Page Headers, Mode Chips & Unified Xiaoqiao Green Buttons
   -------------------------------------------------------------------------- */
.page-heading .eyebrow,
.assignment-overview-head .eyebrow,
.special-workspace .heading .eyebrow,
.panel-head .eyebrow,
.purchase-panel-head .eyebrow {
  display: none;
}

.page-heading,
.wb-title,
.special-workspace .heading,
.purchase-workspace .page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 12px;
}

.purchase-task-heading-main.heading-with-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.purchase-title-lockup,
.purchase-workspace .purchase-title-lockup.v2-title-row,
.v2-title-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: auto;
}

.page-heading h1,
.wb-title h1,
.special-workspace .heading h1,
.purchase-workspace .page-heading h1,
.purchase-title-lockup h1,
.warehouse-workspace .page-heading h1 {
  width: auto;
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--ink);
  text-align: left;
  text-align-last: auto;
}

.v2-mode-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(23, 107, 75, .18);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.v2-header-toggles {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.page-heading p,
.wb-title p,
.special-workspace .heading p,
.purchase-workspace .page-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 960px;
}

@media (min-width: 1101px) {
  .purchase-task-heading p {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Unified crisp ERP buttons in Xiaoqiao Green */
.primary,
.secondary,
.button.button-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}

.primary {
  color: var(--white);
  background: var(--green);
  border: 1px solid var(--green);
  box-shadow: 0 1px 2px rgba(23, 107, 75, .16);
}

.primary:hover {
  background: #13583e;
  border-color: #13583e;
  color: var(--white);
}

.secondary {
  color: var(--ink-secondary);
  background: var(--white);
  border: 1px solid var(--control-border);
}

.secondary:hover,
.v2-header-toggles .button[aria-pressed="true"],
.v2-board-toggle.is-active {
  color: var(--green);
  border-color: var(--green);
  background: rgba(23, 107, 75, .06);
}

.purchase-workspace .purchase-exception-filter {
  color: var(--ink);
  background: var(--orange-soft);
  border: 1px solid rgba(242, 101, 34, .35);
}

.purchase-workspace .purchase-exception-filter:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--white);
}

.erp-home-quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   4. V2 Tinted Icon Status Strip & KPI Ribbons
   -------------------------------------------------------------------------- */
.metric-grid,
.purchase-workspace .purchase-summary-grid,
.wb-summary,
.warehouse-summary-grid {
  gap: 12px;
  margin-bottom: 12px;
}

.v2-status-strip,
.erp-grid-4,
.home-workspace .metric-grid:has(> :nth-child(4)) {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric,
.purchase-workspace .metric,
.wb-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
  padding: 11px 15px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-top-width: 1px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}

a.metric:hover,
.wb-stat:hover {
  border-color: var(--green);
  box-shadow: var(--shadow-elevated);
}

.metric > span,
.purchase-workspace .metric > span,
.wb-stat > span {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-secondary);
  line-height: 1.35;
}

.metric > small,
.purchase-workspace .metric > small,
.wb-stat > small {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric > strong,
.purchase-workspace .metric > strong,
.wb-stat > strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
}

.metric > strong.name-metric {
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
}

.metric.processing { border-left-color: var(--blue); border-top-color: var(--line); border-top-width: 1px; }
.metric.processing > strong { color: var(--blue); }

.metric.info { border-left-color: var(--light-blue); border-top-color: var(--line); border-top-width: 1px; }
.metric.info > strong { color: var(--ink); }

.metric.success { border-left-color: var(--green); border-top-color: var(--line); border-top-width: 1px; }
.metric.success > strong { color: var(--green); }

.metric.warning,
.wb-stat-attention { border-left-color: var(--orange); border-top-color: var(--line); border-top-width: 1px; }
.metric.warning > strong,
.wb-stat-attention > strong { color: var(--orange); }

.wb-stat[aria-current="true"] {
  border-color: var(--green);
  border-left-width: 3px;
  background: rgba(23, 107, 75, .05);
}

/* V2-B01 Tinted Icon Cards */
.purchase-workspace .v2-status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-left-width: 1px;
  border-top-width: 1px;
  border-radius: 12px;
  background: var(--white);
}

.v2-status-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v2-status-all .v2-status-icon { background: var(--blue-soft); color: var(--blue); }
.v2-status-pending .v2-status-icon { background: var(--orange-soft); color: var(--orange); }
.v2-status-done .v2-status-icon { background: var(--green-soft); color: var(--green); }
.v2-status-stop .v2-status-icon { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

.v2-status-body {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 10px;
}

.v2-status-body > span {
  grid-column: 1;
  grid-row: 1;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-secondary);
}

.v2-status-body > strong {
  grid-column: 2;
  grid-row: 1;
  font-size: 22px;
  font-weight: 750;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.v2-status-body > small {
  grid-column: 1 / span 2;
  grid-row: 2;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-status-all .v2-status-body > strong { color: var(--blue); }
.v2-status-pending .v2-status-body > strong { color: var(--orange); }
.v2-status-done .v2-status-body > strong { color: var(--green); }
.v2-status-stop .v2-status-body > strong { color: var(--orange); }

.purchase-workspace .v2-status-card.is-selected,
.purchase-workspace a.v2-status-card:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), var(--shadow);
  background: linear-gradient(180deg, rgba(23, 107, 75, .04), #ffffff);
}

/* Warehouse queue roster card aligned neatly with the 2 KPI tiles */
.warehouse-summary-grid > .warehouse-team {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.warehouse-team-heading h2 {
  font-size: 12.5px;
  margin: 0 0 3px;
  color: var(--ink-secondary);
}

/* --------------------------------------------------------------------------
   5. Collapsible Store & Manager Chronological Switcher (采购任务看板)
   -------------------------------------------------------------------------- */
.assignment-overview {
  margin-bottom: 12px;
}

.assignment-overview-head {
  align-items: center;
  margin-bottom: 6px;
}

.assignment-overview-head h2 {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-secondary);
}

.assignment-overview-head p {
  font-size: 12px;
}

.manager-switcher {
  gap: 6px;
  margin-bottom: 8px;
  padding: 0;
}

.purchase-workspace .manager-switcher-button,
.manager-switcher-button {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: none;
}

.manager-switcher-button:hover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(23, 107, 75, .04);
}

.manager-switcher-button.is-active,
.purchase-workspace .manager-switcher-button.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
  box-shadow: none;
}

@media (min-width: 1101px) {
  .purchase-workspace .manager-store-row {
    padding: 8px 10px;
    gap: 8px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
  }

  .purchase-workspace .manager-summary {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--green);
    border-top-width: 1px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .purchase-workspace .manager-summary h3 {
    font-size: 14px;
    margin: 0;
  }

  .purchase-workspace .assignment-card {
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    border-top: 2px solid var(--green);
    box-shadow: none;
    background: var(--white);
    transition: border-color .14s ease, background-color .14s ease;
  }

  .purchase-workspace .assignment-card:hover {
    border-color: var(--green);
    background: rgba(23, 107, 75, .03);
    transform: none;
  }

  .purchase-workspace .assignment-card.is-selected {
    border-color: var(--green);
    background: rgba(23, 107, 75, .07);
    box-shadow: 0 0 0 1px var(--green);
  }

  .purchase-workspace .store-card-head {
    margin-bottom: 3px;
    min-height: 20px;
  }

  .purchase-workspace .assignment-card h4 {
    font-size: 13.5px;
    font-weight: 700;
    margin: 0;
  }

  .purchase-workspace .store-card-details {
    gap: 2px 6px;
  }

  .purchase-workspace .store-card-details .task-line,
  .purchase-workspace .store-card-details .empty-task {
    font-size: 12px;
  }

  .purchase-workspace .store-card-details .task-status-line {
    font-size: 11.5px;
  }

  .purchase-workspace .store-card-details .compact-secondary-action {
    height: auto;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 11.5px;
    line-height: 1.4;
    border: 0;
    background: var(--green-soft);
    color: var(--green);
  }
}

.business-tag {
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--light-blue-soft);
  border: 1px solid rgba(82, 182, 245, .35);
}

.assignment-card .clearance-tag {
  font-size: 11px;
  color: var(--ink);
  background: var(--orange-soft);
  border-color: rgba(242, 101, 34, .35);
}

/* --------------------------------------------------------------------------
   6. V2 Stacked Filter Bar, Action Pill Toolbar & Shared Filter Alignment
   -------------------------------------------------------------------------- */
.filter-panel {
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.filter-form label,
.warehouse-filter[data-warehouse-filter] .warehouse-filter-field {
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.purchase-workspace .v2-stacked-filters {
  display: grid;
  grid-template-columns: minmax(108px, 140px) minmax(128px, 175px) minmax(108px, 145px) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.purchase-workspace .v2-stacked-filters > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin: 0;
}

.purchase-workspace .v2-stacked-filters select,
.purchase-workspace .v2-stacked-filters input {
  width: 100%;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  box-sizing: border-box;
}

.purchase-workspace .v2-stacked-filters select:focus,
.purchase-workspace .v2-stacked-filters input:focus {
  border-color: var(--green);
  outline: 3px solid var(--green-soft);
}

.v2-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.v2-action-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.v2-action-pills .button.button-compact {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.purchase-bulk-toolbar.v2-bulk-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 12px;
  margin: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.purchase-bulk-toolbar.v2-bulk-inline .button.button-compact {
  height: 26px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
}

@media (min-width: 1101px) {
  .filter-panel:has(> .filter-form + .filter-result) {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
  }

  .filter-panel:has(> .filter-form + .filter-result) > .filter-form {
    flex: 1;
    min-width: 0;
  }

  .filter-panel:has(> .filter-form + .filter-result) > .filter-result {
    margin: 0;
    height: 36px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }

  .filter-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .filter-form select,
  .purchase-workspace .filter-form input,
  .purchase-workspace .filter-form select,
  .product-archive-page .pa-filters input,
  .product-archive-page .pa-filters select {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--white);
    color: var(--ink);
    font-size: 13px;
    box-sizing: border-box;
  }

  .filter-actions,
  .product-archive-page .filter-actions,
  .purchase-filter-actions {
    display: inline-flex;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    align-items: center;
    gap: 8px;
  }

  .filter-actions .primary,
  .app-wide-workspace .filter-actions .primary,
  .purchase-workspace .purchase-filter-actions .button,
  .purchase-filter-actions .purchase-filter-submit,
  .filter-actions .filter-clear,
  .purchase-filter-actions .purchase-filter-clear,
  .product-archive-page .pa-extra-filter > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    box-sizing: border-box;
    text-decoration: none;
    white-space: nowrap;
  }

  .filter-actions .filter-clear,
  .purchase-filter-actions .purchase-filter-clear,
  .product-archive-page .pa-extra-filter > summary {
    color: var(--ink-secondary);
    background: var(--white);
    border: 1px solid var(--control-border);
    font-weight: 500;
  }

  .filter-actions .filter-clear:hover,
  .purchase-filter-actions .purchase-filter-clear:hover,
  .product-archive-page .pa-extra-filter > summary:hover {
    color: var(--green);
    border-color: var(--green);
    background: rgba(23, 107, 75, .04);
  }

  .product-archive-page .pa-extra-filter > summary {
    list-style: none;
  }

  .product-archive-page .pa-extra-filter > summary::-webkit-details-marker {
    display: none;
  }

  .product-archive-page .pa-extra-filter > label {
    top: calc(100% + 6px);
    z-index: 15;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-elevated);
  }

  /* Warehouse shared filter bar unified to exact 36px row alignment */
  .warehouse-filter[data-warehouse-filter] {
    padding: 12px 16px;
    gap: 10px;
    align-items: end;
  }

  .warehouse-filter[data-warehouse-filter] input:not([type="hidden"]),
  .warehouse-filter[data-warehouse-filter] select {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    font-size: 13px;
  }

  .warehouse-filter[data-warehouse-filter] .warehouse-filter-actions,
  body.ui-supply .ui-filter .ui-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding-bottom: 0;
  }

  .warehouse-filter[data-warehouse-filter] button[type="submit"],
  .warehouse-filter[data-warehouse-filter] .wb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--green);
    border: 1px solid var(--green);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
  }

  .warehouse-filter[data-warehouse-filter] .warehouse-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    background: var(--white);
    color: var(--ink-secondary);
    font-size: 13px;
    font-weight: 500;
  }

  .warehouse-filter[data-warehouse-filter] .warehouse-filter-clear:hover {
    color: var(--green);
    border-color: var(--green);
    background: rgba(23, 107, 75, .04);
  }
}

/* --------------------------------------------------------------------------
   7. V2 Master-Detail Split Workspace, Inspector Drawer & Flow Strip
   -------------------------------------------------------------------------- */
.v2-split-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 14px;
  align-items: start;
}

.v2-split-workspace.is-inspector-closed {
  grid-template-columns: minmax(0, 1fr);
}

.v2-split-main {
  min-width: 0;
}

.v2-inspector-drawer {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: calc(var(--v2-topbar-height) + 14px);
  overflow: hidden;
}

.v2-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.v2-inspector-head strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.v2-inspector-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.v2-inspector-close:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.v2-inspector-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.v2-inspector-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
}

.v2-inspector-hero {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.v2-inspector-thumb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v2-inspector-hero-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.v2-inspector-hero-meta > strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}

.v2-inspector-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.v2-inspector-codes > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-secondary);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.v2-inspector-codes em {
  font-style: normal;
  font-weight: 700;
  color: var(--green);
}

.v2-inspector-codes b {
  font-weight: 600;
}

.v2-inspector-kv {
  margin: 0;
  display: grid;
  gap: 7px;
}

.v2-inspector-kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line-soft);
}

.v2-inspector-kv > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.v2-inspector-kv dt {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

.v2-inspector-kv dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
  font-variant-numeric: tabular-nums;
}

.v2-ins-badge {
  display: inline-flex;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11.5px;
  font-weight: 650;
}

.v2-ins-owner {
  color: var(--green) !important;
  font-weight: 700 !important;
}

.v2-inspector-sub {
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 8px 10px;
  background: var(--surface);
}

.v2-inspector-sub > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-secondary);
}

.v2-inspector-sub[open] > summary {
  margin-bottom: 8px;
}

.v2-inspector-cta {
  width: 100%;
  justify-content: center;
  height: 36px;
}

.v2-formula-callout {
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--green-soft);
  border: 1px solid rgba(23, 107, 75, .20);
  color: var(--ink-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.v2-formula-callout strong {
  color: var(--green);
}

/* Bottom Upstream -> Downstream Flow Strip */
.v2-flow-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(23, 107, 75, .07), rgba(37, 99, 235, .05));
  border: 1px solid rgba(23, 107, 75, .18);
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.v2-flow-node,
.v2-flow-highlight {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.v2-flow-highlight strong {
  color: var(--green);
  margin: 0 2px;
}

.v2-flow-arrow {
  color: var(--green);
  font-weight: 700;
}

.v2-flow-sep {
  color: var(--control-border);
}

/* --------------------------------------------------------------------------
   8. Data Cards, Tables, Row Thumbnails, Status Pills & Action Pills
   -------------------------------------------------------------------------- */
.panel,
.table-card,
.wb-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.panel:not(.filter-panel):not(.warehouse-team) {
  padding: 16px 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

/* Workbench & Warehouse queue tabs */
.wb-tabs {
  padding: 8px 16px 0;
  gap: 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.wb-tabs a {
  padding: 7px 12px;
  border-radius: 7px 7px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.wb-tabs a[aria-current="page"] {
  background: var(--white);
  color: var(--green);
  font-weight: 650;
  box-shadow: inset 0 2px 0 var(--green);
}

.v2-underline-tabs .warehouse-queue-tab.is-active {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-soft);
  font-weight: 650;
}

.warehouse-queue-filter-panel .warehouse-queue-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-width: 0;
}

.warehouse-queue-filter-panel .warehouse-queue-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.warehouse-queue-filter-panel .warehouse-queue-search,
.warehouse-queue-filter-panel .warehouse-queue-search input {
  min-width: 0;
}

@media (max-width: 1520px) {
  .warehouse-queue-filter-panel .warehouse-queue-search input {
    width: 196px;
  }
}

.v2-compact-steps {
  margin-bottom: 10px;
}

/* Crisp ERP table typography & interactive selection */
table thead th {
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
  padding-top: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

table tbody td {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}

table tbody tr:hover > td {
  background-color: #f8fafc;
}

tr[data-v2-task-row],
tr[data-v2-wb-row],
table[data-inventory-table] tr.inventory-data-row {
  cursor: pointer;
}

tr.is-v2-selected > td {
  background-color: rgba(23, 107, 75, .055) !important;
}

tr.is-v2-selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

.v2-row-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 7px;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  vertical-align: middle;
  flex-shrink: 0;
}

.v2-row-thumb + .purchase-product-identifier {
  display: inline-block;
  vertical-align: middle;
  max-width: calc(100% - 35px);
}

.warehouse-table td.warehouse-product {
  white-space: normal;
}

.warehouse-table td.warehouse-product > span:not(.v2-row-thumb),
.warehouse-table td.warehouse-product > strong {
  vertical-align: middle;
}

.v2-row-thumb-acc {
  background: var(--light-blue-soft);
  color: var(--blue);
}

.v2-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.v2-status-pill.is-done {
  background: var(--green-soft);
  color: var(--green);
}

.v2-status-pill.is-pending {
  background: var(--orange-soft);
  color: var(--orange);
}

.v2-status-pill.is-stop {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}

.purchase-sticky-header,
.warehouse-sticky-header,
.demand-sticky-header {
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .06);
}

/* Symmetric balanced outer padding & crisp 14-column proportions */
.purchase-workspace {
  --purchase-table-min-width: 960px;
}

.purchase-workspace .purchase-task-table {
  min-width: 1080px;
}

.purchase-workspace .purchase-task-table .purchase-table-head-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.purchase-workspace .purchase-task-table .purchase-col-select { width: 3.0%; }
.purchase-workspace .purchase-task-table .purchase-col-owner { width: 5.0%; }
.purchase-workspace .purchase-task-table .purchase-col-sku { width: 8.4%; }
.purchase-workspace .purchase-task-table .purchase-col-emg { width: 10.2%; }
.purchase-workspace .purchase-task-table .purchase-col-product { width: 14.8%; }
.purchase-workspace .purchase-task-table .purchase-col-inventory { width: 5.4%; }
.purchase-workspace .purchase-task-table .purchase-col-sales { width: 7.8%; }
.purchase-workspace .purchase-task-table .purchase-col-turnover { width: 8.4%; }
.purchase-workspace .purchase-task-table .purchase-col-returns { width: 6.4%; }
.purchase-workspace .purchase-task-table .purchase-col-quantity { width: 5.0%; }
.purchase-workspace .purchase-task-table .purchase-col-status { width: 6.0%; }
.purchase-workspace .purchase-task-table .purchase-col-date { width: 6.4%; }
.purchase-workspace .purchase-task-table .purchase-col-actual-quantity { width: 4.8%; }
.purchase-workspace .purchase-task-table .purchase-col-action { width: 8.4%; }

.v2-split-main .wb-table {
  min-width: 740px !important;
}

.warehouse-workspace .warehouse-table,
.warehouse-queue-workspace .warehouse-table {
  min-width: 1080px !important;
}

@media (min-width: 1025px) and (max-width: 1680px) {
  .v2-split-workspace[data-v2-task-workspace] {
    grid-template-columns: minmax(0, 1fr);
  }

  .v2-split-workspace[data-v2-task-workspace] > .v2-inspector-drawer {
    position: fixed;
    right: 20px;
    top: calc(var(--v2-topbar-height) + 12px);
    bottom: 56px;
    width: 304px;
    z-index: 65;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
  }
}

.purchase-task-table th:first-child,
.purchase-task-table td:first-child,
.wb-table th:first-child,
.wb-table td:first-child {
  padding-left: 16px;
}

.purchase-task-table th:last-child,
.purchase-task-table td:last-child,
.wb-table th:last-child,
.wb-table td:last-child {
  padding-right: 16px;
}

@media (min-width: 1101px) {
  .purchase-task-table .table-action,
  .purchase-task-table .purchase-row-action,
  .wb-table .wb-task-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--green);
    background: rgba(23, 107, 75, .08);
    border: 1px solid rgba(23, 107, 75, .20);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  }

  .wb-table .wb-task-action:hover {
    color: var(--white);
    background: var(--green);
    border-color: var(--green);
  }

  .purchase-task-table .table-action:hover,
  .purchase-task-table .purchase-row-action:hover,
  .purchase-task-table .purchase-hover-orange:hover,
  .purchase-task-table .purchase-plain-link.purchase-hover-orange:hover {
    color: var(--orange);
    background: rgba(23, 107, 75, .08);
    border-color: rgba(23, 107, 75, .20);
    text-decoration: none;
  }
}

.product-sku-link {
  color: var(--blue);
  font-weight: 600;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.product-sku-link:is(:hover, :focus-visible, :active) {
  color: var(--orange);
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.data-pill,
.status,
.wb-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   9. V2 3-Column Purchase Entry & Live Math Sidebar (purchase_confirm.html)
   -------------------------------------------------------------------------- */
@media (min-width: 1281px) {
  .purchase-workspace .v2-three-col-entry {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 268px;
    gap: 14px;
    align-items: start;
  }

  .purchase-workspace .v2-three-col-entry:not(:has(> .v2-math-sidebar)) {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

@media (min-width: 1281px) and (max-width: 1720px) {
  .v2-center-entry-card .purchase-entry-form .purchase-entry-inline {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(112px, .9fr);
    gap: 12px;
  }

  .v2-center-entry-card .purchase-entry-form .purchase-entry-inline > label:first-child {
    grid-column: auto;
  }

  .v2-center-entry-card .purchase-entry-form .purchase-entry-inline > .purchase-inline-save {
    width: 100%;
    justify-content: center;
  }

  .v2-center-entry-card .purchase-entry-form .purchase-retained-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .v2-center-entry-card .purchase-entry-form .purchase-retained-fields > label:last-child {
    grid-column: 1 / -1;
  }
}

.v2-plan-product-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  margin: 10px 0 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.v2-plan-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v2-plan-product-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.v2-plan-product-text > strong {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
  word-break: break-word;
}

.v2-plan-sidebar .purchase-plan-grid,
.v2-source-readonly-card .warehouse-fact-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
  margin-top: 10px;
}

.v2-plan-sidebar .purchase-plan-grid > .purchase-plan-item,
.v2-source-readonly-card .warehouse-fact-grid > p {
  grid-column: 1 / -1 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 6px 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line-soft) !important;
  background: transparent !important;
}

.v2-plan-sidebar .purchase-plan-grid > .purchase-plan-item:last-child,
.v2-source-readonly-card .warehouse-fact-grid > p:last-child {
  border-bottom: 0 !important;
}

.v2-plan-sidebar .purchase-plan-grid dt,
.v2-source-readonly-card .warehouse-fact-grid > p > span {
  font-size: 12px !important;
  color: var(--muted) !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

.v2-plan-sidebar .purchase-plan-grid dd,
.v2-source-readonly-card .warehouse-fact-grid > p > strong {
  margin: 0 !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  text-align: right !important;
  word-break: break-word !important;
}

.v2-plan-sidebar .purchase-plan-total dd strong {
  font-size: 15px !important;
  color: var(--green) !important;
  margin-right: 2px;
}

.v2-page-header h1,
.wb-title.v2-page-header h1,
.warehouse-heading.v2-page-header h1,
.inventory-heading.v2-page-header h1 {
  font-size: 20px !important;
  font-weight: 750 !important;
  line-height: 1.3 !important;
}

.v2-split-main table[data-inventory-table] {
  min-width: 760px !important;
}

.v2-code-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.v2-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
}

.v2-chip em {
  font-style: normal;
  font-weight: 700;
}

.v2-chip-sku em { color: var(--blue); }
.v2-chip-spu em { color: var(--green); }
.v2-chip-emg em { color: var(--orange); }

.v2-section-bar {
  padding: 6px 10px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12.5px;
  font-weight: 700;
  border-left: 3px solid var(--green);
}

.v2-math-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: calc(var(--v2-topbar-height) + 14px);
}

.v2-math-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.v2-math-rows {
  margin: 0;
  display: grid;
  gap: 8px;
}

.v2-math-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.v2-math-rows dt {
  color: var(--muted);
}

.v2-math-rows dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.v2-math-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.v2-math-total strong {
  font-size: 18px;
  font-weight: 750;
  color: var(--green);
}

.v2-sticky-submit-bar {
  position: sticky;
  bottom: 12px;
  z-index: 40;
  margin-top: 14px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

body:has([data-preview-only-dock]) .v2-sticky-submit-bar {
  bottom: 56px;
}

.v2-sticky-total {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.v2-sticky-total strong {
  font-size: 18px;
  font-weight: 750;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   10. V2 Conservation Equation Banner & Receipt Grid (warehouse_item.html)
   -------------------------------------------------------------------------- */
.v2-conservation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 11px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(23, 107, 75, .08), rgba(255, 255, 255, .98));
  border: 1px solid rgba(23, 107, 75, .24);
  box-shadow: var(--shadow);
}

.v2-eq-label {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.v2-eq-items {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.v2-eq-box {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 9px;
  background: var(--white);
  border: 1px solid var(--line);
}

.v2-eq-box span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.v2-eq-box strong {
  font-size: 17px;
  font-weight: 750;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.v2-eq-box.is-highlight {
  border-color: var(--green);
  background: var(--green-soft);
}

.v2-eq-box.is-highlight strong {
  color: var(--green);
}

.v2-eq-op {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}

@media (min-width: 1281px) {
  .v2-receive-grid {
    display: grid;
    grid-template-columns: 276px minmax(0, 1fr) 256px;
    gap: 14px;
    align-items: start;
    margin-bottom: 14px;
  }

  .v2-receive-grid > .panel {
    margin-bottom: 0;
  }
}

.v2-receive-preview-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.v2-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.v2-preview-list li {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.v2-preview-list li strong {
  font-size: 12.5px;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   11. V2 Executive Todo Bar, Wallet Ledger Strip & Home Organization
   -------------------------------------------------------------------------- */
.v2-exec-todo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 18px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(23, 107, 75, .08), rgba(255, 255, 255, .98));
  border: 1px solid rgba(23, 107, 75, .22);
  box-shadow: var(--shadow);
}

.v2-exec-todo-lead {
  display: grid;
  gap: 2px;
}

.v2-exec-todo-lead strong {
  font-size: 14px;
  font-weight: 750;
  color: var(--green);
}

.v2-exec-todo-lead span {
  font-size: 12px;
  color: var(--muted);
}

.v2-exec-todo-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.v2-todo-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .14s ease, box-shadow .14s ease, color .14s ease;
}

.v2-todo-pill:hover {
  border-color: var(--green);
  color: var(--green);
  box-shadow: var(--shadow);
}

.v2-todo-pill strong {
  font-size: 15px;
  font-weight: 750;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.v2-todo-pill em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
}

.v2-ledger-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.v2-ledger-cell {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.v2-ledger-cell span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.v2-ledger-cell strong {
  font-size: 20px;
  font-weight: 750;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.v2-ledger-cell.is-accent {
  border-color: rgba(23, 107, 75, .32);
  background: linear-gradient(180deg, rgba(23, 107, 75, .05), #ffffff);
}

.v2-ledger-cell.is-accent strong {
  color: var(--green);
}

.v2-manager-wallet-chip {
  display: inline-block;
  padding: 4px 10px;
  margin: 0 6px 8px 0;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.home-metric-group {
  margin-bottom: 16px;
}

.home-metric-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.home-metric-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.home-metric-heading p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

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

.callout {
  background: var(--surface);
  border-left: 3px solid var(--green);
}

.callout h2,
.panel-head h2 {
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 6px;
}

/* --------------------------------------------------------------------------
   12. V2 Enterprise Login Page (Xiaoqiao Green)
   -------------------------------------------------------------------------- */
.erp-login-page .page-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 52px 24px;
}

.erp-login-page .login-layout {
  display: grid;
  grid-template-columns: 1.15fr .95fr;
  align-items: stretch;
  gap: 32px;
  padding: 36px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-elevated);
}

.erp-login-page .login-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 20px;
  border-right: 1px solid var(--line-soft);
}

.v2-login-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.v2-login-badge strong {
  font-size: 16px;
  font-weight: 750;
  color: var(--ink);
}

.erp-login-page .login-copy h1 {
  font-size: 27px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 10px;
  color: var(--ink);
}

.erp-login-page .login-copy > p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 20px;
}

.erp-login-page .promise-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.erp-login-page .promise-list li {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--green);
}

.erp-login-page .promise-list li strong {
  font-size: 13px;
  color: var(--ink);
}

.erp-login-page .promise-list li span {
  font-size: 12px;
  color: var(--muted);
}

.erp-login-page .login-card {
  padding: 8px 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.v2-login-card-head {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  justify-items: start;
}

.erp-login-page .login-card h2 {
  font-size: 21px;
  font-weight: 750;
  margin: 2px 0 0;
}

.v2-login-card-head p {
  margin: 0;
}

.erp-login-page .login-card .form-stack label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  gap: 6px;
}

.erp-login-page .login-card input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  font-size: 14px;
}

.erp-login-page .login-card input:focus {
  border-color: var(--green);
  outline: 3px solid var(--green-soft);
}

.erp-login-page .login-card .primary {
  height: 40px;
  margin-top: 6px;
  font-size: 14px;
}

.erp-login-page .alert {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--orange-soft);
  border: 1px solid var(--orange);
  color: var(--ink);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   13. Wide Table Frames & Responsive Breakpoints (1440 / 1280 / 1024 / 390)
   -------------------------------------------------------------------------- */
.product-archive-page [data-warehouse-header-scroll] {
  padding-inline: 0;
}

.product-archive-page .pa-table {
  min-width: 1080px;
}

.special-workspace .special-table {
  min-width: 980px !important;
}

.special-workspace .special-purchase-frame .special-table {
  min-width: 1180px !important;
}

@media (max-width: 1280px) {
  .v2-split-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .v2-inspector-drawer,
  .v2-math-sidebar {
    position: static;
  }

  .v2-receive-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 14px;
  }
}

@media (max-width: 1024px) {
  .v2-sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: none;
  }

  body.v2-sidebar-open .v2-sidebar {
    transform: translateX(0);
    box-shadow: 0 12px 32px rgba(16, 24, 40, .20);
  }

  .v2-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(17, 24, 39, .38);
    backdrop-filter: blur(2px);
  }

  body.v2-erp-authenticated .v2-workspace-frame {
    margin-left: 0;
    width: 100%;
  }

  .v2-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
  }

  .v2-mobile-menu-btn:hover {
    border-color: var(--green);
    color: var(--green);
  }

  body.v2-erp-authenticated .topbar.v2-topbar,
  body.v2-erp-authenticated.ui-supply .topbar.v2-topbar,
  body.v2-erp-authenticated.purchase-workspace .topbar.v2-topbar,
  body.v2-erp-authenticated.app-wide-workspace .topbar.v2-topbar {
    height: auto;
    min-height: 54px;
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .v2-global-search {
    width: 220px;
  }

  body:not(.erp-login-page):not(.login-page) .page-shell,
  body.ui-supply .page-shell {
    padding: 14px 16px 36px;
  }

  .page-heading,
  .wb-title,
  .special-workspace .heading,
  .purchase-task-heading-main.heading-with-action {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .v2-status-strip,
  .metric-grid,
  .purchase-workspace .purchase-summary-grid,
  .wb-summary,
  .v2-ledger-strip,
  .erp-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-workspace .v2-stacked-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .erp-login-page .login-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .erp-login-page .login-copy {
    padding-right: 0;
    padding-bottom: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
}

@media (max-width: 720px) {
  .v2-global-search {
    order: 3;
    width: 100%;
    flex: 1 1 100%;
  }

  .v2-online-pill,
  .v2-topbar-divider,
  .v2-user-avatar,
  .v2-crumb-parent,
  .v2-crumb-sep,
  .topbar a[href*="password"] {
    display: none !important;
  }

  .v2-status-strip,
  .metric-grid,
  .purchase-workspace .purchase-summary-grid,
  .wb-summary,
  .warehouse-summary-grid,
  .v2-ledger-strip,
  .erp-grid-4,
  .purchase-workspace .v2-stacked-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand-system {
    display: none;
  }

  .erp-login-page .page-shell {
    padding: 20px 14px;
  }

  .erp-login-page .login-layout {
    padding: 20px;
    gap: 20px;
  }
}

/* --------------------------------------------------------------------------
   14. 自建采购单 (unified_purchase.html): 01 公共信息单行六列均衡布局、单位列与底栏收口
   -------------------------------------------------------------------------- */
.new-product-workspace .np-heading {
  margin-bottom: 14px;
}

.new-product-workspace .np-heading h1 {
  font-size: 20px;
  font-weight: 750;
  line-height: 1.3;
  margin: 0 0 2px;
}

.unified-purchase-workspace .up-mode-row,
.unified-purchase-workspace .up-settlement-row {
  margin: 0 0 12px;
  gap: 14px;
}

.unified-purchase-workspace .up-mode-tabs button {
  padding: 6px 16px;
  line-height: 1.45;
}

.unified-purchase-workspace .np-form .panel {
  padding: 16px 20px;
  margin: 0 0 12px;
  border-radius: 12px;
}

.unified-purchase-workspace .np-section-head {
  margin-bottom: 14px;
}

.unified-purchase-workspace .np-common-grid.up-common-one-row-grid {
  display: grid;
  grid-template-columns: minmax(124px, .92fr) minmax(134px, .95fr) minmax(124px, .92fr) minmax(168px, 1.28fr) minmax(118px, .88fr) minmax(176px, 1.35fr);
  gap: 12px 14px;
  align-items: start;
}

.unified-purchase-workspace .np-common-grid.up-common-one-row-grid > label {
  font-weight: 600;
  color: var(--ink-secondary);
  min-width: 0;
  white-space: nowrap;
}

.unified-purchase-workspace .np-common-grid.up-common-one-row-grid input:not([type="checkbox"]):not([type="hidden"]),
.unified-purchase-workspace .np-common-grid.up-common-one-row-grid select {
  margin-top: 6px;
  height: 38px;
  min-height: 38px;
  width: 100%;
  min-width: 0;
}

.unified-purchase-workspace .np-form:not(.up-is-combined) .up-item-table {
  min-width: 1120px;
}

.unified-purchase-workspace .np-form:not(.up-is-combined) .up-col-emg {
  width: 11%;
}

.unified-purchase-workspace .np-form:not(.up-is-combined) .up-col-kind {
  width: 9.5%;
}

.unified-purchase-workspace .np-form:not(.up-is-combined) .up-col-quantity {
  width: 8.5%;
}

.unified-purchase-workspace .np-form:not(.up-is-combined) .up-col-unit {
  width: 7%;
}

.purchase-workspace .np-required {
  color: var(--orange);
  font-weight: 700;
}

.purchase-workspace .v2-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 21px;
  white-space: nowrap;
}

.unified-purchase-workspace .np-form,
.unified-purchase-workspace .np-form > .panel {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 601px) and (max-width: 1099px) {
  .purchase-entry-form .purchase-entry-inline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .purchase-entry-form .purchase-entry-inline > label:first-child {
    grid-column: auto;
  }
  .purchase-entry-form .purchase-entry-inline > .purchase-inline-save {
    width: 100%;
    justify-content: center;
  }
}

.unified-purchase-workspace .up-payment-footer .up-payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.unified-purchase-workspace .up-footer-flow-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.unified-purchase-workspace .up-payment-actions-right {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.unified-purchase-workspace .up-payment-footer:not(.up-has-combined) .up-payment-total {
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
}

.unified-purchase-workspace .up-payment-footer .up-payment-actions-right > button {
  height: 38px;
  min-height: 38px;
  margin: 0;
  white-space: nowrap;
}

.unified-purchase-workspace .up-is-combined .up-payment-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(220px, 1.3fr) auto;
  align-items: end;
  gap: 16px;
}

.unified-purchase-workspace .up-is-combined .up-payment-actions-right {
  align-items: flex-end;
}

.unified-purchase-workspace .up-is-combined .up-payment-total {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

@media (max-width: 1220px) {
  .unified-purchase-workspace .np-common-grid.up-common-one-row-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .unified-purchase-workspace .up-is-combined .up-payment-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .unified-purchase-workspace .up-is-combined .up-payment-actions-right {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .unified-purchase-workspace .np-common-grid.up-common-one-row-grid,
  .unified-purchase-workspace .up-is-combined .up-payment-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .unified-purchase-workspace .up-payment-actions-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* --------------------------------------------------------------------------
   15. 全站「单位」列上线后 1440 / 1024 / 390 均衡留白与零裁切优化
   -------------------------------------------------------------------------- */
/* Prevent grid/flex children from expanding page width beyond mobile/tablet viewport */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

.v2-workspace-frame,
.page-shell,
.page-shell > *,
body.ui-supply .page-shell > form,
body.ui-supply .ui-card,
.packing-panel {
  min-width: 0;
  max-width: 100%;
}

.v2-queue-toolbar .warehouse-queue-categories {
  order: -1;
}

/* Center short unit columns consistently with their headers */
.packing-table th:nth-child(10),
.packing-table td:nth-child(10),
.packing-arrival-table th:nth-child(11),
.packing-arrival-table td:nth-child(11),
.packing-ready-table th:nth-child(11),
.packing-ready-table td:nth-child(11),
.packing-batches-table th:nth-child(5),
.packing-batches-table td:nth-child(5),
.packing-batch-products th:nth-child(11),
.packing-batch-products td:nth-child(11),
.packing-differences-table th:nth-child(9),
.packing-differences-table td:nth-child(9),
.difference-jd-table th:nth-child(9),
.difference-jd-table td:nth-child(9) {
  text-align: center;
}

/* Restore left alignment on non-unit columns overridden by base .packing-table nth-child(10) */
.packing-arrival-table th:nth-child(10),
.packing-arrival-table td:nth-child(10),
.packing-ready-table th:nth-child(10),
.packing-ready-table td:nth-child(10) {
  text-align: left;
}

/* Standard 1440px desktop (with 216px left sidebar -> ~1140px card width): fit all columns cleanly */
@media (min-width: 1101px) and (max-width: 1720px) {
  /* 待打包 (14 columns) */
  .packing-arrival-table {
    min-width: 1060px;
    font-size: 12.5px;
  }
  .packing-arrival-table th,
  .packing-arrival-table td {
    padding: 12px 6px;
  }
  .packing-arrival-table th:first-child,
  .packing-arrival-table td:first-child {
    padding-left: 20px;
  }
  .packing-arrival-table th:last-child,
  .packing-arrival-table td:last-child {
    padding-right: 20px;
  }
  .packing-arrival-table th:nth-child(1) { width: 44px; }
  .packing-arrival-table th:nth-child(2) { width: 88px; }
  .packing-arrival-table th:nth-child(3) { width: 146px; }
  .packing-arrival-table th:nth-child(4) { width: 56px; }
  .packing-arrival-table th:nth-child(5) { width: 122px; }
  .packing-arrival-table th:nth-child(6) { width: 102px; }
  .packing-arrival-table .packing-code,
  .packing-ready-table .packing-code,
  .packing-batch-products .packing-code {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  .packing-arrival-table th:nth-child(7) { width: 64px; }
  .packing-arrival-table th:nth-child(8) { width: 60px; }
  .packing-arrival-table th:nth-child(9) { width: 62px; }
  .packing-arrival-table th:nth-child(10) { width: 46px; }
  .packing-arrival-table th:nth-child(11) { width: 44px; }
  .packing-arrival-table th:nth-child(12) { width: 52px; }
  .packing-arrival-table th:nth-child(13) { width: 122px; }
  .packing-arrival-table th:nth-child(14) { width: 64px; }
  .packing-arrival-table .packing-actions button,
  .packing-arrival-table .packing-partial-action .button {
    padding: 5px 8px;
    min-height: 30px;
    height: 30px;
    font-size: 12px;
  }
  .packing-arrival-table .packing-actions form > button + button {
    margin-left: 4px;
  }

  /* 待发货 (12 columns) & 个人工作台 (12 columns) */
  .packing-table:not(.packing-arrival-table):not(.packing-ready-table) {
    min-width: 1040px;
    font-size: 12.5px;
  }
  .packing-ready-table {
    min-width: 1040px;
    font-size: 12.5px;
  }
  .packing-ready-table th,
  .packing-ready-table td {
    padding: 12px 6px;
  }
  .packing-ready-table th:first-child,
  .packing-ready-table td:first-child { padding-left: 20px; width: 72px; }
  .packing-ready-table th:last-child,
  .packing-ready-table td:last-child { padding-right: 20px; }
  .packing-ready-table th:nth-child(2) { width: 44px; }
  .packing-ready-table th:nth-child(3) { width: 170px; }
  .packing-ready-table th:nth-child(4) { width: 62px; }
  .packing-ready-table th:nth-child(5) { width: 112px; }
  .packing-ready-table th:nth-child(6) { width: 98px; }
  .packing-ready-table th:nth-child(7) { width: 88px; }
  .packing-ready-table th:nth-child(8) { width: 62px; }
  .packing-ready-table th:nth-child(9) { width: 66px; }
  .packing-ready-table th:nth-child(10) { width: 48px; }
  .packing-ready-table th:nth-child(11) { width: 46px; }
  .packing-ready-table th:nth-child(12) { width: 76px; }

  /* 发京仓批次商品明细 (12/13 columns) */
  .packing-batch-products,
  .packing-batch-products.has-row-actions {
    min-width: 900px;
    font-size: 12.5px;
  }
  .packing-batch-products th,
  .packing-batch-products td {
    padding: 12px 5px;
  }
  .packing-batch-products th:first-child,
  .packing-batch-products td:first-child { padding-left: 16px; }
  .packing-batch-products th:last-child,
  .packing-batch-products td:last-child { padding-right: 16px; }

  /* 京仓收货差异列表 (13 columns) */
  .packing-differences-table {
    min-width: 1050px;
    font-size: 12.5px;
  }
  .packing-differences-table th,
  .packing-differences-table td {
    padding: 12px 6px;
  }
  .packing-differences-table th:first-child,
  .packing-differences-table td:first-child { padding-left: 20px; }
  .packing-differences-table th:last-child,
  .packing-differences-table td:last-child { padding-right: 20px; }
  .packing-differences-table th:nth-child(1) { width: 84px; }
  .packing-differences-table th:nth-child(2) { width: 76px; }
  .packing-differences-table th:nth-child(3) { width: 168px; }
  .packing-differences-table th:nth-child(4) { width: 94px; }
  .packing-differences-table th:nth-child(5) { width: 102px; }
  .packing-differences-table th:nth-child(6),
  .packing-differences-table th:nth-child(7),
  .packing-differences-table th:nth-child(8) { width: 60px; }
  .packing-differences-table th:nth-child(9) { width: 46px; }
  .packing-differences-table th:nth-child(10) { width: 64px; }
  .packing-differences-table th:nth-child(11) { width: 140px; }
  .packing-differences-table th:nth-child(12) { width: 56px; }
  .packing-differences-table th:nth-child(13) { width: 68px; }

  .difference-jd-table {
    min-width: 1020px;
    font-size: 12.5px;
  }
  .difference-jd-table th,
  .difference-jd-table td {
    padding: 12px 7px;
  }
  .difference-jd-table th:first-child,
  .difference-jd-table td:first-child { padding-left: 16px; }
  .difference-jd-table th:last-child,
  .difference-jd-table td:last-child { padding-right: 16px; }
  .difference-purchase-table {
    min-width: 1020px;
  }

  /* 新增耗材采购 & 修改耗材采购 (单行 6 项公共信息 + 11 列规格表) */
  body.ui-supply .ui-purchase-entry-row {
    min-width: 0;
    gap: 12px;
    padding: 18px 20px;
    grid-template-columns: 132px 98px minmax(124px, 1fr) 98px minmax(168px, 1.25fr) minmax(176px, 1.35fr);
  }
  body.ui-supply .ui-purchase-table {
    min-width: 1020px;
    font-size: 12.5px;
  }
  body.ui-supply .ui-purchase-table th,
  body.ui-supply .ui-purchase-table td {
    padding-inline: 6px;
  }
  body.ui-supply table.ui-card-width-table :is(th, td):first-child {
    padding-left: 20px;
  }
  body.ui-supply table.ui-card-width-table :is(th, td):last-child {
    padding-right: 20px;
  }
}

@media (max-width: 720px) {
  body.ui-supply .ui-savebar {
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 12px;
  }
  body.ui-supply .ui-savebar .ui-totals {
    flex-wrap: wrap;
    gap: 8px 16px;
  }
  body.ui-supply .ui-savebar .ui-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }
}

@media (max-width: 1280px) {
  .packing-batch-products,
  .packing-batch-products.has-row-actions {
    font-size: 12px;
  }
  .packing-batch-products th,
  .packing-batch-products td {
    padding: 10px 4px;
  }
  .packing-batch-products th:first-child,
  .packing-batch-products td:first-child { padding-left: 14px; }
  .packing-batch-products th:last-child,
  .packing-batch-products td:last-child { padding-right: 14px; }
}
