/* 样式分两层：@layer legacy 为原有页面布局规则（颜色、字重已统一到设计变量）；文件末尾的设计层不分 layer，始终优先，负责全站统一外观。新增或调整外观请改末尾设计层。 */
@layer legacy {
:root {
  --ink: #182026;
  --muted: #66717b;
  --line: #d9dee5;
  --panel: #ffffff;
  --page: #f2f2f2;
  --nav: #1e9fff;
  --nav-2: #24b8e8;
  --teal: #1e9fff;
  --teal-dark: #147ce5;
  --theme-soft: #eaf5ff;
  --sidebar-width: 90px;
  --green: #34815e;
  --amber: #bf7d16;
  --red: #b84a48;
  --blue: #3b6e91;
  --violet: #67588a;
  --shadow: 0 18px 45px rgba(17, 32, 38, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-muted);
  color: var(--ink);
  font-family:var(--font);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 13px;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 20;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--nav) 0%, var(--nav-2) 100%);
  color: #fff;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand {
  height: 79px;
  display: grid;
  place-items: center;
  align-content: start;
  gap: 1px;
  padding: 7px 2px 4px;
}

.brand-logo {
  width: 84px;
  max-height: 44px;
  display: block;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.brand-erp-badge {
  min-width: 46px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--danger);
  border: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  font-family:var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  text-rendering: geometricprecision;
}

.sidebar .brand-mark {
  width: 54px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-weight: 600;
  border: 0;
  font-size: 43px;
  line-height: 1;
}

.sidebar .brand-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

.sidebar .brand-subtitle {
  min-height: 18px;
  padding: 1px 8px;
  border-radius: 99px;
  background: #fff;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

.main-nav {
  display: grid;
  gap: 0;
}

.nav-item {
  width: 100%;
  min-height: 59px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 17px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: transparent;
  text-align: left;
  flex-direction: row;
  position: relative;
  font-size: 16px;
  font-weight: 600;
  transition: background 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: 0;
}

.nav-item.active,
.nav-item.menu-open {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

.nav-item.active::after,
.nav-item.menu-open::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  margin-top: -8px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid #fff;
}

.nav-item.menu-open .nav-icon {
  transform: translateX(1px);
}

.nav-icon {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex: 0 0 auto;
  transition: transform 160ms ease;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.sidebar-card {
  margin-top: auto;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  text-align: center;
}

.sidebar-card-title {
  font-size: 12px;
  color: var(--text-3);
}

.deadline {
  margin: 6px 0;
  font-size: 32px;
  line-height: 1;
  font-weight: 600;
  color: #f3f7f6;
}

.workspace {
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 0;
  min-height: 100vh;
}

.topbar {
  height: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 0;
  padding: 0 12px 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--primary-soft);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 13px;
  height: 42px;
  min-width: 0;
}

.top-refresh,
.company-switch,
.top-link {
  border: 0;
  background: transparent;
  color: var(--text);
  min-height: 30px;
  padding: 0 6px;
}

.top-refresh {
  width: 32px;
  font-size: 20px;
  color: var(--primary-dark);
}

.company-switch {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.top-divider,
.expire-text {
  color: var(--text-2);
  font-size: 13px;
}

.global-search-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.work-tabs {
  height: 38px;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  background: #fff;
  border-bottom: 1px solid var(--primary-soft);
}

.work-tab-list {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.work-tab {
  min-width: 138px;
  max-width: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-top: 2px solid transparent;
  border-right: 1px solid var(--primary-soft);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.work-tab.active {
  border-top-color: var(--text);
  background: #fff;
}

.work-tab span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-tab button {
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  color: var(--text-3);
}

.work-tab-tools {
  width: 58px;
  border: 0;
  border-left: 1px solid var(--primary-soft);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--text-2);
}

.work-tab-nav,
.work-tab-home {
  width: 42px;
  border: 0;
  border-right: 1px solid var(--primary-soft);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-size: 16px;
  font-weight: 600;
}

.work-tab-nav:hover,
.work-tab-home:hover,
.work-tab-tools:hover {
  background: var(--bg-subtle);
  color: var(--teal);
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  min-width: 0;
  height: 42px;
}

.top-link {
  font-size: 13px;
  white-space: nowrap;
}

.search-box {
  width: min(360px, 32vw);
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
}

.search-box span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--teal-dark);
  border: 1px solid var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.operator {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.operator span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-dark);
  color: #fff;
  font-weight: 600;
}

.view {
  display: grid;
  gap: 12px;
  padding: 12px;
  overflow-x: hidden;
}

.view > *,
.sales-layout,
.sales-stage,
.sales-form-shell,
.sales-report-shell {
  min-width: 0;
}

.home-page {
  display: grid;
  grid-template-columns: minmax(0, 5fr) 210px;
  gap: 0;
  align-items: start;
  color: var(--text);
}

.home-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.home-card {
  background: #fff;
  border: 1px solid var(--primary-soft);
  border-radius: 4px;
}

.home-card-title {
  height: 43px;
  display: flex;
  align-items: center;
  padding: 0 15px;
  border-bottom: 1px solid var(--primary-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.home-sales-cards {
  height: 92px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #fff;
  border: 1px solid var(--primary-soft);
}

.home-sales-card {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 0 20px;
  border-right: 1px solid var(--primary-soft);
  color: inherit;
  text-decoration: none;
}

.home-sales-card:last-child {
  border-right: 0;
}

.home-sales-card p {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.home-sales-card strong {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
}

.home-sales-card span {
  font-size: 12px;
  color: var(--text-3);
}

.home-sales-card em {
  color: var(--text-3);
  font-style: normal;
}

.quick-operation {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 266px;
  overflow: hidden;
}

.home-quick {
  min-height: 133px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 0;
  border-right: 1px solid var(--primary-soft);
  border-bottom: 1px solid var(--primary-soft);
  background: #fff;
  color: var(--text);
}

.home-quick:hover {
  background: var(--primary-soft);
}

.home-quick i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-style: normal;
  font-weight: 600;
}

.home-quick.sale i,
.home-quick.receivable i {
  background: var(--teal);
}

.home-quick.purchase i,
.home-quick.payable i {
  background: var(--success);
}

.home-quick.stock i,
.home-quick.supplier i {
  background: var(--warning);
}

.home-quick.product i,
.home-quick.customer i {
  background: var(--primary);
}

.home-quick span {
  font-size: 16px;
}

.nums-overview {
  min-height: 110px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  padding: 10px 15px;
}

.home-num {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 0 10px;
  border-right: 1px solid var(--primary-soft);
  color: inherit;
  text-align: center;
  text-decoration: none;
}

.home-num:last-child {
  border-right: 0;
}

.home-num strong {
  min-height: 24px;
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  word-break: break-word;
}

.home-num span {
  color: var(--text-2);
}

.data-overview {
  min-height: 293px;
}

.overview-chart {
  display: grid;
  gap: 18px;
  padding: 24px 30px;
}

.overview-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 120px;
  gap: 14px;
  align-items: center;
  font-size: 13px;
}

.overview-row div {
  height: 12px;
  border-radius: 99px;
  background: var(--primary-soft);
  overflow: hidden;
}

.overview-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.overview-row strong {
  text-align: right;
  font-weight: 500;
}

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

.asset-card,
.cashflow-card {
  min-height: 283px;
}

.asset-total {
  display: grid;
  gap: 8px;
  padding: 18px 35px 8px;
}

.asset-total span {
  color: var(--text-3);
}

.asset-total em {
  margin-left: 2px;
  color: var(--text-3);
  font-size: 12px;
  font-style: normal;
}

.asset-total strong {
  font-size: 22px;
  font-weight: 500;
}

.asset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 6px 35px 20px;
}

.asset-line {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--primary-soft);
}

.asset-line span {
  color: var(--text-3);
}

.asset-line strong {
  font-weight: 500;
}

.cashflow-lines {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 18px;
  padding: 28px 34px 36px;
}

.cashflow-lines span {
  position: relative;
  display: block;
  min-height: 22px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--teal), var(--primary));
}

.cashflow-lines b {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -25px;
  color: var(--text-3);
  text-align: center;
  font-size: 12px;
  font-weight: 400;
}

.home-side {
  display: grid;
  gap: 15px;
  padding-left: 7px;
}

.side-card {
  min-height: 107px;
}

.side-card p {
  padding: 10px 15px 0;
  color: var(--text-2);
  line-height: 1.65;
}

.side-card .button,
.side-card .ghost-button {
  margin: 10px 15px 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

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

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  color: var(--ink);
  font-size: 13px;
}

.reference-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.reference-filter-row.compact {
  max-width: 420px;
}

.reference-filter-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.reference-filter-row input {
  min-width: 190px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 8px;
  color: var(--ink);
}

.master-thumb,
.master-thumb-placeholder {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--teal);
  font-weight: 600;
  object-fit: cover;
}

.reference-master-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
}

.reference-category-tree {
  border: 1px solid var(--line);
  background: #fff;
  min-height: 260px;
  padding: 10px;
}

.category-tree-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.category-node {
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  font-weight: 600;
}

.category-node.active,
.category-node:hover {
  background: var(--theme-soft);
  color: var(--teal);
}

.account-summary-band {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--warning-line);
  background: var(--warning-soft);
  color: var(--warning);
}

.arrears-page {
  display: grid;
  gap: 10px;
}

.arrears-summary-band {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.arrears-summary-band div {
  min-width: 138px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.arrears-summary-band .arrears-total {
  border-color: rgba(30, 159, 255, 0.28);
  background: var(--theme-soft);
}

.arrears-summary-band span {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.arrears-summary-band strong {
  color: var(--ink);
  font-size: 19px;
}

.arrears-summary-band b {
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 18px;
}

.arrears-toolbar {
  padding: 8px 0;
}

.mini-select-label {
  display: inline-grid;
  grid-template-columns: 44px 108px;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  background: #fff;
}

.mini-select-label span {
  display: grid;
  min-height: 30px;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.mini-select-label select {
  min-height: 30px;
  border: 0;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
}

.goods-class-page {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 320px;
  gap: 12px;
}

.goods-class-tree,
.goods-class-form {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.goods-class-root {
  margin-bottom: 8px;
  font-weight: 600;
}

.goods-class-node {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 8px 6px 22px;
  border-bottom: 1px solid var(--line);
}

.goods-class-actions {
  display: inline-flex;
  gap: 6px;
}

.goods-class-form {
  display: grid;
  gap: 10px;
  align-content: start;
}

.goods-class-form h3 {
  margin: 0;
}

.goods-class-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.goods-class-form input {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 8px;
}

.goods-class-maintenance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 10px;
  padding: 14px 12px;
  background: var(--bg-muted);
  min-height: calc(100vh - 170px);
}

.goods-class-panel,
.goods-class-tip {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.goods-class-title {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--primary-soft);
  font-size: 16px;
  font-weight: 600;
}

.goods-class-tools {
  height: 54px;
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
}

.goods-class-reference-tree {
  padding: 8px 24px 28px;
  font-size: 14px;
}

.goods-class-reference-root,
.goods-class-reference-node {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.goods-class-reference-node {
  padding-left: 34px;
}

.goods-class-reference-node:hover {
  background: var(--bg-muted);
}

.goods-class-reference-node label {
  min-width: 200px;
}

.goods-class-reference-node .goods-class-actions {
  display: none;
  gap: 6px;
}

.goods-class-reference-node:hover .goods-class-actions {
  display: inline-flex;
}

.goods-class-reference-node .goods-class-actions button {
  width: 18px;
  height: 18px;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 0;
  font-size: 12px;
  line-height: 1;
}

.goods-class-tip {
  align-self: start;
  min-height: 210px;
  padding-bottom: 16px;
}

.goods-class-tip h3 {
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--primary-soft);
  font-size: 16px;
}

.goods-class-tip p {
  margin: 14px 18px 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.8;
}

.compact-strip {
  align-items: stretch;
  max-width: none;
}

.compact-strip .category-node {
  width: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.active-soft {
  border-color: var(--teal);
  background: var(--theme-soft);
  color: var(--teal);
}

.report-filter-toolbar {
  justify-content: flex-end;
}

.report-chart-panel {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 130px;
  margin-top: 10px;
}

.mini-bars span {
  width: 28px;
  border-radius: 4px 4px 0 0;
  background: var(--teal);
}

@media (max-width: 980px) {
  .reference-master-layout,
  .goods-class-page {
    grid-template-columns: 1fr;
  }
}

.settings-tip {
  margin-bottom: 8px;
  color: var(--warning);
  font-size: 13px;
  line-height: 1.7;
}

.attribute-page,
.customer-grade-page {
  display: grid;
  gap: 12px;
}

.attribute-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.attribute-block {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  padding: 12px;
}

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

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

.attribute-values em {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  font-style: normal;
  background: var(--bg-subtle);
}

.link-button {
  border: 0;
  min-height: auto;
  padding: 0 4px;
  background: transparent;
  color: var(--teal);
}

.sales-document-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.danger-link {
  color: var(--danger);
}

.customer-grade-config,
.customer-grade-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.customer-grade-hint {
  color: var(--muted);
  margin: 0;
}

.inline-table-input {
  width: 100%;
  min-width: 90px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
}

.discount-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.discount-inline .inline-table-input {
  width: 80px;
}

.table-switch {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.customer-grade-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.button,
.icon-button,
.ghost-button,
.danger-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 30px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  line-height: 1;
}

.button {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.button:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--teal);
  background: var(--theme-soft);
  color: var(--teal);
}

.icon-button {
  min-width: 30px;
  padding: 0 8px;
}

.danger-button {
  color: var(--red);
}

.danger-button:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--line-strong);
  border-radius: 6px;
}

.feature-tabs {
  max-width: 100%;
  overflow-x: auto;
  justify-content: flex-start;
}

.feature-tabs .tab-button {
  white-space: nowrap;
}

.tab-button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  padding: 0 12px;
  font-weight: 600;
}

.tab-button.active {
  background: #fff;
  color: var(--teal);
  box-shadow: 0 1px 8px rgba(28, 43, 48, 0.08);
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.panel,
.metric,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(20, 31, 36, 0.03);
}

.panel {
  padding: 16px;
}

.metric {
  min-height: 112px;
  padding: 16px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1;
  font-weight: 600;
}

.metric-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

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

.muted {
  color: var(--muted);
  font-size: 13px;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.compact-table th,
.compact-table td {
  padding: 9px 10px;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 13px;
}

th {
  color: var(--text-2);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 600;
}

tbody tr:hover {
  background: var(--bg-subtle);
}

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
}

.sale-row-actions button[data-feature-print],
.sale-row-actions button[data-feature-pay] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.sale-row-actions button[data-feature-edit] {
  border-color: var(--warning);
  background: var(--warning);
  color: #fff;
}

.sale-row-actions button[data-feature-share] {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status.draft {
  background: var(--bg-muted);
  color: var(--text-2);
}

.status.pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status.approved,
.status.done,
.status.enabled {
  background: var(--bg-muted);
  color: var(--success);
}

.status.warning {
  background: var(--danger-soft);
  color: var(--danger);
}

.status.route {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  gap: 8px;
}

.flow-step {
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.flow-index {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.flow-step strong {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.flow-step span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 52px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border-radius: 99px;
  background: var(--bg-muted);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.bar-fill.amber {
  background: var(--amber);
}

.bar-fill.blue {
  background: var(--blue);
}

.bar-fill.red {
  background: var(--red);
}

.kpi-list {
  display: grid;
  gap: 8px;
}

.kpi-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.kpi-item:last-child {
  border-bottom: 0;
}

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

.field {
  display: grid;
  gap: 6px;
}

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

.field label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.filter-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  padding: 8px 10px;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.12);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17, 30, 35, 0.34);
}

.modal {
  width: min(760px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  background: #fff;
  border-radius: 6px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-form {
  padding: 18px;
}

.modal.product-master-modal {
  width: min(1120px, 96vw);
  max-height: 92vh;
}

.product-master-modal .modal-form {
  padding: 12px 16px 16px;
}

.modal.staff-editor-modal {
  width: min(650px, calc(100vw - 44px));
  max-height: 92vh;
  border-radius: 4px;
}

.modal.sales-settlement-modal {
  width: min(650px, calc(100vw - 32px));
}

.sales-settlement-modal .modal-header,
.sales-share-modal .modal-header {
  padding: 13px 18px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 100%);
  color: #fff;
}

.sales-settlement-modal .modal-header .muted,
.sales-share-modal .modal-header .muted {
  color: rgba(255, 255, 255, 0.82);
}

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

.sales-settlement-form label {
  min-width: 0;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  border: 1px solid var(--line-strong);
}

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

.sales-settlement-form label > span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-strong);
  background: var(--bg-subtle);
  color: var(--text);
}

.sales-settlement-form label > span b {
  color: var(--danger);
}

.sales-settlement-form input,
.sales-settlement-form select {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: #fff;
}

.sales-settlement-form input:disabled {
  background: var(--bg-muted);
}

.sales-settlement-form .modal-footer {
  grid-column: 1 / -1;
  justify-content: center;
  padding-top: 26px;
}

.modal.sales-share-modal {
  width: min(920px, calc(100vw - 32px));
}

.sales-share-sheet {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text);
}

.sales-share-sheet p {
  margin: 0;
}

.sales-share-sheet img {
  width: 260px;
  height: 260px;
  margin: 12px 0;
  object-fit: contain;
  image-rendering: pixelated;
}

.sales-share-sheet > strong {
  font-size: 17px;
}

.sales-share-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
}

.sales-share-actions a.button {
  text-decoration: none;
}

.modal.sales-print-modal {
  width: min(1040px, calc(100vw - 32px));
  max-height: 94vh;
}

.modal.sales-import-modal {
  width: min(870px, calc(100vw - 32px));
  max-height: 92vh;
  border-radius: 4px;
}

.sales-import-modal .modal-header,
.sales-template-modal .modal-header {
  align-items: center;
  min-height: 46px;
  padding: 9px 16px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 100%);
  color: #fff;
}

.sales-import-modal .modal-header .eyebrow,
.sales-template-modal .modal-header .eyebrow {
  display: none;
}

.sales-import-modal .modal-header h2,
.sales-template-modal .modal-header h2 {
  color: #fff;
  font-size: 14px;
}

.sales-import-modal .modal-header .icon-button,
.sales-template-modal .modal-header .icon-button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
}

.sales-import-sheet {
  display: grid;
  gap: 14px;
}

.sales-import-reminder {
  padding: 10px 12px;
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
}

.sales-import-step {
  min-height: 74px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line-strong);
}

.sales-import-step.upload-step {
  grid-template-columns: 38px minmax(0, 1fr);
}

.sales-import-step-no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sales-import-step p {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.sales-import-upload {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--primary);
  background: var(--primary-soft);
  cursor: pointer;
}

.sales-import-upload.dragging {
  border-color: var(--teal);
  background: var(--theme-soft);
}

.sales-import-upload span {
  color: var(--text-3);
  font-size: 12px;
}

.sales-import-guide {
  margin: 0;
  padding: 10px 10px 10px 32px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.8;
}

.sales-import-result {
  min-height: 0;
  max-height: 140px;
  overflow: auto;
  color: var(--success);
  font-size: 12px;
}

.sales-import-result.has-errors {
  padding: 9px 11px;
  border: 1px solid var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.sales-import-result p,
.sales-import-result ul {
  margin: 4px 0;
}

.modal.sales-template-modal {
  width: min(1080px, calc(100vw - 32px));
  max-height: 90vh;
  border-radius: 4px;
}

.sales-template-modal .modal-form {
  padding: 12px;
}

.sales-template-sheet {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto auto;
  min-height: 480px;
}

.sales-template-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
}

.sales-template-toolbar > span {
  color: var(--text-3);
  font-size: 12px;
}

.sales-template-toolbar > input {
  width: 250px;
  min-height: 34px;
  margin-left: auto;
  border: 1px solid var(--line-strong);
  padding: 0 10px;
}

.sales-template-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
}

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

.sales-template-table th,
.sales-template-table td {
  height: 38px;
  padding: 7px 10px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  text-align: center;
  font-size: 12px;
}

.sales-template-table th {
  background: var(--bg-subtle);
  color: var(--text-2);
}

.sales-template-table tbody tr:not(.empty) {
  cursor: pointer;
}

.sales-template-table tbody tr.selected,
.sales-template-table tbody tr:not(.empty):hover {
  background: var(--primary-soft);
}

.sales-template-pagination {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: var(--text-2);
  font-size: 12px;
}

.sales-template-pagination button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
}

.sales-template-pagination select {
  height: 30px;
  margin-left: auto;
  border: 1px solid var(--line-strong);
}

.sales-template-add-layer {
  position: absolute;
  inset: -12px;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.32);
}

.sales-template-add-layer.hidden {
  display: none;
}

.sales-template-add-layer > section {
  width: min(620px, calc(100% - 28px));
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.sales-template-add-layer header {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 -16px;
  padding: 0 14px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 100%);
  color: #fff;
}

.sales-template-add-layer header button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
}

.sales-template-add-layer label {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  border: 1px solid var(--line-strong);
}

.sales-template-add-layer label > span {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-strong);
  background: var(--bg-subtle);
  color: var(--text-2);
}

.sales-template-add-layer label b {
  color: var(--danger);
}

.sales-template-add-layer input,
.sales-template-add-layer textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  resize: vertical;
}

.sales-template-add-layer footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 10px;
}

.sales-print-preview {
  display: grid;
  gap: 14px;
}

.sales-print-paper {
  width: min(860px, 100%);
  min-height: 520px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
}

.sales-print-paper header {
  margin-bottom: 18px;
  text-align: center;
}

.sales-print-paper header h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.sales-print-paper header strong {
  font-size: 18px;
}

.sales-print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 20px;
  margin-bottom: 12px;
}

.sales-print-paper table {
  width: 100%;
  border-collapse: collapse;
}

.sales-print-paper th,
.sales-print-paper td {
  padding: 8px;
  border: 1px solid var(--text-2);
  text-align: center;
}

.sales-print-total {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  margin-top: 14px;
  font-size: 16px;
}

.staff-editor-modal .modal-header {
  align-items: center;
  min-height: 44px;
  padding: 9px 14px;
  border-bottom: 0;
  background: var(--teal);
  color: #fff;
}

.staff-editor-modal .modal-header .eyebrow {
  display: none;
}

.staff-editor-modal .modal-header h2 {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.staff-editor-modal .modal-header .icon-button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
}

.staff-editor-modal .modal-form {
  padding: 14px;
}

.staff-editor-form {
  position: relative;
}

.staff-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.staff-editor-field {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: stretch;
  min-height: 44px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.staff-editor-field > span:first-child {
  display: grid;
  place-items: center;
  padding: 8px;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 13px;
}

.staff-editor-field > input,
.staff-editor-field > select {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}

.staff-editor-field > input:focus,
.staff-editor-field > select:focus {
  box-shadow: inset 0 0 0 1px var(--teal);
}

.staff-avatar-upload {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  color: var(--text-3);
  cursor: pointer;
}

.staff-avatar-preview {
  display: grid;
  place-items: center;
  width: 42px;
  height: 32px;
  overflow: hidden;
  border: 1px dashed var(--text-3);
  color: var(--teal);
  font-size: 18px;
}

.staff-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-permission-section {
  padding-top: 14px;
}

.staff-permission-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

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

.staff-role-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 112px;
  padding: 13px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.staff-role-card strong {
  font-size: 14px;
}

.staff-role-card span {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
}

.staff-role-card:hover,
.staff-role-card.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.staff-role-card.active {
  background: var(--theme-soft);
}

.staff-role-or {
  margin: 18px 0 8px;
  color: var(--text);
  text-align: center;
}

.staff-custom-permission {
  display: block;
  margin: 0 auto;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: underline;
}

.staff-editor-footer {
  padding-top: 22px;
}

.staff-editor-footer .button,
.staff-editor-footer .ghost-button {
  border-radius: 4px;
}

.staff-list-toolbar {
  align-items: center;
}

.staff-list-toolbar .toolbar-right {
  display: flex;
  flex: 1;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.staff-list-toolbar .filter-input {
  width: min(200px, 22vw);
}

.staff-permission-help {
  position: absolute;
  inset: -14px;
  z-index: 2;
  min-height: calc(100% + 28px);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 12px 30px rgba(22, 39, 48, 0.16);
}

.staff-help-head,
.staff-help-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 12px;
}

.staff-help-head {
  background: var(--teal);
  color: #fff;
}

.staff-help-head .icon-button {
  border: 0;
  background: transparent;
  color: #fff;
}

.staff-help-body {
  display: grid;
  gap: 22px;
  min-height: 300px;
  padding: 18px;
}

.staff-help-body h3 {
  margin: 0;
  font-size: 14px;
}

.staff-help-steps {
  display: grid;
  grid-template-columns: 40px minmax(80px, 1fr) 26px 40px minmax(80px, 1fr) 26px 40px minmax(80px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.staff-help-steps span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 600;
}

.staff-help-steps p,
.staff-help-steps i {
  margin: 0;
  color: var(--text-2);
  font-style: normal;
  text-align: center;
}

.staff-help-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.product-master-editor {
  display: grid;
  gap: 10px;
}

.product-editor-toolbar,
.product-cloud-panel,
.product-inline-create {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-editor-toolbar {
  justify-content: space-between;
  min-height: 34px;
  color: var(--text-2);
  font-size: 12px;
}

.product-cloud-panel,
.product-inline-create {
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.product-cloud-panel select,
.product-inline-create input {
  flex: 1;
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 6px 9px;
}

.product-editor-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.product-editor-section h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

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

.product-editor-grid.compact {
  margin-top: 9px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-editor-grid > label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.product-editor-grid > label.full {
  grid-column: 1 / -1;
}

.product-editor-grid input,
.product-editor-grid select,
.product-editor-grid textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 9px;
  background: #fff;
}

.product-editor-grid textarea {
  min-height: 56px;
  resize: vertical;
}

.product-editor-grid .with-action {
  grid-template-columns: 1fr 32px;
}

.product-editor-grid .with-action > span {
  grid-column: 1 / -1;
}

.product-editor-grid .with-action > button {
  width: 32px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--teal);
  font-weight: 600;
}

.product-attribute-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.product-attribute-list label {
  display: grid;
  grid-template-columns: 18px auto 1fr;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  font-size: 12px;
}

.product-attribute-list span {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-attribute-list select {
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.product-grade-prices {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.product-grade-prices summary {
  padding: 9px 10px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.product-grade-price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.product-grade-price-grid label,
.product-safe-stock {
  display: grid;
  gap: 4px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.product-grade-price-grid input,
.product-safe-stock input {
  min-height: 30px;
  border: 1px solid var(--line);
  padding: 5px 7px;
}

.product-safe-stock {
  width: min(240px, 100%);
  margin-bottom: 8px;
}

.product-multi-unit {
  display: flex !important;
  align-items: center;
  gap: 7px !important;
  align-self: end;
  min-height: 34px;
}

.product-editor-grid .product-multi-unit input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.product-stock-table {
  max-height: 190px;
}

.product-stock-table input[type="number"] {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  padding: 4px 7px;
}

.product-image-upload {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  font-size: 12px;
  font-weight: 600;
}

.product-image-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.product-image-upload em {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--teal);
  background: #fff;
  font-style: normal;
  cursor: pointer;
}

.product-image-preview {
  display: flex;
  gap: 8px;
  min-height: 48px;
  margin-top: 8px;
}

.product-image-preview figure {
  position: relative;
  width: 58px;
  height: 58px;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.product-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-image-preview button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
}

.product-editor-footer {
  position: sticky;
  bottom: -16px;
  margin: 0 -16px -16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.sortable-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: nowrap;
}

.sortable-header span {
  color: var(--text-3);
  font-size: 12px;
}

.master-pager {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.master-pager button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.finance-form-shell {
  min-height: calc(100vh - 118px);
}

.finance-form-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

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

.finance-form-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

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

.finance-form-grid input,
.finance-form-grid select,
.finance-form-grid textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 9px;
  background: #fff;
}

.finance-form-grid textarea {
  min-height: 76px;
  resize: vertical;
}

.finance-form-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.finance-form-summary div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.finance-form-summary span {
  color: var(--text-2);
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  grid-column: 1 / -1;
  padding-top: 6px;
}

.confirm-box {
  display: grid;
  gap: 16px;
}

.confirm-box p {
  padding: 12px;
  border: 1px solid var(--danger-line);
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 22px;
  top: 76px;
  bottom: auto;
  z-index: 40;
  pointer-events: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 6px;
  color: #fff;
  background: var(--primary-dark);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(23, 32, 37, 0.92), rgba(15, 48, 47, 0.9)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 16px);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

.login-card .brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
}

.login-card .button {
  min-height: 42px;
}

.login-hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
}

.inventory-card {
  display: grid;
  gap: 10px;
}

.sales-layout {
  position: relative;
  display: block;
}

#module-menu-root {
  position: relative;
  z-index: 45;
}

.sales-menu-popover {
  position: fixed;
  left: var(--sidebar-width);
  top: 104px;
  z-index: 45;
  width: 174px;
  animation: menu-pop 140ms ease-out;
}

.module-menu-shield {
  position: fixed;
  inset: 0 0 0 var(--sidebar-width);
  z-index: 24;
  border: 0;
  background: rgba(12, 22, 30, 0.03);
  cursor: default;
}

.module-menu-popover.wide {
  width: 360px;
}

.sales-menu-panel {
  position: relative;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 30px rgba(18, 31, 38, 0.16);
  border-radius: 4px;
  overflow: hidden;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
}

.module-menu-panel.wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  align-items: start;
}

.module-menu-group {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.module-menu-group:last-child {
  border-right: 0;
}

.sales-menu-title {
  height: 42px;
  display: grid;
  place-items: center;
  border-top: 3px solid var(--teal);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.sales-menu-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: center;
  min-height: 34px;
  padding: 3px 9px;
}

.sales-menu-row:hover {
  background: var(--theme-soft);
}

.sales-menu-row.active .sales-menu-link {
  color: var(--danger);
  font-weight: 600;
}

.sales-menu-link,
.sales-menu-more {
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  font-weight: 600;
  min-height: 28px;
}

.sales-menu-report {
  min-height: 24px;
  border: 0;
  border-radius: 4px;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.sales-menu-group {
  padding: 8px 12px 4px;
  text-align: center;
  font-weight: 600;
}

.sales-menu-more {
  width: 100%;
  padding: 12px;
  text-align: center;
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sales-stage {
  min-width: 0;
}

.sales-detail-layer {
  position: fixed;
  left: var(--sidebar-width);
  right: 0;
  top: 80px;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr);
  background: var(--bg-muted);
  box-shadow: 0 -1px 0 #d9dee5, 0 18px 45px rgba(17, 32, 38, 0.2);
}

.sales-detail-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 13px 0 16px;
  color: #fff;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary) 100%);
  border-bottom: 1px solid var(--primary-dark);
  font-size: 14px;
  font-weight: 600;
}

.sales-detail-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.sales-detail-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.sales-detail-scroll {
  min-width: 0;
  overflow: auto;
  padding: 12px 18px 28px;
}

.sales-detail-form {
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: none;
}

.sales-detail-form .sales-form-topbar {
  align-items: flex-start;
  padding: 8px 0 12px;
}

.icon-text-button {
  min-width: 58px;
  line-height: 1.15;
  text-align: center;
}

.status-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--success);
  border-radius: 4px;
  background: var(--success);
  color: #fff;
  font-weight: 600;
}

.status-action.draft {
  border-color: var(--warning);
  background: var(--warning);
}

.purchase-detail-layer {
  top: 80px;
  background: var(--bg-muted);
}

.purchase-detail-titlebar {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 100%);
  border-bottom: 0;
}

.purchase-detail-scroll {
  padding: 8px 10px 18px;
}

.purchase-detail-sheet {
  position: relative;
  min-width: 1180px;
  min-height: calc(100vh - 110px);
  background: #fff;
  border: 1px solid var(--primary-line);
  box-shadow: 0 1px 4px rgba(25, 39, 52, 0.08);
  padding: 58px 14px 18px;
}

.purchase-detail-top-actions {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 8px 16px;
  background: var(--text-3);
}

.purchase-detail-status {
  min-width: 48px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
}

.purchase-detail-status.approved {
  border-color: var(--success);
  color: var(--success);
}

.purchase-detail-action {
  min-width: 66px;
  height: 38px;
  border-radius: 0;
}

.purchase-detail-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--primary-soft);
}

.purchase-detail-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  font-size: 18px;
  color: var(--primary-dark);
}

.mini-color-block {
  width: 12px;
  height: 14px;
  display: inline-block;
  background: linear-gradient(90deg, var(--primary) 0 38%, #fff 38% 54%, var(--primary) 54% 100%);
}

.purchase-detail-basic {
  display: grid;
  grid-template-columns: 290px 290px 290px 130px 120px;
  gap: 6px;
  align-items: center;
  padding: 16px 0 18px;
}

.purchase-detail-basic label,
.purchase-detail-footer label {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.purchase-detail-basic label span,
.purchase-detail-footer label span {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 0 10px;
  color: var(--text-2);
  border-right: 1px solid var(--primary-soft);
  text-align: center;
}

.purchase-detail-basic input,
.purchase-detail-basic select,
.purchase-detail-footer input,
.purchase-detail-footer select,
.purchase-detail-grid input,
.purchase-detail-settlement input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0 10px;
  color: var(--primary-dark);
  font-size: 13px;
}

.purchase-detail-check {
  gap: 7px;
  justify-content: center;
  border: 0 !important;
}

.purchase-detail-check input {
  width: 16px;
  height: 16px;
}

.purchase-detail-grid-wrap {
  overflow: auto;
  min-height: 330px;
  border: 1px solid var(--line-strong);
}

.purchase-detail-grid {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.purchase-detail-grid th,
.purchase-detail-grid td {
  height: 40px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  text-align: center;
  background: #fff;
}

.purchase-detail-grid th {
  height: 42px;
  background: var(--bg-muted);
  font-weight: 600;
  color: var(--text);
}

.purchase-detail-grid .settings-col {
  width: 40px;
}

.purchase-detail-grid th:nth-child(2) { width: 64px; }
.purchase-detail-grid th:nth-child(3) { width: 56px; }
.purchase-detail-grid th:nth-child(4) { width: 200px; }
.purchase-detail-grid th:nth-child(5) { width: 112px; }
.purchase-detail-grid th:nth-child(6) { width: 108px; }
.purchase-detail-grid th:nth-child(7) { width: 86px; }
.purchase-detail-grid th:nth-child(8) { width: 108px; }
.purchase-detail-grid th:nth-child(9) { width: 108px; }
.purchase-detail-grid th:nth-child(10) { width: 150px; }
.purchase-detail-grid th:nth-child(11) { width: 150px; }

.purchase-detail-grid .wide-blank {
  width: auto;
}

.purchase-detail-grid input {
  text-align: center;
  color: var(--primary);
}

.purchase-detail-name {
  text-align: left !important;
  color: var(--primary) !important;
  font-weight: 600;
  cursor: pointer;
}

.purchase-detail-name[readonly] {
  background: #fff;
}

.purchase-detail-thumb,
.purchase-detail-thumb-placeholder {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  object-fit: cover;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}

.required-star,
.orange-total {
  color: var(--danger);
}

.blue-total {
  color: var(--primary);
  font-weight: 600;
}

.purchase-detail-footer {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) 735px;
  gap: 14px;
  padding-top: 12px;
}

.purchase-detail-meta {
  display: grid;
  grid-template-columns: 300px minmax(320px, 1fr);
  gap: 6px;
  align-content: start;
}

.purchase-detail-meta .wide {
  grid-column: 1 / -1;
}

.upload-tile {
  width: 82px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  background: #fff;
  color: var(--text-3);
  font-size: 32px;
}

.upload-tile span {
  font-size: 13px;
}

.purchase-detail-settlement {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-content: start;
}

.purchase-detail-settlement .settlement-line {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  height: 28px;
}

.purchase-detail-settlement .pay-now {
  grid-column: 1 / -1;
  justify-self: end;
  width: 370px;
  border-color: var(--danger-line);
}

.purchase-detail-settlement .pay-now em {
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--text-2);
  font-style: normal;
  font-size: 12px;
}

.purchase-detail-settlement .pay-now button {
  align-self: stretch;
  min-width: 48px;
  border: 0;
  border-left: 1px solid var(--line-strong);
  background: var(--bg-subtle);
  color: var(--text-2);
}

.purchase-product-picker-backdrop {
  position: fixed;
  left: calc(var(--sidebar-width) + 98px);
  right: 108px;
  top: clamp(118px, 26vh, 280px);
  bottom: 36px;
  z-index: 82;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: stretch;
}

.purchase-product-picker {
  min-width: min(1060px, 100%);
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr) 58px;
  background: #fff;
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line-strong);
}

.purchase-picker-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 18px;
  color: #fff;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 100%);
  font-size: 13px;
  font-weight: 600;
}

.purchase-picker-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 24px;
}

.purchase-picker-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
}

.purchase-picker-category {
  padding: 14px 12px;
  border-right: 1px solid var(--primary-soft);
  background: #fff;
  overflow: auto;
}

.purchase-picker-category strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.purchase-picker-category button {
  width: 100%;
  height: 32px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 400;
}

.purchase-picker-category button.active,
.purchase-picker-category button:hover {
  color: var(--primary);
  font-weight: 600;
}

.category-leaf {
  padding-left: 30px !important;
}

.purchase-picker-category-line {
  height: 4px;
  margin-top: 250px;
  background: var(--primary-line);
}

.purchase-picker-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 12px 12px 0;
  position: relative;
}

.purchase-picker-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  position: relative;
}

.purchase-picker-toolbar .button {
  height: 38px;
  border-radius: 4px;
}

.purchase-picker-toolbar .icon-button {
  width: 30px;
  height: 30px;
  border: 0;
  color: var(--text-2);
  background: transparent;
  font-size: 20px;
}

.purchase-picker-spacer {
  flex: 1;
}

.purchase-picker-toolbar input {
  width: 300px;
  height: 38px;
  border: 1px solid var(--primary-line);
  padding: 0 12px;
  font-size: 13px;
}

.purchase-picker-toolbar .teal {
  background: var(--primary-dark);
}

.purchase-picker-advanced {
  position: absolute;
  z-index: 3;
  right: 0;
  top: 48px;
  width: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
  padding: 24px 16px 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20, 33, 45, 0.16);
  border: 1px solid var(--primary-soft);
}

.purchase-picker-advanced label {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  height: 38px;
  border: 1px solid var(--primary-line);
}

.purchase-picker-advanced label span {
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  border-right: 1px solid var(--primary-line);
  font-size: 12px;
  color: var(--text-2);
}

.purchase-picker-advanced input,
.purchase-picker-advanced select {
  border: 0;
  padding: 0 8px;
  background: #fff;
  min-width: 0;
  font-size: 12px;
}

.purchase-picker-advanced-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.purchase-picker-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--primary-line);
}

.purchase-picker-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.purchase-picker-table th,
.purchase-picker-table td {
  height: 40px;
  border-right: 1px solid var(--primary-line);
  border-bottom: 1px solid var(--primary-line);
  text-align: center;
  background: #fff;
  color: var(--text);
}

.purchase-picker-table th {
  height: 40px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-weight: 600;
}

.purchase-picker-table th:first-child { width: 48px; }
.purchase-picker-col-qty { width: 82px; }
.purchase-picker-col-image { width: 70px; }
.purchase-picker-col-name { width: 200px; }
.purchase-picker-col-attr { width: 120px; }
.purchase-picker-col-number { width: 120px; }
.purchase-picker-col-spec { width: 120px; }
.purchase-picker-col-brand { width: 110px; }
.purchase-picker-col-unit { width: 82px; }
.purchase-picker-col-price,
.purchase-picker-col-wholesalePrice,
.purchase-picker-col-retailPrice { width: 110px; }
.purchase-picker-col-stock { width: 120px; }
.purchase-picker-col-category { width: 120px; }
.purchase-picker-col-barcode { width: 120px; }
.purchase-picker-col-warehouse,
.purchase-picker-col-location { width: 120px; }
.purchase-picker-col-remark { width: 150px; }

.purchase-picker-table tr.selected td {
  background: var(--primary-soft);
}

.purchase-picker-table .empty td {
  height: 170px;
  color: var(--text-3);
}

.purchase-picker-qty {
  width: 50px;
  height: 30px;
  border: 1px solid var(--primary-line);
  text-align: center;
}

.purchase-picker-name {
  color: var(--primary);
  font-weight: 500;
  cursor: default;
}

.blue-number {
  color: var(--primary) !important;
}

.purchase-picker-sort {
  display: inline-block;
  margin-left: 4px;
  color: var(--text-3);
  font-size: 9px;
  transform: rotate(45deg);
}

.purchase-picker-thumb {
  width: 34px;
  height: 28px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}

.empty-thumb {
  display: inline-block;
  background: var(--bg-subtle);
}

.purchase-picker-pagination {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 43px;
  padding: 0 0 0 4px;
  font-size: 12px;
}

.purchase-picker-pagination button,
.purchase-picker-pagination select,
.purchase-picker-pagination input {
  height: 30px;
  border: 1px solid var(--primary-line);
  background: #fff;
  padding: 0 9px;
  border-radius: 0;
}

.purchase-picker-pagination button.active {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: #fff;
}

.purchase-picker-pagination input {
  width: 48px;
  text-align: center;
}

.purchase-picker-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-top: 1px solid var(--primary-soft);
}

.purchase-picker-actions .button,
.purchase-picker-actions .ghost-button {
  min-width: 60px;
  height: 34px;
  border-radius: 0;
}

.purchase-picker-layer-mask {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 88px 110px 42px calc(var(--sidebar-width) + 110px);
  background: rgba(0, 0, 0, 0.42);
}

.purchase-picker-submodal {
  width: 660px;
  min-height: 420px;
  max-height: calc(100vh - 180px);
  display: grid;
  grid-template-rows: 44px auto minmax(0, 1fr) auto auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.purchase-picker-submodal.add-product {
  width: 800px;
  min-height: 470px;
}

.purchase-picker-submodal.field-settings {
  width: 760px;
  min-height: 0;
  height: min(620px, calc(100vh - 150px));
  grid-template-rows: 44px auto minmax(0, 1fr) auto;
}

.purchase-picker-subtabs {
  display: flex;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--primary-soft);
  background: #fff;
}

.purchase-picker-subtabs button {
  height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.purchase-picker-subtabs button.active {
  color: var(--primary-dark);
  border-bottom-color: var(--success);
}

.picker-add-base,
.picker-add-image {
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 0;
}

.picker-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 4px;
}

.picker-form-cell {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  min-height: 38px;
  border: 1px solid var(--primary-line);
}

.picker-form-cell.wide {
  grid-column: span 2;
}

.picker-form-cell span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--primary-line);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}

.picker-form-cell b,
.picker-form-tip b {
  color: var(--danger);
}

.picker-form-cell input,
.picker-form-cell select {
  min-width: 0;
  height: 36px;
  border: 0;
  padding: 0 10px;
  background: #fff;
  font-size: 12px;
}

.picker-form-cell .inline-link {
  margin-right: 6px;
  border: 0;
  background: transparent;
  color: var(--violet);
  white-space: nowrap;
}

.picker-form-tip {
  margin: 0;
  padding: 4px 0;
  color: var(--text);
  font-size: 12px;
}

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

.points-placeholder::placeholder {
  color: var(--danger);
  font-size: 18px;
}

.picker-status-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border: 1px solid var(--primary-line);
  font-size: 12px;
}

.picker-status-row.wide {
  grid-column: 1 / -1;
}

.picker-status-row button {
  border: 0;
  background: transparent;
  color: var(--text-2);
}

.picker-status-row button.active {
  color: var(--primary-dark);
}

.picker-add-warning {
  margin: 10px 16px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.8;
}

.picker-image-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  border: 1px solid var(--primary-line);
}

.picker-image-title {
  padding: 14px;
  border-right: 1px solid var(--primary-line);
  font-size: 12px;
}

.picker-image-tip {
  padding: 14px;
  text-align: right;
  color: var(--text-2);
  font-size: 12px;
}

.picker-upload-tile {
  grid-column: 1 / -1;
  width: 180px;
  height: 104px;
  margin: 0 0 8px 8px;
  border: 1px dashed var(--primary-line);
  background: #fff;
  color: var(--text-2);
}

.picker-upload-tile span {
  display: block;
  font-size: 34px;
}

.picker-upload-tile strong {
  display: block;
  font-size: 12px;
  font-weight: 400;
}

.purchase-picker-submodal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  background: #fff;
  border-top: 1px solid var(--primary-soft);
}

.purchase-picker-submodal-actions .button,
.purchase-picker-submodal-actions .ghost-button {
  min-width: 64px;
  height: 34px;
  border-radius: 0;
}

.picker-field-help {
  padding: 16px 18px 8px;
  color: var(--primary);
  font-size: 12px;
  line-height: 1.6;
}

.picker-field-help p {
  margin: 0 0 4px;
}

.picker-field-help p + p {
  color: var(--text);
}

.picker-field-help p + p::first-letter {
  color: var(--danger);
}

.picker-field-table-wrap {
  min-height: 0;
  overflow: auto;
  padding: 0 16px;
}

.picker-field-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.picker-field-table th,
.picker-field-table td {
  height: 42px;
  border: 1px solid var(--line-strong);
  text-align: center;
}

.picker-field-table th {
  background: var(--bg-muted);
  color: var(--danger);
  font-weight: 500;
}

.picker-field-table th:first-child,
.picker-field-table td:first-child {
  width: 70px;
}

.picker-field-table th:nth-child(2),
.picker-field-table td:nth-child(2) {
  width: 110px;
}

.picker-field-table th:last-child,
.picker-field-table td:last-child {
  width: 70px;
}

.picker-field-table input[type="text"],
.picker-field-table input:not([type]) {
  width: calc(100% - 16px);
  height: 30px;
  border: 1px solid var(--line-strong);
  padding: 0 8px;
}

.picker-field-table button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.sales-form-shell,
.sales-report-shell,
.document-form-shell {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.sales-form-shell,
.document-form-shell {
  padding: 12px;
  width: 100%;
}

.sales-page-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-subtle);
}

.sales-page-head h2 {
  font-size: 16px;
}

.sales-subtabs,
.sales-report-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--primary-soft);
  border-radius: 6px;
}

.sales-subtabs button,
.sales-report-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
}

.sales-subtabs button.active,
.sales-report-tabs button.active {
  background: #fff;
  color: var(--teal-dark);
  box-shadow: 0 1px 7px rgba(27, 39, 45, 0.09);
}

.sales-report-tabs {
  margin: 12px 14px 0;
}

.sales-form-topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 51px;
  padding: 10px 0;
  border-bottom: 0;
}

.sales-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sales-scan-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sales-scan-inline input {
  width: 190px;
  min-height: 32px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  padding: 0 13px;
  outline: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 12%, transparent);
}

.sales-bill-title {
  min-width: 78px;
  font-size: 14px;
}

.sales-price-mode,
.radio-pill {
  color: var(--text-2);
  font-size: 13px;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sales-basic-grid {
  display: grid;
  grid-template-columns: minmax(360px, 5fr) minmax(190px, 2fr) minmax(190px, 2fr) 300px;
  gap: 3px;
  padding: 5px 0 8px;
  border-bottom: 0;
}

.sales-basic-grid label,
.sales-left-form label,
.sales-settle-form label,
.sales-settle-row label,
.sales-remark-row label {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
}

.sales-basic-grid span,
.sales-left-form span,
.sales-settle-form span,
.sales-settle-row label > span,
.sales-remark-row label > span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.sales-basic-grid input,
.sales-basic-grid select,
.sales-left-form input,
.sales-left-form select,
.sales-settle-form input,
.sales-settle-form select,
.sales-settle-row input,
.sales-settle-row select,
.sales-remark-row input {
  min-width: 0;
  width: 100%;
  min-height: 36px;
  border: 0;
  outline: 0;
  padding: 0 10px;
  background: #fff;
}

.sales-mini-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 38px;
}

.sales-mini-actions .ghost-button {
  min-height: 34px;
  padding: 0 10px;
}

.sales-delivery {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 8px;
  align-items: center;
  border: 0 !important;
  justify-content: flex-end;
  min-height: 38px;
}

.invoice-check {
  min-height: auto !important;
  display: inline-flex !important;
  place-items: initial !important;
  align-items: center;
  gap: 5px;
  border: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  font-weight: 400 !important;
}

.mini-green {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: var(--success);
  color: #fff;
  padding: 0 14px;
  font-weight: 600;
}

.sales-expand-link {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-weight: 600;
}

.sales-delivery-panel {
  display: grid;
  grid-template-columns: 210px 220px 240px minmax(300px, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px 0 10px;
}

.sales-delivery-panel label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: #fff;
}

.sales-delivery-panel label.wide {
  grid-template-columns: 78px minmax(0, 1fr);
}

.sales-delivery-panel span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.sales-delivery-panel input,
.sales-delivery-panel select {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  border: 0;
  padding: 0 10px;
  outline: 0;
}

.sales-table-wrap {
  width: 100%;
  max-height: 371px;
  overflow: auto;
  border: 1px solid var(--line-strong);
}

.sales-entry-table {
  min-width: 1220px;
  border-collapse: collapse;
}

.sales-entry-table th,
.sales-entry-table td {
  border: 1px solid var(--line-strong);
  padding: 0;
  height: 39px;
}

.sales-entry-table th {
  text-align: center;
  background: var(--bg-muted);
  color: var(--text);
  font-size: 13px;
}

.sales-entry-table input {
  width: 100%;
  height: 39px;
  border: 0;
  outline: 0;
  padding: 0 8px;
  background: transparent;
}

.sales-product-cell {
  min-width: 250px;
}

.sales-product-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  align-items: center;
  width: 100%;
  height: 39px;
  background: #fff;
}

.sales-entry-table .sales-product-field input {
  height: 39px;
  padding: 0 8px;
}

.sales-product-field input.picker-open,
.sales-product-field:focus-within input {
  background: #fff;
}

.sales-product-trigger {
  height: 30px;
  min-height: 30px;
  margin-right: 5px;
  border: 0;
  border-radius: 4px;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.gear-cell,
.line-index {
  width: 40px;
  text-align: center;
}

.line-tools {
  width: 64px;
  text-align: center;
  white-space: nowrap;
}

.line-tools button {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-left: 4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  line-height: 18px;
}

.line-tools button:first-of-type {
  background: var(--success);
}

.line-tools button:last-of-type {
  background: var(--danger);
}

.sales-total-label {
  text-align: center;
  color: var(--teal-dark);
  font-weight: 600;
}

.sales-total-number {
  color: var(--danger);
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
}

#product-picker-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.product-picker-panel {
  --picker-max-height: 430px;
  position: fixed;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  max-height: var(--picker-max-height);
  overflow: hidden;
  pointer-events: auto;
  background: #fff;
  border: 1px solid var(--primary);
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(30, 47, 67, 0.2);
  color: var(--text);
  font-size: 13px;
}

.product-picker-table-wrap {
  min-height: 210px;
  overflow: auto;
}

.product-picker-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.product-picker-table th,
.product-picker-table td {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--primary-soft);
  text-align: left;
  white-space: nowrap;
}

.product-picker-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-subtle);
  color: var(--primary-dark);
  font-weight: 600;
  text-align: center;
}

.product-picker-table tbody tr {
  cursor: pointer;
}

.product-picker-table tbody tr:hover,
.product-picker-table tbody tr.selected {
  background: var(--primary-soft);
}

.product-picker-table .product-picker-name {
  color: var(--primary-dark);
  font-weight: 600;
}

.product-picker-table .empty td {
  height: 64px;
  color: var(--text-3);
  text-align: center;
}

.product-picker-more {
  height: 34px;
  border: 0;
  border-top: 1px solid var(--primary-soft);
  background: var(--primary-soft);
  color: var(--teal-dark);
  font-weight: 600;
}

.product-picker-quick {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr 90px 90px 90px 68px;
  gap: 0;
  border-top: 1px solid var(--primary-soft);
  background: #fff;
}

.product-picker-quick input,
.product-picker-quick select {
  min-width: 0;
  height: 36px;
  border: 0;
  border-right: 1px solid var(--primary-soft);
  padding: 0 9px;
  outline: 0;
  background: #fff;
}

.product-picker-quick .button {
  min-height: 36px;
  border-radius: 0;
}

.product-picker-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 8px;
  border-top: 1px solid var(--primary-soft);
  background: var(--primary-soft);
  color: var(--text-2);
}

.product-picker-footer strong {
  color: var(--primary-dark);
}

.product-picker-help {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-left: 4px;
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: #fff;
  color: var(--text-2);
  font-size: 12px;
  line-height: 16px;
}

.product-picker-count {
  margin-left: auto;
  color: var(--text-3);
}

.product-picker-footer .ghost-button {
  min-height: 30px;
  padding: 0 12px;
}

.product-picker-footer .ghost-button.active {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--theme-soft);
}

.sales-bottom-panel {
  display: grid;
  gap: 6px;
  padding-top: 12px;
}

.sales-settle-row {
  display: grid;
  gap: 6px;
  align-items: center;
}

.sales-settle-row.top {
  grid-template-columns: minmax(188px, 200px) minmax(168px, 180px) minmax(168px, 180px) minmax(280px, 380px);
  justify-content: end;
}

.sales-settle-row.summary {
  grid-template-columns: 300px minmax(0, 692px);
  justify-content: space-between;
}

.discount-type {
  grid-template-columns: 110px minmax(0, 1fr) 48px !important;
}

.discount-type button {
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--teal);
  font-weight: 600;
}

.account-field {
  grid-template-columns: 110px minmax(0, 1fr) !important;
}

.owner-field {
  grid-template-columns: 110px minmax(0, 1fr) !important;
}

.sales-left-form,
.sales-settle-form {
  display: grid;
  gap: 8px;
  align-content: start;
}

.sales-settle-form {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  align-items: center;
}

.sales-total {
  text-align: right;
  font-weight: 600;
}

.sales-total strong {
  font-size: 18px;
}

.print-check {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 6px;
  border: 0 !important;
  align-items: center;
  justify-content: flex-end;
  min-width: 110px;
}

.sales-save-bottom {
  min-height: 50px;
  width: 380px;
}

.sales-summary-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-height: 38px;
  white-space: nowrap;
}

.sales-summary-strip b {
  color: var(--text);
}

.sales-summary-strip label {
  width: 180px;
  grid-template-columns: 78px minmax(0, 1fr) !important;
}

.sales-remark-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 380px;
  gap: 0;
  align-items: center;
  min-height: 50px;
}

.sales-remark-row label {
  grid-template-columns: 110px minmax(0, 1fr) !important;
  min-height: 50px;
}

.sales-remark-row label span,
.sales-remark-row label input {
  min-height: 50px;
}

.sales-upload-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 95px;
  padding-top: 10px;
  color: var(--text-3);
  font-size: 12px;
}

.upload-box {
  width: 80px;
  min-height: 80px;
  border: 1px dashed var(--line-strong);
  background: #fff;
  color: var(--text-3);
  font-size: 14px;
}

.sales-list-shell {
  padding: 0 18px 12px;
}

.sales-list-shell .sales-report-tabs {
  margin: 0;
  padding: 0;
  height: 40px;
  background: transparent;
  border-radius: 0;
}

.sales-list-shell .sales-report-tabs button {
  min-width: 74px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}

.sales-list-shell .sales-report-tabs button.active {
  color: var(--teal);
  box-shadow: none;
  border-bottom-color: var(--teal);
}

.sales-list-toolbar {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

.sales-list-actions,
.sales-list-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sales-list-filter label {
  display: grid;
  grid-template-columns: 62px 260px;
  align-items: center;
  border: 1px solid var(--line);
}

.sales-list-filter label span {
  min-height: 36px;
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  border-right: 1px solid var(--line);
}

.sales-list-filter .filter-input {
  border: 0;
  border-radius: 0;
}

.sales-order-list-shell {
  padding: 0 14px 12px;
  border: 0;
  background: var(--bg-muted);
  font-size: 14px;
}

.sales-order-list-shell .sales-report-tabs {
  height: 49px;
  margin: 0 -14px 10px;
  padding: 0 0 0 34px;
  display: flex;
  align-items: stretch;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.sales-order-list-shell .sales-report-tabs button {
  min-width: 54px;
  min-height: 49px;
  padding: 0 0;
  border-radius: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-size: 14px;
  font-weight: 600;
}

.sales-order-list-shell .sales-report-tabs button.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  background: transparent;
  box-shadow: none;
}

.sales-list-card {
  min-width: 0;
  padding: 14px 14px 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}

.sales-order-list-shell .sales-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 45px;
  padding: 0 0 12px;
}

.sales-order-list-shell .sales-list-actions,
.sales-order-list-shell .sales-list-filter {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}

.sales-order-list-shell .sales-list-actions {
  min-width: 0;
  flex: 1 1 auto;
}

.sales-order-list-shell .sales-list-filter {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.sales-new-button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--primary);
  border-color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.sales-toolbar-button,
.sales-search-button,
.sales-export-button {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 6px;
  border-color: var(--primary-line);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.sales-statement-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.sales-statement-button::before {
  content: "";
  width: 16px;
  height: 16px;
  display: inline-block;
  background:
    radial-gradient(circle at 3px 8px, var(--primary) 0 2px, transparent 2.5px),
    radial-gradient(circle at 13px 3px, var(--primary) 0 2px, transparent 2.5px),
    radial-gradient(circle at 13px 13px, var(--primary) 0 2px, transparent 2.5px),
    linear-gradient(30deg, transparent 0 38%, var(--primary) 38% 46%, transparent 46%),
    linear-gradient(150deg, transparent 0 42%, var(--primary) 42% 50%, transparent 50%);
}

.sales-filter-input,
.sales-filter-select {
  width: 150px;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--primary-line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: 0;
}

.sales-filter-select {
  width: 180px;
  appearance: auto;
}

.sales-filter-expand {
  min-height: 32px;
  padding: 0 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.sales-filter-expand span {
  display: inline-block;
  transform: translateY(-1px);
  color: var(--primary);
}

.sales-field-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
  border-color: var(--primary-line);
  color: var(--primary-dark);
  font-size: 16px;
}

.sales-order-list-shell .table-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.sales-order-list-shell .table-wrap {
  max-height: calc(100vh - 302px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
}

.sales-order-list-shell table {
  width: 100%;
  min-width: 1830px;
  table-layout: fixed;
  border-collapse: collapse;
}

.sales-order-list-shell th,
.sales-order-list-shell td {
  height: 41px;
  padding: 0 10px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.sales-order-list-shell th {
  height: 34px;
  background: var(--bg-muted);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.sales-order-list-shell th:not(:first-child):not(:has(.sales-sort-header))::after {
  content: "↕";
  margin-left: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.sales-order-list-shell th:nth-child(1),
.sales-order-list-shell td:nth-child(1) { width: 50px; }
.sales-order-list-shell th:nth-child(2),
.sales-order-list-shell td:nth-child(2) { width: 108px; }
.sales-order-list-shell th:nth-child(3),
.sales-order-list-shell td:nth-child(3) { width: 112px; }
.sales-order-list-shell th:nth-child(4),
.sales-order-list-shell td:nth-child(4) { width: 150px; }
.sales-order-list-shell th:nth-child(5),
.sales-order-list-shell td:nth-child(5) { width: 150px; }
.sales-order-list-shell th:nth-child(6),
.sales-order-list-shell td:nth-child(6) { width: 185px; }
.sales-order-list-shell th:nth-child(7),
.sales-order-list-shell td:nth-child(7),
.sales-order-list-shell th:nth-child(8),
.sales-order-list-shell td:nth-child(8),
.sales-order-list-shell th:nth-child(9),
.sales-order-list-shell td:nth-child(9) { width: 108px; }
.sales-order-list-shell th:nth-child(10),
.sales-order-list-shell td:nth-child(10),
.sales-order-list-shell th:nth-child(11),
.sales-order-list-shell td:nth-child(11),
.sales-order-list-shell th:nth-child(12),
.sales-order-list-shell td:nth-child(12),
.sales-order-list-shell th:nth-child(13),
.sales-order-list-shell td:nth-child(13),
.sales-order-list-shell th:nth-child(14),
.sales-order-list-shell td:nth-child(14) { width: 100px; }
.sales-order-list-shell th:nth-child(12),
.sales-order-list-shell td:nth-child(12) { width: 140px; }
.sales-order-list-shell th:nth-child(14),
.sales-order-list-shell td:nth-child(14) { width: 100px; }
.sales-order-list-shell th:nth-child(15),
.sales-order-list-shell td:nth-child(15) { width: 250px; }

.sales-sort-header {
  width: 100%;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: nowrap;
}

.sales-sort-header span {
  margin-left: 5px;
  color: var(--text-3);
  font-size: 12px;
}

.sales-sort-header.active span {
  color: var(--primary);
}

.sales-cell-ellipsis,
.sales-goods-cell {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-red-text,
.sales-pay-warning {
  color: var(--danger) !important;
}

.sales-pay-paid,
.sales-audit-text {
  color: var(--text);
}

.sales-order-list-shell .sales-document-link {
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
}

.sales-order-list-shell .row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 4px;
}

.sales-order-list-shell .row-actions button {
  min-height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.sales-order-list-shell .sale-row-actions button[data-feature-print],
.sales-order-list-shell .sale-row-actions button[data-feature-pay] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.sales-order-list-shell .sale-row-actions button[data-feature-edit] {
  border-color: var(--warning);
  background: var(--warning);
  color: #fff;
}

.sales-order-list-shell .sale-row-actions button[data-feature-share] {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.sales-order-list-shell .sale-row-actions button[data-feature-copy],
.sales-order-list-shell .sale-row-actions button[data-feature-delete] {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text-2);
}

.sales-list-total-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-bottom: 0;
}

.sales-list-total-row {
  min-width: 1830px;
  display: grid;
  grid-template-columns: 50px 108px 112px 150px 150px 185px 108px 108px 108px 100px 100px 140px 100px 100px 250px;
  min-height: 41px;
  align-items: center;
  background: #fff;
  color: var(--text);
}

.sales-list-total-row > * {
  height: 41px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  font-size: 14px;
  font-weight: 400;
}

.sales-list-total-row strong {
  font-weight: 400;
}

.sales-total-title {
  color: var(--danger);
}

.sales-order-list-shell .sales-pager {
  min-height: 54px;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  color: var(--text);
  font-size: 13px;
}

.sales-order-list-shell .sales-pager button,
.sales-order-list-shell .sales-pager select {
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}

.sales-order-list-shell .sales-pager .sales-page-current {
  min-width: 30px;
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: #fff;
}

.sales-order-list-shell .sales-pager input {
  width: 40px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

@media (max-width: 1500px) {
  .sales-order-list-shell .sales-list-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sales-order-list-shell .sales-list-actions,
  .sales-order-list-shell .sales-list-filter {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .sales-order-list-shell .sales-list-actions button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.sales-advanced-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}

.sales-advanced-filter input,
.sales-advanced-filter select {
  width: 150px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  padding: 0 8px;
  background: #fff;
}

.sales-advanced-filter input[type="date"] {
  width: 168px;
}

.document-basic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 8px;
  padding: 8px 0 12px;
}

.document-basic-grid label {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: #fff;
}

.document-basic-grid label.wide {
  grid-column: span 2;
}

.document-basic-grid span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.document-basic-grid input,
.document-basic-grid select {
  min-width: 0;
  width: 100%;
  min-height: 36px;
  border: 0;
  outline: 0;
  padding: 0 10px;
  background: #fff;
}

.document-line-panel {
  border: 1px solid var(--line);
  margin-top: 2px;
}

.document-line-panel .table-header {
  border-bottom: 1px solid var(--line);
}

.document-lines {
  width: 100%;
  min-width: 760px;
}

.document-settlement-panel {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--line);
}

.document-settlement-panel label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.document-settlement-panel span {
  color: var(--muted);
  font-size: 12px;
}

.document-settlement-panel input {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 9px;
  background: #fff;
}

.document-settlement-panel input:disabled {
  background: var(--bg-subtle);
  color: var(--text);
}

.line-actions {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.line-actions button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  line-height: 20px;
}

.line-actions button:first-child {
  background: var(--success);
}

.line-actions button:last-child {
  background: var(--danger);
}

.document-form-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}

.document-total {
  color: var(--primary-dark);
  font-weight: 600;
}

.document-total strong {
  color: var(--text);
  font-size: 17px;
}

.quick-action-list {
  display: grid;
  gap: 10px;
  padding: 4px 0 12px;
}

.sales-list-shell .table-panel {
  border-radius: 0;
  box-shadow: none;
}

.sales-list-shell th:first-child,
.sales-list-shell td:first-child {
  width: 38px;
  text-align: center;
}

.sales-row-check,
[data-sales-select-all],
[data-feature-select-all],
[data-master-select-all] {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.master-advanced-filter {
  grid-template-columns: 190px minmax(260px, 1fr) 160px 240px auto auto;
}

.system-page {
  display: grid;
  gap: 12px;
}

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

.system-config-single {
  grid-template-columns: minmax(0, 1fr);
}

.system-section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.system-config-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}

.system-config-panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.system-value-row strong {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
}

.system-setting-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.system-setting-row:last-child {
  margin-bottom: 0;
}

.system-setting-row > span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.system-setting-row > input,
.system-setting-row > select,
.system-setting-row > textarea {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  border: 0;
  outline: 0;
  padding: 0 10px;
  background: #fff;
}

.system-setting-row textarea {
  min-height: 74px;
  padding-top: 9px;
  resize: vertical;
}

.system-setting-row.textarea-row {
  align-items: stretch;
}

.system-setting-row.switch-row {
  grid-template-columns: 1fr 58px;
}

.system-setting-row.switch-row > span {
  justify-content: start;
  place-items: center start;
  padding-left: 12px;
}

.system-setting-row.switch-row > input {
  width: 18px;
  min-height: 18px;
  justify-self: center;
  accent-color: var(--teal);
}

.theme-setting-row {
  align-items: stretch;
}

.theme-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 10px;
  background: #fff;
}

.theme-swatch-option {
  position: relative;
}

.theme-swatch-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: auto;
  min-height: 0;
}

.theme-swatch-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.theme-swatch-chip i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--swatch-a), var(--swatch-b));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.theme-swatch-option input:checked + .theme-swatch-chip {
  border-color: var(--teal);
  background: var(--theme-soft);
  color: var(--teal);
}

.system-action-row,
.system-inline-action {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.system-inline-action {
  grid-template-columns: minmax(0, 1fr) auto;
}

.sales-pager {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border: 1px solid var(--line);
  border-top: 0;
  padding: 0 10px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
}

.sales-pager input {
  width: 42px;
  height: 28px;
  margin: 0 4px;
  border: 1px solid var(--line);
  text-align: center;
}

.sales-pager button,
.sales-pager select {
  min-height: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.stock-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.stock-line:last-child {
  border-bottom: 0;
}

.mobile-menu-hint {
  display: none;
}

.print-template-page .toolbar {
  align-items: flex-start;
}

.print-template-page .toolbar-right {
  gap: 8px;
  justify-content: flex-end;
  max-width: 980px;
}

.print-template-page .toolbar-right select {
  min-width: 112px;
}

.print-template-check {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  white-space: nowrap;
}

.print-template-check input {
  margin: 0;
}

.print-template-page .row-actions {
  min-width: 260px;
}

.print-designer {
  display: grid;
  gap: 14px;
}

.print-designer-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(260px, 0.72fr);
  gap: 14px;
}

.print-designer-control,
.print-designer-preview {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
}

.print-designer-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.print-designer .field.full textarea {
  min-height: 210px;
  font-family:var(--font);
  line-height: 1.55;
}

.print-preview-paper {
  min-height: 306px;
  border: 1px solid var(--primary-line);
  border-radius: 4px;
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 8px #fff;
  padding: 18px;
}

.print-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--text-3);
  color: var(--muted);
  font-size: 13px;
}

.print-preview-paper pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-family:var(--font);
  line-height: 1.7;
}

.system-bottom-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
}

.compact-date {
  max-width: 132px;
}

@media (max-width: 1100px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow {
    grid-template-columns: repeat(4, minmax(96px, 1fr));
  }

  .home-page {
    grid-template-columns: 1fr;
  }

  .home-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-left: 0;
  }

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

  .sales-menu-popover {
    left: var(--sidebar-width);
    top: 104px;
  }

  .sales-basic-grid,
  .sales-delivery-panel,
  .sales-advanced-filter,
  .document-settlement-panel,
  .sales-settle-row.top,
  .sales-settle-row.summary,
  .sales-remark-row {
    grid-template-columns: 1fr;
  }

  .sales-summary-strip,
  .sales-list-filter {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 0;
  }

  .brand {
    justify-content: flex-start;
  }

  .brand > div:not(.brand-mark),
  .nav-item span:last-child {
    display: block;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 62px;
    flex-direction: column;
    justify-content: center;
    font-size: 12px;
  }

  .workspace {
    margin-left: 0;
    padding: 0;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding: 8px 12px;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
  }

  .search-box {
    width: 100%;
  }

  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .home-sales-cards,
  .quick-operation,
  .home-bottom-grid,
  .home-side {
    grid-template-columns: 1fr;
  }

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

  .flow {
    grid-template-columns: 1fr;
  }

  .sales-menu-popover {
    position: fixed;
    left: 8px;
    right: 8px;
    top: 154px !important;
    width: auto;
    margin: 0;
  }

  .module-menu-shield {
    inset: 0;
  }

  .sales-menu-panel {
    max-height: calc(100vh - 166px);
  }

  .sales-detail-layer {
    left: 0;
    top: 0;
  }

  .sales-page-head,
  .sales-form-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sales-subtabs,
  .sales-report-tabs {
    width: 100%;
  }

  .sales-subtabs button,
  .sales-report-tabs button {
    flex: 1;
  }

  .sales-save-bottom {
    width: 100%;
  }

  .sales-summary-strip {
    display: grid;
    gap: 8px;
  }

  .sales-summary-strip label,
  .sales-list-filter label {
    width: 100%;
    grid-template-columns: 90px minmax(0, 1fr) !important;
  }

table {
  min-width: 760px;
}
}

.auth-modal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-resource-block,
.field-setting-modal .field.full {
  grid-column: 1 / -1;
}

.auth-resource-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.auth-resource-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.permission-resource-block {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

/* Inventory module: reference-style document, list, detail, and stock-ledger pages. */
.inventory-report,
.inventory-query-page {
  min-width: 1080px;
  font-size: 13px;
}

.inventory-report-card,
.inventory-query-page {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 10px 14px 12px;
}

.stock-summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 92px;
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}

.stock-summary-band > div {
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
}

.stock-summary-band span {
  color: var(--text-2);
  font-size: 14px;
}

.stock-summary-band strong {
  color: var(--primary-dark);
  font-size: 25px;
  font-weight: 600;
}

.inventory-list-toolbar,
.inventory-query-toolbar {
  min-height: 48px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.inventory-query-toolbar {
  justify-content: flex-end;
}

.inventory-query-toolbar .toolbar-right {
  margin-left: auto;
}

.inventory-list-actions,
.inventory-list-filters {
  flex-wrap: nowrap;
}

.inventory-list-filters input,
.inventory-list-filters select,
.inventory-query-toolbar input:not([type="checkbox"]),
.inventory-query-toolbar select {
  width: 150px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.inventory-query-toolbar input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0 6px 0 0;
}

.inventory-list-filters select,
.inventory-query-toolbar select {
  width: 132px;
}

.inventory-list-actions .button,
.inventory-list-actions .ghost-button,
.inventory-list-filters .button,
.inventory-list-filters .ghost-button,
.inventory-query-toolbar .button,
.inventory-query-toolbar .ghost-button {
  min-height: 32px;
  border-radius: 4px;
  white-space: nowrap;
}

.inventory-report .table-panel,
.inventory-query-page .table-panel {
  border-radius: 0;
  box-shadow: none;
}

.inventory-report .table-wrap,
.inventory-query-page .table-wrap {
  max-height: calc(100vh - 300px);
  overflow: auto;
}

.inventory-report table,
.inventory-query-page table {
  min-width: 1540px;
  font-size: 13px;
}

.inventory-report th,
.inventory-report td,
.inventory-query-page th,
.inventory-query-page td {
  height: 39px;
  padding: 5px 9px;
  border-color: var(--line-strong);
  white-space: nowrap;
}

.inventory-report .sales-document-link,
.inventory-query-page .link-button {
  color: var(--primary);
}

.inventory-link-text {
  color: var(--primary);
}

.inventory-row-actions {
  flex-wrap: nowrap;
}

.inventory-row-actions button {
  min-width: 34px;
  height: 24px;
  border-radius: 4px;
  padding: 0 6px;
}

.inventory-row-actions button:first-child {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.inventory-row-actions button:nth-child(2) {
  border-color: var(--warning);
  background: var(--warning);
  color: #fff;
}

.inventory-row-actions button:disabled {
  border-color: var(--line-strong);
  background: var(--bg-muted);
  color: var(--text-3);
}

.inventory-pager {
  justify-content: flex-start;
  min-height: 48px;
  padding: 9px 4px 0;
  border-top: 1px solid var(--line);
}

.inventory-advanced-filter {
  margin-bottom: 9px;
}

.inventory-document-sheet {
  position: relative;
  min-width: 1180px;
  min-height: calc(100vh - 116px);
  background: #fff;
  border: 1px solid var(--line-strong);
  padding: 52px 13px 18px;
  font-size: 13px;
}

.inventory-document-sheet:not(.detail) {
  margin: 0;
}

.inventory-new-actions,
.inventory-detail-top-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-height: 44px;
  padding: 7px 14px;
  background: var(--text-3);
}

.inventory-detail-top-actions .button,
.inventory-detail-top-actions .ghost-button,
.inventory-new-actions .button,
.inventory-new-actions .ghost-button {
  min-width: 66px;
  height: 36px;
  border-radius: 0;
}

.inventory-status-button {
  display: inline-grid;
  place-items: center;
  min-width: 50px;
  height: 28px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text-2);
}

.inventory-status-button.approved {
  border-color: var(--success);
  color: var(--success);
}

.inventory-generated-warning {
  margin: -4px 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
}

.inventory-form-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--primary-soft);
}

.inventory-form-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 8px;
  color: var(--primary-dark);
  font-size: 18px;
}

.inventory-toolbar-spacer {
  flex: 1;
}

.inventory-form-toolbar .button,
.inventory-form-toolbar .ghost-button {
  min-height: 31px;
  border-radius: 8px;
  padding: 0 13px;
  white-space: nowrap;
}

.inventory-form-toolbar .button {
  border-radius: 8px;
}

.inventory-basic-grid {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 67px;
  padding: 14px 0;
  overflow-x: auto;
}

.inventory-basic-grid label,
.inventory-pack-document-meta label,
.inventory-document-footer label,
.inventory-pack-heading label {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.inventory-basic-grid label > span,
.inventory-pack-document-meta label > span,
.inventory-document-footer label > span,
.inventory-pack-heading label > span {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 0 10px;
  border-right: 1px solid var(--primary-soft);
  color: var(--text-2);
  text-align: center;
}

.inventory-basic-grid input,
.inventory-basic-grid select,
.inventory-pack-document-meta input,
.inventory-document-footer input,
.inventory-pack-heading input,
.inventory-pack-heading select {
  width: 120px;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0 10px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 13px;
}

.inventory-pack-document-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inventory-pack-document-meta label {
  height: 36px;
}

.inventory-entry-grid .line-actions {
  gap: 4px;
}

.inventory-entry-grid .line-actions button {
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 16px;
}

.inventory-basic-grid label:first-child select {
  width: 120px;
}

.inventory-basic-grid .inventory-print-check {
  gap: 7px;
  border: 0;
  padding: 0 8px;
}

.inventory-basic-grid .inventory-print-check input {
  width: 16px;
  height: 16px;
}

.inventory-grid-wrap {
  height: 370px;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
}

.inventory-entry-grid {
  width: 100%;
  min-width: 1260px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.inventory-entry-grid th,
.inventory-entry-grid td {
  height: 40px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: #fff;
  text-align: center;
}

.inventory-entry-grid th {
  height: 42px;
  background: var(--bg-muted);
  color: var(--text);
  font-weight: 600;
}

.inventory-entry-grid th:first-child {
  width: 42px;
  font-family:var(--font);
  font-size: 16px;
}

.inventory-entry-grid th:nth-child(2) {
  width: 66px;
}

.inventory-entry-grid th:nth-child(3) {
  width: 205px;
}

.inventory-entry-grid input {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0 8px;
  color: var(--primary);
  text-align: center;
}

.inventory-entry-grid input[readonly] {
  cursor: default;
}

[data-inventory-locked="1"] .inventory-entry-grid input,
[data-inventory-locked="1"] .inventory-basic-grid input,
[data-inventory-locked="1"] .inventory-basic-grid select,
[data-inventory-locked="1"] .inventory-document-footer input,
[data-inventory-locked="1"] .line-actions button {
  pointer-events: none;
  color: var(--text-2);
  background: var(--bg-subtle);
}

.inventory-entry-grid .inventory-line-name {
  color: var(--primary);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.inventory-entry-grid tfoot td {
  height: 42px;
  background: #fff;
}

.inventory-document-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
}

.inventory-footer-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 620px;
  flex: 1;
}

.inventory-footer-fields {
  display: grid;
  grid-template-columns: 300px minmax(360px, 1fr);
  gap: 6px;
}

.inventory-footer-left .wide input {
  width: 100%;
}

.inventory-footer-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 300px;
  font-weight: 600;
}

.inventory-footer-summary {
  display: none;
}

.inventory-footer-total strong {
  color: var(--danger);
}

.inventory-bottom-save {
  min-width: 300px;
  height: 40px;
  border-radius: 0;
}

.inventory-upload-block {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.inventory-upload-block small {
  color: var(--text-2);
  font-size: 12px;
}

.inventory-pack-section + .inventory-pack-section {
  margin-top: 14px;
}

.inventory-pack-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
}

.inventory-pack-heading > strong {
  min-width: 94px;
  color: var(--primary-dark);
  font-size: 16px;
}

.inventory-pack-heading label input,
.inventory-pack-heading label select {
  width: 175px;
}

.inventory-pack-grid {
  min-width: 1420px;
}

.inventory-pack-section .inventory-grid-wrap {
  height: 210px;
  min-height: 210px;
}

.inventory-detail-layer {
  top: 80px;
  background: var(--bg-muted);
}

.inventory-detail-layer .sales-detail-titlebar {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 100%);
}

.inventory-detail-scroll {
  padding: 8px 10px 18px;
}

.inventory-print-preview {
  min-width: 760px;
}

.inventory-print-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}

.inventory-print-toolbar label {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.inventory-print-toolbar select {
  height: 34px;
  border: 1px solid var(--line-strong);
  padding: 0 9px;
}

.inventory-print-paper {
  width: min(720px, 100%);
  min-height: 430px;
  margin: 18px auto;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 28px;
  box-shadow: 0 4px 18px rgba(30, 44, 54, 0.08);
}

.inventory-print-paper h2,
.inventory-print-paper h3,
.inventory-print-paper p {
  margin: 0 0 12px;
  text-align: center;
}

.inventory-print-template-name {
  color: var(--text-2);
  font-size: 12px;
}

.inventory-print-paper table,
.stock-movement-detail table {
  width: 100%;
  border-collapse: collapse;
}

.inventory-print-paper th,
.inventory-print-paper td,
.stock-movement-detail th,
.stock-movement-detail td {
  height: 34px;
  border: 1px solid var(--line-strong);
  padding: 5px 8px;
  text-align: center;
}

.stock-movement-detail {
  min-width: 1180px;
  max-height: 72vh;
  overflow: auto;
}

.modal:has(.stock-movement-detail) {
  width: min(1480px, calc(100vw - 80px));
  max-width: none;
}

.modal:has(.inventory-print-preview) {
  width: min(980px, calc(100vw - 80px));
  max-width: none;
}

.stock-movement-detail .toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 0;
  background: #fff;
}

.stock-movement-detail input,
.stock-movement-detail select {
  height: 32px;
  border: 1px solid var(--line-strong);
  padding: 0 8px;
}

@media (max-width: 900px) {
  .inventory-report,
  .inventory-query-page,
  .inventory-document-sheet {
    min-width: 980px;
  }

  .inventory-detail-layer {
    left: 0;
    top: 0;
  }

  .inventory-list-toolbar,
  .inventory-query-toolbar,
  .inventory-document-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-list-actions,
  .inventory-list-filters {
    flex-wrap: wrap;
  }
}

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

.permission-scope-summary {
  color: var(--primary);
  display: inline-block;
  max-width: 340px;
  white-space: normal;
}

.number-rule-modal .field.full {
  grid-column: 1 / -1;
}

.number-rule-options {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px 12px;
}

.number-rule-options label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.auth-resource-options label,
.auth-resource-title label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.settings-mini-table {
  width: 100%;
}

.settings-mini-table textarea {
  min-height: 42px;
  resize: vertical;
  width: 100%;
}

.settings-mini-table button {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  height: 28px;
  margin-right: 4px;
  min-width: 28px;
}

.sales-branch-form {
  min-height: 700px;
  padding: 12px 14px;
}

.sales-branch-basic {
  grid-template-columns: minmax(300px, 1.6fr) auto minmax(210px, 1fr) minmax(220px, 1fr) minmax(210px, 1fr);
}

.sales-branch-table {
  min-width: 1320px;
}

.sales-branch-table th:nth-child(2) {
  width: 64px;
}

.sales-image-cell {
  width: 56px;
  text-align: center;
}

.sales-product-thumb,
.sales-product-thumb-placeholder {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  object-fit: cover;
}

.sales-product-thumb-placeholder {
  background: var(--primary-soft);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.sales-branch-bottom .return-settle {
  grid-template-columns: minmax(220px, 260px) minmax(320px, 420px);
}

.sales-branch-bottom .cashier-return-settle,
.sales-branch-bottom .exchange-settle {
  grid-template-columns: repeat(3, minmax(210px, 290px));
}

.sales-branch-bottom .sales-summary-strip {
  min-width: 0;
  flex-wrap: wrap;
}

.sales-remark-row.without-print {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.sales-top-print-check {
  grid-template-columns: 108px 44px !important;
  justify-self: end;
}

.sales-top-print-check input {
  width: 18px;
  margin: auto;
}

.cashier-shell {
  min-height: calc(100vh - 176px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--bg-muted);
}

.cashier-titlebar {
  min-height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--text);
  color: #fff;
}

.cashier-titlebar > strong {
  font-size: 16px;
}

.cashier-titlebar .ghost-button {
  border-color: var(--text-2);
  background: var(--text);
  color: #fff;
}

.cashier-titlebar .sales-action-group {
  justify-content: flex-end;
}

.cashier-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 29%) minmax(620px, 1fr);
  min-height: 650px;
}

.cashier-cart-panel {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 58px 46px;
  min-width: 0;
  border-right: 1px solid var(--line-strong);
  background: #fff;
}

.cashier-cart-panel h3 {
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.cashier-cart-table {
  overflow: auto;
}

.cashier-cart-head,
.cashier-cart-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 116px 82px 46px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.cashier-cart-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 38px;
  background: var(--bg-muted);
  color: var(--text-2);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.cashier-cart-row > span:first-child {
  min-width: 0;
  padding: 7px 10px;
}

.cashier-cart-row b,
.cashier-cart-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cashier-cart-row small {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12px;
}

.cashier-cart-row > span:nth-child(3) {
  text-align: center;
  color: var(--danger);
  font-weight: 600;
}

.cashier-qty-control {
  display: grid;
  grid-template-columns: 28px 42px 28px;
  justify-content: center;
}

.cashier-qty-control button,
.cashier-qty-control input {
  width: 100%;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #fff;
  text-align: center;
}

.cashier-qty-control button + input,
.cashier-qty-control input + button {
  border-left: 0;
}

.cashier-cart-empty,
.cashier-products-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.cashier-cart-total {
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
}

.cashier-cart-total strong {
  color: var(--danger);
  font-size: 16px;
}

.cashier-cart-panel > .ghost-button {
  margin: 7px 12px;
}

.cashier-product-panel {
  position: relative;
  min-width: 0;
  padding: 14px 16px 68px;
  background: var(--bg-muted);
}

.cashier-product-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.cashier-product-toolbar input {
  width: min(440px, 58%);
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 12px;
  background: #fff;
}

.cashier-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 10px;
}

.cashier-product-card {
  min-width: 0;
  min-height: 126px;
  padding: 13px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.cashier-product-card:hover {
  border-color: var(--theme-primary);
  box-shadow: 0 3px 12px rgba(35, 54, 66, 0.08);
}

.cashier-product-card strong,
.cashier-product-card small,
.cashier-product-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cashier-product-card small,
.cashier-product-card span {
  color: var(--text-2);
  font-size: 12px;
}

.cashier-product-card b {
  margin-top: 6px;
  color: var(--danger);
  font-size: 16px;
}

.cashier-product-pager {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.cashier-product-pager button {
  width: 32px;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.cashier-checkout-button {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 180px;
  min-height: 44px;
}

.cashier-checkout-panel {
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.cashier-checkout-title {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.cashier-checkout-title .link-button {
  margin-left: 4px;
}

.cashier-checkout-title .icon-button {
  margin-left: auto;
}

.cashier-checkout-form {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cashier-checkout-form > label,
.customer-store-basic label,
.customer-store-payment label,
.customer-store-totals label,
.customer-store-other label {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.cashier-checkout-form label > span,
.customer-store-shell label > span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-strong);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.cashier-checkout-form input,
.cashier-checkout-form select,
.cashier-checkout-form textarea,
.customer-store-shell input,
.customer-store-shell select {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  border: 0;
  padding: 0 10px;
  outline: 0;
}

.cashier-toggle-field input {
  width: 18px;
  margin-left: 12px;
}

.cashier-combo-table,
.cashier-checkout-remark,
.cashier-final-pay {
  grid-column: 1 / -1;
}

.cashier-combo-table {
  border: 1px solid var(--line-strong);
}

.cashier-combo-head,
.cashier-combo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px;
  align-items: center;
  min-height: 38px;
}

.cashier-combo-head {
  background: var(--bg-muted);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.cashier-combo-row {
  border-top: 1px solid var(--line-strong);
}

.cashier-combo-row > * {
  border-right: 1px solid var(--line-strong);
}

.cashier-checkout-remark textarea {
  min-height: 64px;
  padding-top: 8px;
  resize: vertical;
}

.cashier-final-pay {
  min-height: 44px;
}

.customer-store-shell {
  min-height: 660px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.customer-store-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.customer-store-basic {
  display: grid;
  grid-template-columns: minmax(310px, 1.3fr) minmax(190px, .7fr) minmax(250px, 1fr) minmax(250px, 1fr);
  gap: 8px;
  padding: 14px 0;
}

.customer-store-basic label:first-child {
  grid-template-columns: 82px minmax(0, 1fr) 36px 36px;
}

.customer-store-basic .icon-button {
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
}

.customer-store-section {
  margin-top: 10px;
  border-top: 1px solid var(--line-strong);
}

.customer-store-section h3 {
  padding: 12px 0 9px;
  font-size: 14px;
}

.customer-store-payment {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) 42px;
  gap: 8px;
  max-width: 880px;
  margin-bottom: 8px;
}

.customer-store-payment > .icon-button {
  min-height: 40px;
}

.customer-store-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 320px));
  gap: 8px;
  max-width: 660px;
  margin-top: 12px;
}

.customer-store-other {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(360px, 1fr) 180px;
  gap: 8px;
  align-items: stretch;
}

.customer-store-other .button {
  min-height: 40px;
}

@media (max-width: 1100px) {
  .cashier-workspace {
    grid-template-columns: minmax(300px, 38%) minmax(480px, 1fr);
  }

  .cashier-product-grid {
    grid-template-columns: repeat(3, minmax(135px, 1fr));
  }

  .customer-store-basic,
  .customer-store-other {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-store-other .button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .customer-store-shell {
    min-height: auto;
    padding: 10px;
  }

  .customer-store-detail-actions {
    flex-wrap: wrap;
  }

  .customer-store-basic,
  .customer-store-payment,
  .customer-store-totals,
  .customer-store-other,
  .cashier-checkout-form {
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
  }

  .customer-store-basic label,
  .customer-store-payment label,
  .customer-store-totals label,
  .customer-store-other label,
  .cashier-checkout-form > label {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .customer-store-basic label:first-child {
    grid-template-columns: 72px minmax(0, 1fr) 36px 36px;
  }

  .customer-store-payment > .icon-button,
  .customer-store-other .button {
    grid-column: auto;
    width: 100%;
  }

  .staff-list-toolbar,
  .staff-list-toolbar .toolbar-right {
    align-items: stretch;
    flex-direction: column;
    flex-wrap: wrap;
  }

  .staff-list-toolbar .filter-input {
    width: 100%;
  }

  .staff-editor-grid,
  .staff-role-grid {
    grid-template-columns: 1fr;
  }

  .staff-editor-field {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .staff-help-steps {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .staff-help-steps i {
    display: none;
  }

  .product-editor-grid,
  .product-editor-grid.compact,
  .product-attribute-list,
  .product-grade-price-grid {
    grid-template-columns: 1fr;
  }

  .finance-form-grid,
  .finance-form-summary {
    grid-template-columns: 1fr;
  }

  .product-editor-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .print-designer-grid {
    grid-template-columns: 1fr;
  }

  .print-designer-bar .ghost-button,
  .print-designer-bar .button {
    flex: 1 1 82px;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .sales-print-paper,
  .sales-print-paper *,
  .inventory-print-paper,
  .inventory-print-paper * {
    visibility: visible !important;
  }

  .sales-print-paper,
  .inventory-print-paper {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 18mm;
    border: 0;
  }
}

}
/* ==========================================================================
   泰好旺供应链 · 界面设计层
   - 旧样式整体放在 @layer legacy 中，只负责各页面的布局细节；
   - 本层不分 layer，按级联规则始终覆盖 legacy，统一颜色、字号、控件尺寸。
   - 主题色由 app.js 写入 --teal / --teal-dark / --theme-soft，本层映射为 --primary。
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", Roboto, sans-serif;

  --text: #1f2733;
  --text-2: #4a5464;
  --text-3: #7b8594;
  --text-4: #a8b0bc;
  --line: #e2e6ec;
  --line-soft: #edf0f4;
  --line-strong: #cdd3dc;
  --bg: #f2f4f7;
  --bg-subtle: #f7f8fa;
  --bg-muted: #eef1f5;
  --surface: #ffffff;

  --primary: var(--teal, #1f6fe5);
  --primary-dark: var(--teal-dark, #1858c0);
  --primary-soft: var(--theme-soft, #ecf3fe);
  --primary-line: color-mix(in srgb, var(--primary) 32%, #ffffff);
  --primary-ring: color-mix(in srgb, var(--primary) 18%, transparent);

  --success: #17905a;
  --success-soft: #e7f6ee;
  --success-line: #b5e0c9;
  --warning: #c9710a;
  --warning-soft: #fff4e3;
  --warning-line: #f3d4a2;
  --danger: #d4383f;
  --danger-soft: #fdeeee;
  --danger-line: #f3c2c4;
  --violet: #6754cc;
  --violet-soft: #f0eefc;

  --h-control: 32px;
  --h-control-sm: 28px;
  --r-control: 6px;
  --r-card: 8px;
  --sidebar-width: 172px;
  --topbar-height: 48px;
  --tabs-height: 40px;
  --shadow-pop: 0 10px 28px rgba(22, 32, 48, 0.14), 0 2px 6px rgba(22, 32, 48, 0.06);
  --shadow-modal: 0 24px 60px rgba(22, 32, 48, 0.22);

  /* 旧变量映射，让 legacy 中仍在使用的变量跟随新规范 */
  --ink: var(--text);
  --muted: var(--text-3);
  --panel: var(--surface);
  --page: var(--bg);
  --radius: var(--r-card);
  --shadow: var(--shadow-pop);
  --green: var(--success);
  --amber: var(--warning);
  --red: var(--danger);
  --blue: var(--primary);
}

/* ---------- 基础 ---------- */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: var(--font);
  font-size: 13px;
  color: inherit;
}

::selection {
  background: var(--primary-ring);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 14px;
}

.muted {
  color: var(--text-3);
  font-size: 12px;
}

.eyebrow {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- 侧栏 ---------- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  color: var(--text-2);
  border-right: 1px solid var(--line);
  transition: width 160ms ease;
}

.brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.brand-logo {
  width: auto;
  height: 28px;
  max-height: 28px;
  max-width: 96px;
}

.brand-erp-badge {
  min-width: 0;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.main-nav {
  gap: 2px;
  padding: 10px 8px;
}

.nav-item {
  min-height: 40px;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--r-control);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: var(--bg-muted);
  color: var(--text);
}

.nav-item.active,
.nav-item.menu-open {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::after,
.nav-item.menu-open::after {
  content: none;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.nav-icon,
.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-icon svg {
  stroke-width: 1.8;
}

.nav-item.menu-open .nav-icon {
  transform: none;
}

/* 收起侧栏：只保留图标 */
body.nav-collapsed {
  --sidebar-width: 60px;
}

body.nav-collapsed .brand {
  justify-content: center;
  padding: 0;
}

body.nav-collapsed .brand-logo {
  max-width: 44px;
  height: 22px;
  object-fit: contain;
  object-position: left center;
}

body.nav-collapsed .brand-erp-badge {
  display: none;
}

body.nav-collapsed .nav-item {
  justify-content: center;
  padding: 0;
  font-size: 0;
  gap: 0;
}

body.nav-collapsed .nav-item > span:not(.nav-icon) {
  display: none;
}

.workspace {
  margin-left: var(--sidebar-width);
  transition: margin-left 160ms ease;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  height: var(--topbar-height);
  padding: 0 16px 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-actions {
  height: var(--topbar-height);
  gap: 6px;
}

.top-refresh,
.company-switch,
.top-link,
.top-user-trigger {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}

.top-refresh {
  width: 32px;
  padding: 0;
  justify-content: center;
}

.top-refresh svg,
.top-link svg,
.top-caret {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.company-switch {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.top-refresh:hover,
.company-switch:hover,
.top-link:hover,
.top-user-trigger:hover,
.top-user-trigger[aria-expanded="true"] {
  background: var(--bg-muted);
  color: var(--text);
}

.top-divider {
  display: none;
}

.expire-text {
  margin-left: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.top-user {
  position: relative;
}

.top-avatar {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.top-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.top-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 168px;
  display: grid;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.top-menu[hidden] {
  display: none;
}

.top-menu-item {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}

.top-menu-item:hover {
  background: var(--bg-muted);
}

.top-menu-item.danger {
  color: var(--danger);
}

.top-menu-item.danger:hover {
  background: var(--danger-soft);
}

.top-menu-divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--line-soft);
}

/* ---------- 页面标签 ---------- */

.work-tabs {
  position: sticky;
  top: var(--topbar-height);
  z-index: 17;
  height: var(--tabs-height);
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.work-tab-list {
  align-items: center;
  gap: 2px;
  height: 100%;
}

.work-tab {
  min-width: 0;
  max-width: 168px;
  height: 30px;
  flex: 0 0 auto;
  gap: 4px;
  padding: 0 4px 0 12px;
  border: 0;
  border-radius: var(--r-control);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.work-tab:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.work-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.work-tab button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--text-4);
  font-size: 14px;
  line-height: 1;
}

.work-tab button:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.work-tab-nav,
.work-tab-home,
.work-tab-tools {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 400;
}

.work-tab-tools {
  width: auto;
  padding: 0 8px;
}

.work-tab-nav:hover,
.work-tab-home:hover,
.work-tab-tools:hover {
  background: var(--bg-muted);
  color: var(--text);
}

body.nav-collapsed .work-tab-nav {
  transform: scaleX(-1);
}

/* ---------- 内容区 ---------- */

.view {
  gap: 12px;
  padding: 16px;
}

/* ---------- 按钮 ---------- */

.button,
.ghost-button,
.icon-button,
.danger-button {
  min-height: var(--h-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: #fff;
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--primary);
  background: var(--surface);
  color: var(--primary);
}

.icon-button {
  min-width: var(--h-control);
  padding: 0 8px;
}

.danger-button {
  color: var(--danger);
  border-color: var(--danger-line);
}

.danger-button:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.link-button,
.inline-link,
.sales-document-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 400;
  cursor: pointer;
}

.link-button:hover,
.inline-link:hover,
.sales-document-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.danger-link {
  color: var(--danger);
}

/* 表格行内操作：统一为轻量文字按钮 */
.row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.row-actions button,
.row-actions .ghost-button,
.row-actions .button,
.row-actions .danger-button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 400;
}

.row-actions button:hover {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.row-actions .danger-button,
.row-actions button[data-feature-delete],
.row-actions button[data-master-delete] {
  color: var(--danger);
}

.row-actions .danger-button:hover,
.row-actions button[data-feature-delete]:hover,
.row-actions button[data-master-delete]:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sale-row-actions button[data-feature-print],
.sale-row-actions button[data-feature-pay],
.sale-row-actions button[data-feature-edit],
.sale-row-actions button[data-feature-share] {
  border-color: transparent;
  background: transparent;
  color: var(--primary);
}

/* ---------- 输入控件 ---------- */

input:where(:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"])),
select,
textarea {
  border-color: var(--line-strong);
  border-radius: var(--r-control);
  background-color: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.field input,
.field select,
.field textarea,
.filter-input,
.inline-table-input {
  min-height: var(--h-control);
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.field textarea {
  min-height: 72px;
}

input:where(:not([type="checkbox"], [type="radio"])):focus,
select:focus,
textarea:focus,
.filter-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-4);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-subtle);
  color: var(--text-3);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}

.field {
  gap: 6px;
}

.field label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}

.form-grid {
  gap: 14px 16px;
}

/* ---------- 卡片 / 面板 ---------- */

.panel,
.metric,
.table-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: none;
}

.panel {
  padding: 16px;
}

.metric {
  min-height: 0;
  padding: 14px 16px;
}

.metric-label {
  color: var(--text-3);
  font-size: 12px;
}

.metric-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.metric-foot {
  margin-top: 6px;
  color: var(--text-3);
}

.table-header {
  min-height: 48px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.table-header h2 {
  font-size: 14px;
}

/* 表头里的说明文字（如“支持新增、编辑、删除和本地筛选”）不再显示 */
.table-header .muted:empty,
.table-header p.muted {
  display: none;
}

/* ---------- 表格 ---------- */

table {
  border-collapse: collapse;
}

th,
td {
  height: 40px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.4;
}

th {
  height: 38px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}

td {
  color: var(--text);
}

tbody tr:hover > td {
  background: color-mix(in srgb, var(--primary-soft) 55%, transparent);
}

tbody tr:last-child > td {
  border-bottom-color: transparent;
}

/* ---------- 状态标签 ---------- */

.status {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status.draft {
  background: var(--bg-muted);
  color: var(--text-2);
}

.status.pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status.approved,
.status.done,
.status.enabled {
  background: var(--success-soft);
  color: var(--success);
}

.status.warning {
  background: var(--danger-soft);
  color: var(--danger);
}

.status.route {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- 页签 ---------- */

.tabs {
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--bg-muted);
}

.tab-button {
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(22, 32, 48, 0.08);
}

/* ---------- 分页 ---------- */

.sales-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 16px;
  color: var(--text-3);
  font-size: 12px;
}

.sales-pager button {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
}

.sales-pager button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sales-pager button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.sales-pager input,
.sales-pager select {
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 12px;
}

.sales-pager input {
  width: 44px;
  margin: 0 4px;
  text-align: center;
}

/* ---------- 弹窗 ---------- */

.modal-backdrop {
  background: rgba(20, 28, 40, 0.42);
}

.modal {
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.modal-header {
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.modal-header .eyebrow {
  display: none;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-header .icon-button,
#modal-close {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-size: 18px;
}

.modal-header .icon-button:hover,
#modal-close:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.modal-form {
  padding: 16px 20px 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- 模块菜单（侧栏弹出） ---------- */

.module-menu-shield {
  background: rgba(20, 28, 40, 0.04);
}

.sales-menu-popover {
  left: calc(var(--sidebar-width) + 6px);
  width: 200px;
}

.module-menu-popover.wide {
  width: 400px;
}

.sales-menu-panel {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.module-menu-panel.wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 6px;
}

.module-menu-group {
  border-right: 0;
  padding-bottom: 4px;
}

.module-menu-group + .module-menu-group {
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
  padding-top: 4px;
}

.module-menu-panel.wide .module-menu-group + .module-menu-group {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
  border-left: 1px solid var(--line-soft);
  padding-left: 6px;
}

.sales-menu-title {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.sales-menu-row {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 34px;
  padding: 0 4px 0 0;
  border-radius: var(--r-control);
}

.sales-menu-row:hover {
  background: var(--bg-muted);
}

.sales-menu-link {
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
}

.sales-menu-row.active {
  background: var(--primary-soft);
}

.sales-menu-row.active .sales-menu-link {
  color: var(--primary);
  font-weight: 600;
}

.sales-menu-report {
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
}

.sales-menu-row:hover .sales-menu-report {
  border-color: var(--line);
  background: var(--surface);
  color: var(--primary);
}

.sales-menu-report:hover {
  border-color: var(--primary) !important;
}

.sales-menu-more {
  min-height: 30px;
  padding: 0 10px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
}

.sales-menu-more:hover {
  color: var(--primary);
}

/* ---------- 提示 ---------- */

.toast {
  top: calc(var(--topbar-height) + 12px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 9px 16px;
  border-radius: var(--r-control);
  background: #273142;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  box-shadow: var(--shadow-pop);
}

/* ---------- 登录 ---------- */

.login-screen {
  background: var(--bg);
}

.login-card {
  width: min(380px, 100%);
  gap: 16px;
  padding: 32px 28px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(22, 32, 48, 0.08);
}

.login-logo {
  height: 44px;
  width: auto;
  justify-self: start;
}

.login-heading h2 {
  font-size: 18px;
  font-weight: 600;
}

.login-heading p {
  margin-top: 4px;
  font-size: 13px;
}

.login-card .field input {
  min-height: 40px;
}

.login-card .button,
.login-submit {
  min-height: 40px;
  margin-top: 4px;
  font-size: 14px;
}

.login-hint {
  display: none;
}

/* ---------- 空状态 ---------- */

.empty {
  padding: 40px 16px;
  color: var(--text-3);
}

/* ---------- 列表页通用结构 ---------- */

.toolbar {
  gap: 8px;
}

.toolbar-left,
.toolbar-right {
  gap: 8px;
}

.inline-check {
  min-height: var(--h-control);
  gap: 6px;
  padding: 0 4px;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

/* 字段设置按钮：统一为图标 */
.icon-button[title="字段设置"] {
  width: var(--h-control);
  min-width: var(--h-control);
  padding: 0;
  font-size: 0;
  color: var(--text-2);
}

.icon-button[title="字段设置"]::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.icon-button[title="字段设置"]:hover {
  color: var(--primary);
}

/* 资料类页面：左侧分类 + 右侧单卡片（筛选、表格、分页） */
.reference-master-layout {
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.reference-master-layout.no-tree {
  grid-template-columns: minmax(0, 1fr);
}

.reference-master-layout > div:last-child {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
}

.reference-master-layout > div:last-child > .reference-filter-row,
.reference-master-layout > div:last-child > .table-panel,
.reference-master-layout > div:last-child > .sales-pager,
.reference-master-layout > div:last-child > section,
.reference-master-layout > div:last-child > form {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.reference-master-layout > div:last-child > .reference-filter-row {
  border-bottom: 1px solid var(--line-soft);
}

.reference-master-layout > div:last-child > .sales-pager {
  border-top: 1px solid var(--line-soft);
}

.reference-master-layout .table-header {
  display: none;
}

.reference-filter-row {
  gap: 10px 16px;
  margin: 0 0 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.reference-filter-row label {
  gap: 8px;
  color: var(--text-2);
}

.reference-filter-row input {
  min-width: 168px;
  min-height: var(--h-control);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
}

.reference-category-tree {
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.category-tree-head {
  min-height: 32px;
  margin: 0 0 4px;
  padding: 0 8px;
  color: var(--text);
}

.category-tree-head strong {
  font-size: 13px;
  font-weight: 600;
}

.category-node {
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--r-control);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}

.category-node:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.category-node.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}

.master-thumb,
.master-thumb-placeholder {
  width: 30px;
  height: 30px;
  border-color: var(--line);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

/* 独立的表格卡片与紧随其后的分页合并为一体 */
.table-panel + .sales-pager {
  margin-top: -13px;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--r-card) var(--r-card);
  background: var(--surface);
}

.table-panel:has(+ .sales-pager) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ---------- 单据录入页（销售 / 进货 / 库存 / 财务） ---------- */

.sales-form-shell,
.document-form-shell,
.inventory-document-sheet,
.customer-store-shell {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.sales-form-topbar {
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.sales-action-group {
  gap: 8px;
}

.sales-bill-title,
.inventory-form-title strong {
  min-width: 0;
  margin-right: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.mini-color-block {
  display: none;
}

.sales-price-mode {
  margin-left: 8px;
  color: var(--text-3);
}

.radio-pill {
  color: var(--text-2);
}

/* 输入组：前缀标签 + 输入框，统一 32px */
.sales-basic-grid label:not(.sales-delivery),
.sales-settle-row label:not(.discount-type):not(.print-check),
.sales-remark-row label:not(.print-check),
.sales-delivery-panel label,
.sales-settlement-form label,
.document-basic-grid label,
.cashier-checkout-form label,
.customer-store-shell label,
.inventory-basic-grid label,
.inventory-pack-document-meta label,
.inventory-footer-fields label,
.purchase-detail-basic label,
.purchase-detail-footer label,
.sales-list-filter label {
  min-height: var(--h-control);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  overflow: hidden;
}

.sales-basic-grid label:not(.sales-delivery):focus-within,
.sales-settle-row label:not(.discount-type):not(.print-check):focus-within,
.sales-remark-row label:not(.print-check):focus-within,
.sales-delivery-panel label:focus-within,
.sales-settlement-form label:focus-within,
.document-basic-grid label:focus-within,
.cashier-checkout-form label:focus-within,
.customer-store-shell label:focus-within,
.inventory-basic-grid label:focus-within,
.inventory-pack-document-meta label:focus-within,
.inventory-footer-fields label:focus-within,
.purchase-detail-basic label:focus-within,
.purchase-detail-footer label:focus-within,
.sales-list-filter label:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.sales-basic-grid label:not(.sales-delivery) > span,
.sales-settle-row label:not(.discount-type):not(.print-check) > span,
.sales-remark-row label:not(.print-check) > span,
.sales-delivery-panel label > span,
.sales-settlement-form label > span,
.document-basic-grid label > span,
.cashier-checkout-form label > span,
.customer-store-shell label > span,
.inventory-basic-grid label > span,
.inventory-pack-document-meta label > span,
.inventory-footer-fields label > span,
.purchase-detail-basic label > span,
.purchase-detail-footer label > span,
.sales-list-filter label > span {
  min-height: calc(var(--h-control) - 2px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.sales-basic-grid label:not(.sales-delivery) :is(input, select, textarea),
.sales-settle-row label:not(.discount-type):not(.print-check) :is(input, select),
.sales-remark-row label:not(.print-check) :is(input, select),
.sales-delivery-panel label :is(input, select),
.sales-settlement-form label :is(input, select, textarea),
.document-basic-grid label :is(input, select, textarea),
.cashier-checkout-form label :is(input, select),
.customer-store-shell label :is(input, select),
.inventory-basic-grid label :is(input, select),
.inventory-pack-document-meta label :is(input, select),
.inventory-footer-fields label :is(input, select),
.purchase-detail-basic label :is(input, select, textarea),
.purchase-detail-footer label :is(input, select),
.sales-list-filter label :is(input, select) {
  min-height: calc(var(--h-control) - 2px);
  height: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: transparent;
}

.sales-basic-grid label :is(input, select):focus,
.sales-settle-row label :is(input, select):focus,
.sales-remark-row label :is(input, select):focus,
.sales-delivery-panel label :is(input, select):focus,
.sales-settlement-form label :is(input, select, textarea):focus,
.document-basic-grid label :is(input, select, textarea):focus,
.cashier-checkout-form label :is(input, select):focus,
.customer-store-shell label :is(input, select):focus,
.inventory-basic-grid label :is(input, select):focus,
.inventory-pack-document-meta label :is(input, select):focus,
.inventory-footer-fields label :is(input, select):focus,
.purchase-detail-basic label :is(input, select, textarea):focus,
.purchase-detail-footer label :is(input, select):focus {
  box-shadow: none;
}

.sales-basic-grid {
  grid-template-columns: minmax(300px, 2.2fr) auto minmax(200px, 1fr) minmax(220px, 1fr);
  gap: 8px;
  padding: 0 0 12px;
}

.sales-basic-grid .sales-delivery {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.sales-remark-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(160px, 220px);
  gap: 12px;
  min-height: 0;
}

.sales-mini-actions {
  min-height: var(--h-control);
}

.sales-mini-actions .ghost-button {
  min-height: var(--h-control);
}

.sales-delivery {
  gap: 10px;
  min-height: var(--h-control);
}

.invoice-check {
  color: var(--text-2) !important;
}

.mini-green {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
}

.mini-green:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sales-expand-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 400;
}

input[type="checkbox"] {
  width: 15px;
  height: 15px;
}

/* 录入表格 */
.sales-table-wrap,
.purchase-detail-grid-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}

.sales-entry-table th,
.sales-entry-table td,
.purchase-detail-grid th,
.purchase-detail-grid td,
.inventory-entry-grid th,
.inventory-entry-grid td {
  height: 38px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.sales-entry-table th,
.purchase-detail-grid th,
.inventory-entry-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  border-bottom-color: var(--line);
}

.sales-entry-table th:last-child,
.sales-entry-table td:last-child,
.purchase-detail-grid th:last-child,
.purchase-detail-grid td:last-child,
.inventory-entry-grid th:last-child,
.inventory-entry-grid td:last-child {
  border-right: 0;
}

.sales-entry-table input,
.purchase-detail-grid input,
.inventory-entry-grid input {
  height: 37px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
}

.sales-entry-table input:focus,
.purchase-detail-grid input:focus,
.inventory-entry-grid input:focus {
  background: var(--primary-soft);
}

.sales-entry-table input:disabled {
  background: transparent;
  color: var(--text);
}

/* 空行里重复表头的占位文字只保留“商品”搜索提示 */
.sales-entry-table input:not(.sales-line-goods)::placeholder,
.purchase-detail-grid input:not(.purchase-detail-name)::placeholder,
.inventory-entry-grid input:not([data-inventory-product-input])::placeholder {
  color: transparent;
}

.sales-entry-table tbody tr:hover > td {
  background: var(--bg-subtle);
}

.line-index,
.sales-entry-table td:first-child {
  color: var(--text-3);
  text-align: center;
}

.line-tools {
  white-space: nowrap;
  text-align: center;
}

.line-tools button,
[data-document-line-add],
[data-document-line-remove] {
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin: 0 2px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-3);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
}

.line-tools button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.line-tools button:last-child:hover,
.line-tools button[data-sales-line-remove]:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.sales-product-field {
  gap: 0;
}

.sales-product-trigger {
  min-height: 26px;
  margin-right: 6px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
}

.sales-product-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sales-total-label,
.sales-total-number {
  color: var(--text-2);
  font-weight: 500;
}

/* 结算区 */
.sales-bottom-panel {
  gap: 10px;
  margin-top: 12px;
}

.sales-settle-row {
  gap: 8px;
}

.discount-type {
  min-height: var(--h-control);
  border: 1px solid var(--line-strong) !important;
  border-radius: var(--r-control);
  overflow: hidden;
}

.discount-type select,
.discount-type input {
  min-height: calc(var(--h-control) - 2px) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.discount-type button {
  min-height: calc(var(--h-control) - 2px);
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--primary);
  font-weight: 400;
}

.sales-summary-strip {
  gap: 16px;
  color: var(--text-2);
}

.sales-summary-strip b {
  color: var(--text);
  font-weight: 600;
}

.print-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--h-control);
  border: 0 !important;
  background: transparent !important;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.print-check input[type="checkbox"] {
  width: 15px !important;
  height: 15px !important;
  min-height: 0 !important;
}

.sales-remark-row .sales-save-bottom {
  width: 100%;
  min-width: 0;
}

/* 有“保存并审核”时，两个保存按钮并排放在行尾 */
.sales-remark-row:has([data-sales-save-audit]) {
  grid-template-columns: minmax(0, 1fr) auto minmax(120px, 160px) minmax(120px, 160px);
}

.sales-remark-row.without-print:has([data-sales-save-audit]) {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 160px) minmax(120px, 160px);
}

@media (max-width: 900px) {
  .sales-remark-row:has([data-sales-save-audit]),
  .sales-remark-row.without-print:has([data-sales-save-audit]) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .sales-remark-row:has([data-sales-save-audit]) > label {
    grid-column: 1 / -1;
  }
}

.sales-save-bottom,
.inventory-bottom-save {
  min-height: 36px;
  min-width: 140px;
  font-size: 14px;
}

.sales-upload-row,
.inventory-upload-block {
  color: var(--text-3);
  font-size: 12px;
}

.upload-box,
.upload-tile,
.picker-upload-tile {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
  color: var(--text-3);
  font-weight: 400;
}

.upload-box:hover,
.upload-tile:hover,
.picker-upload-tile:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- 模块页签：统一放在页面顶部，作为二级导航 ---------- */

.view > .feature-tabs,
.system-page > .feature-tabs,
.print-template-page > .feature-tabs,
.invoice-page > .feature-tabs {
  order: -2;
}

.view > .settings-tip {
  order: -1;
}

.print-template-page,
.invoice-page {
  display: grid;
  gap: 12px;
}

.feature-tabs {
  display: flex;
  width: 100%;
  gap: 2px;
  padding: 0 4px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  overflow-x: auto;
  scrollbar-width: none;
}

.feature-tabs::-webkit-scrollbar {
  display: none;
}

.feature-tabs .tab-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 0;
  background: transparent;
  color: var(--text-2);
  box-shadow: none;
}

.feature-tabs .tab-button:hover {
  color: var(--primary);
}

.feature-tabs .tab-button.active {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.feature-tabs.detail-modes {
  width: auto;
  justify-self: start;
  padding: 3px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--bg-muted);
}

.feature-tabs.detail-modes .tab-button {
  min-height: 28px;
  border-radius: 4px;
}

.feature-tabs.detail-modes .tab-button.active {
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(22, 32, 48, 0.08);
}

.settings-tip {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--warning-line);
  border-radius: var(--r-control);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
}

/* ---------- 工具栏中的筛选控件 ---------- */

.toolbar .filter-input,
.toolbar select.filter-input {
  width: auto;
  min-width: 160px;
  max-width: 260px;
  flex: 0 1 auto;
}

.toolbar .filter-input.compact-date {
  min-width: 132px;
  max-width: 150px;
}

.toolbar-summary {
  margin-left: 4px;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-range i {
  color: var(--text-3);
  font-style: normal;
}

.segmented {
  display: inline-flex;
}

.segmented .ghost-button {
  border-radius: 0;
  margin-left: -1px;
}

.segmented .ghost-button:first-child {
  margin-left: 0;
  border-radius: var(--r-control) 0 0 var(--r-control);
}

.segmented .ghost-button:last-child {
  border-radius: 0 var(--r-control) var(--r-control) 0;
}

.active-soft,
.ghost-button.active-soft {
  position: relative;
  z-index: 1;
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.report-filter-toolbar {
  justify-content: space-between;
}

.report-kpi-grid {
  gap: 12px;
}

/* 行内“更多”操作菜单 */
.row-more {
  position: relative;
  display: inline-flex;
}

.row-actions .row-more-toggle {
  display: inline-flex;
  align-items: center;
  color: var(--text-2);
}

.row-actions .row-more-toggle::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
}

.row-more.open .row-more-toggle {
  background: var(--bg-muted);
  color: var(--text);
}

.row-more-menu {
  position: fixed;
  z-index: 40;
  display: none;
  min-width: 112px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.row-more.open .row-more-menu {
  display: grid;
}

.row-actions .row-more-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  color: var(--text);
  text-align: left;
}

.row-actions .row-more-menu button:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.row-actions .row-more-menu button[data-feature-delete],
.row-actions .row-more-menu button[data-feature-void] {
  color: var(--danger);
}

/* ---------- 销售 / 进货历史单据列表 ---------- */

.sales-report-shell,
.document-form-shell {
  border-radius: var(--r-card);
}

.sales-order-list-shell,
.sales-list-shell {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13px;
  overflow: visible;
}

.sales-order-list-shell .sales-report-tabs,
.sales-list-shell .sales-report-tabs {
  height: auto;
  margin: 0 0 12px;
  padding: 0 4px;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.sales-order-list-shell .sales-report-tabs button,
.sales-list-shell .sales-report-tabs button {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
  box-shadow: none;
}

.sales-order-list-shell .sales-report-tabs button.active,
.sales-list-shell .sales-report-tabs button.active {
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--primary);
}

.sales-list-card {
  padding: 12px 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}


.sales-order-list-shell .sales-list-toolbar {
  min-height: 0;
  padding: 0 0 12px;
}

.sales-new-button {
  min-height: var(--h-control);
  border-radius: var(--r-control);
  background: var(--primary);
  border-color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

.sales-toolbar-button,
.sales-search-button,
.sales-export-button,
.sales-statement-button {
  min-height: var(--h-control);
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.sales-statement-button::before {
  display: none;
}

.sales-statement-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sales-filter-input,
.sales-filter-select {
  height: var(--h-control);
  min-height: var(--h-control);
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  font-size: 13px;
}

.sales-filter-expand,
.sales-filter-expand span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 400;
}

.sales-field-button {
  width: var(--h-control);
  min-width: var(--h-control);
  height: var(--h-control);
  min-height: var(--h-control);
  border-radius: var(--r-control);
}

.sales-order-list-shell .table-wrap {
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r-control) var(--r-control) 0 0;
}

.sales-order-list-shell th,
.sales-order-list-shell td {
  height: 40px;
  border-right: 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 13px;
}

.sales-order-list-shell th {
  height: 38px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  border-bottom-color: var(--line);
}

.sales-order-list-shell th:not(:first-child):not(:has(.sales-sort-header))::after {
  color: var(--text-4);
}

.sales-red-text,
.sales-pay-warning {
  color: var(--danger) !important;
}

.sales-total-title {
  color: var(--text-2);
  font-weight: 600;
}

.sales-list-total-row {
  background: var(--bg-subtle);
  color: var(--text);
}

.sales-list-total-row strong {
  font-weight: 600;
}

/* ---------- 弹窗与详情层标题栏：统一为白底 ---------- */

.sales-settlement-modal .modal-header,
.sales-share-modal .modal-header,
.sales-import-modal .modal-header,
.sales-template-modal .modal-header,
.staff-editor-modal .modal-header,
.sales-template-add-layer header,
.staff-help-head,
.sales-detail-titlebar,
.purchase-detail-titlebar,
.purchase-picker-titlebar,
.inventory-detail-layer .sales-detail-titlebar {
  min-height: 52px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--text);
}

.sales-settlement-modal .modal-header h2,
.sales-share-modal .modal-header h2,
.sales-import-modal .modal-header h2,
.sales-template-modal .modal-header h2,
.staff-editor-modal .modal-header h2,
.sales-detail-titlebar strong,
.purchase-detail-titlebar strong,
.purchase-picker-titlebar strong,
.sales-template-add-layer header strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.sales-settlement-modal .modal-header .muted,
.sales-share-modal .modal-header .muted,
.sales-import-modal .modal-header .eyebrow,
.sales-template-modal .modal-header .eyebrow {
  color: var(--text-3);
}

.staff-editor-modal .modal-header .icon-button,
.sales-import-modal .modal-header .icon-button,
.sales-template-modal .modal-header .icon-button,
.sales-settlement-modal .modal-header .icon-button,
.sales-share-modal .modal-header .icon-button,
.purchase-picker-close,
.sales-detail-close,
.sales-template-add-layer header button {
  border: 0;
  background: transparent;
  color: var(--text-3);
}

.purchase-picker-close:hover,
.sales-detail-close:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.modal.staff-editor-modal {
  border-radius: 10px;
}

.purchase-detail-layer,
.inventory-detail-layer {
  background: var(--bg);
}

/* 选择商品弹窗：补齐“销售单价”列宽，避免与进货价重叠 */
.purchase-picker-table .purchase-picker-col-salePrice {
  width: 110px;
}

.purchase-picker-table th,
.product-picker-table th,
.picker-field-table th,
.sales-template-table th {
  background: var(--bg-subtle);
  color: var(--text-2);
  font-weight: 500;
}

/* ---------- 各模块细节 ---------- */

/* 行内“增加 / 删除行”按钮 */
.line-actions {
  gap: 4px;
}

.line-actions button,
.line-actions button:first-child,
.line-actions button:last-child {
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
}

.line-actions button:first-child:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.line-actions button:last-child:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* 库存单据 */
.inventory-document-sheet {
  min-height: 0;
  padding: 60px 16px 16px;
  font-size: 13px;
}

.inventory-new-actions,
.inventory-detail-top-actions {
  top: 14px;
  right: 16px;
  gap: 8px;
  min-height: 0;
  padding: 0;
  background: transparent;
}

.inventory-detail-top-actions .button,
.inventory-detail-top-actions .ghost-button,
.inventory-new-actions .button,
.inventory-new-actions .ghost-button {
  min-width: 0;
  height: var(--h-control);
  border-radius: var(--r-control);
}

.inventory-form-toolbar {
  gap: 8px;
}

.inventory-status-button {
  height: 26px;
  padding: 0 10px;
  border-color: var(--line);
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-2);
}

.inventory-status-button.approved {
  border-color: var(--success-line);
  background: var(--success-soft);
  color: var(--success);
}

/* 零售收银 */
.cashier-shell {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg-subtle);
}

.cashier-titlebar {
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.cashier-titlebar > strong {
  font-size: 15px;
  font-weight: 600;
}

.cashier-titlebar .ghost-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

/* 应收 / 应付欠款汇总 */
.arrears-summary-band {
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
}

.arrears-summary-band div {
  min-width: 140px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--bg-subtle);
}

.arrears-summary-band .arrears-total {
  border: 0;
  background: var(--primary-soft);
}

.arrears-summary-band .arrears-total strong {
  color: var(--primary);
}

.arrears-summary-band span {
  color: var(--text-3);
}

.arrears-summary-band strong {
  font-size: 18px;
  font-weight: 600;
}

.arrears-summary-band b {
  color: var(--text-4);
  font-weight: 400;
}

.arrears-toolbar {
  padding: 0;
}

.mini-select-label {
  grid-template-columns: auto 120px;
  min-height: var(--h-control);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  overflow: hidden;
}

.mini-select-label span {
  min-height: calc(var(--h-control) - 2px);
  padding: 0 10px;
  border-right: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}

.mini-select-label select {
  min-height: calc(var(--h-control) - 2px);
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
}

/* 系统参数：标准表单行 */
.system-setting-row {
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  border: 0;
}

.system-setting-row > span {
  min-height: var(--h-control);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 400;
}

.system-setting-row > input,
.system-setting-row > select,
.system-setting-row > textarea {
  min-height: var(--h-control);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
}

.system-setting-row > input:focus,
.system-setting-row > select:focus,
.system-setting-row > textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ---------- 首页 ---------- */

.home-page {
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  color: var(--text);
}

.home-main,
.home-side {
  gap: 12px;
}

.home-side {
  padding-left: 0;
  align-content: start;
}

.home-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
}

.home-card-title {
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.home-sales-cards {
  height: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  background: transparent;
}

.home-sales-card {
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease;
}

.home-sales-card:last-child {
  border-right: 1px solid var(--line);
}

.home-sales-card:hover {
  border-color: var(--primary-line);
}

.home-sales-card em {
  color: var(--text-3);
  font-size: 13px;
}

.home-sales-card strong {
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.quick-operation {
  display: block;
  min-height: 0;
}

.home-quick-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  padding: 12px;
}

.home-quick {
  min-height: 92px;
  gap: 10px;
  border: 0;
  border-radius: var(--r-card);
  background: transparent;
  color: var(--text);
  transition: background 120ms ease;
}

.home-quick:hover {
  background: var(--bg-subtle);
}

.home-quick i,
.home-quick.sale i,
.home-quick.purchase i,
.home-quick.stock i,
.home-quick.product i,
.home-quick.customer i,
.home-quick.supplier i,
.home-quick.receivable i,
.home-quick.payable i {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.home-quick:hover i {
  background: var(--primary);
  color: #fff;
}

.home-quick i svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-quick span {
  font-size: 13px;
}

.nums-card .nums-overview {
  min-height: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 14px 8px;
}

.home-num {
  min-height: 56px;
  gap: 6px;
  border-right: 1px solid var(--line-soft);
  border-radius: 0;
  cursor: pointer;
}

.home-num:last-child {
  border-right: 0;
}

.home-num:hover strong {
  color: var(--primary);
}

.home-num strong {
  min-height: 0;
  color: var(--text);
  white-space: nowrap;
  font-size: 17px;
  font-weight: 600;
}

.home-num span {
  color: var(--text-3);
  font-size: 12px;
}

.home-bottom-grid {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 12px;
}

.data-overview,
.asset-card {
  min-height: 0;
}

.overview-chart {
  gap: 16px;
  padding: 20px 20px 22px;
}

.overview-row {
  grid-template-columns: 64px minmax(0, 1fr) 96px;
  gap: 12px;
  color: var(--text-2);
}

.overview-row div {
  height: 8px;
  background: var(--bg-muted);
}

.overview-row i.tone-primary { background: var(--primary); }
.overview-row i.tone-success { background: var(--success); }
.overview-row i.tone-warning { background: var(--warning); }
.overview-row i.tone-danger { background: var(--danger); }

.overview-row strong {
  color: var(--text);
  font-weight: 500;
}

.asset-total {
  gap: 4px;
  padding: 16px 20px 6px;
}

.asset-total span {
  display: grid;
  gap: 2px;
  color: var(--text-2);
}

.asset-total em {
  margin: 0;
  color: var(--text-3);
}

.asset-total strong {
  font-size: 22px;
  font-weight: 600;
}

.asset-list {
  column-gap: 20px;
  padding: 4px 20px 14px;
}

.asset-line {
  min-height: 40px;
  border-bottom-color: var(--line-soft);
}

.asset-line span {
  color: var(--text-3);
}

.side-card {
  min-height: 0;
}

.side-card p {
  padding: 12px 16px 14px;
  color: var(--text-2);
  line-height: 1.6;
}

.side-links {
  display: grid;
  padding: 6px;
}

.side-link {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.side-link span {
  color: var(--text);
  font-size: 13px;
}

.side-link small {
  color: var(--text-3);
  font-size: 12px;
}

.side-link:hover {
  background: var(--bg-subtle);
}

.side-link:hover span {
  color: var(--primary);
}

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

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

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

@media (max-width: 1100px) {
  .sales-basic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-basic-grid .sales-mini-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .reference-master-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .home-sales-cards,
  .home-bottom-grid,
  .home-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .nums-card .nums-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 10px;
  }
}

/* ---------- 响应式 ---------- */

@media (min-width: 761px) and (max-width: 900px) {
  :root {
    --sidebar-width: 60px;
  }

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand-logo {
    max-width: 44px;
    height: 22px;
    object-fit: contain;
    object-position: left center;
  }

  .brand-erp-badge,
  .nav-item > span:not(.nav-icon),
  .expire-text,
  .top-link span,
  .top-user-name {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
    gap: 0;
  }

  .view {
    padding: 12px;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    height: 48px;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .brand-logo {
    height: 26px;
    max-width: 96px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    padding: 4px 6px 6px;
  }

  .nav-item,
  body.nav-collapsed .nav-item {
    min-height: 50px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 0;
    font-size: 12px;
  }

  .nav-item > span:not(.nav-icon),
  body.nav-collapsed .nav-item > span:not(.nav-icon) {
    display: block;
  }

  .nav-item.active::before {
    display: none;
  }

  .workspace,
  body.nav-collapsed .workspace {
    margin-left: 0;
  }

  .topbar {
    position: static;
    height: auto;
    min-height: var(--topbar-height);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 4px 8px;
  }

  .topbar-left,
  .topbar-actions {
    height: auto;
    flex-direction: row;
  }

  .expire-text,
  .top-link span,
  .top-user-name {
    display: none;
  }

  .work-tabs {
    position: static;
  }

  .work-tab-nav {
    display: none;
  }

  .sales-menu-popover,
  .module-menu-popover.wide {
    left: 8px;
    right: 8px;
    width: auto;
  }

  .module-menu-shield {
    inset: 0;
  }

  .view {
    padding: 10px;
  }

  .toolbar,
  .toolbar-left,
  .toolbar-right {
    width: 100%;
  }

  .toolbar .filter-input,
  .toolbar select.filter-input {
    flex: 1 1 140px;
    max-width: none;
  }

  .sales-basic-grid,
  .sales-remark-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

/* ---------- 业务流程：单据状态标签、首页待办、门店收货回执 ---------- */
.flow-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}

.flow-tag.tone-info { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary); }
.flow-tag.tone-success { border-color: var(--success-line); background: var(--success-soft); color: var(--success); }
.flow-tag.tone-warning { border-color: var(--warning-line); background: var(--warning-soft); color: var(--warning); }
.flow-tag.tone-danger { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }

.todo-list {
  display: grid;
  gap: 2px;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.todo-item:hover { background: var(--bg-subtle); color: var(--text); }
.todo-item b { color: var(--text-4); font-weight: 600; font-variant-numeric: tabular-nums; }
.todo-item.has-count b { min-width: 22px; padding: 1px 7px; border-radius: 10px; background: var(--warning-soft); color: var(--warning); text-align: center; }

.store-receipt-panel {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--success-line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.store-receipt-panel.has-issue { border-color: var(--danger-line); }

.store-receipt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 13px;
}

.store-receipt-head strong { color: var(--text); font-size: 14px; }
.store-receipt-head .flow-tag { margin-left: -6px; }

.store-receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.store-receipt-table th,
.store-receipt-table td {
  height: 32px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.store-receipt-table th { background: var(--bg-subtle); color: var(--text-3); font-weight: 500; }
.store-receipt-table tr.is-issue td { color: var(--danger); }
.store-receipt-note,
.store-receipt-tip { margin: 8px 0 0; color: var(--text-3); font-size: 12px; }
.store-receipt-panel.has-issue .store-receipt-tip { color: var(--danger); }

/* 销售列表的审核状态：与其他列表的状态颜色一致（待审核=橙，已审核=绿） */
.sales-audit-text.status-word { font-weight: 500; }
.sales-audit-text.status-word.pending,
.sales-audit-text.status-word.draft { color: var(--warning); }
.sales-audit-text.status-word.approved { color: var(--success); }
.sales-audit-text.status-word.warning { color: var(--text-4); }

/* ---------- 使用指引 ---------- */
.guide-page {
  display: grid;
  gap: 16px;
  max-width: 1280px;
}

.guide-head h2 { margin: 0 0 4px; font-size: 18px; color: var(--text); }
.guide-head p { margin: 0; color: var(--text-3); font-size: 13px; }

.guide-flow {
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

.guide-flow-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-bottom: 12px;
}

.guide-flow-title h3 { margin: 0; font-size: 15px; color: var(--text); }
.guide-flow-title span { color: var(--text-3); font-size: 13px; }

.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.guide-step {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-control);
  background: var(--bg-subtle);
}

.guide-step-no {
  flex: 0 0 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 24px;
  text-align: center;
}

.guide-step-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.guide-step-body strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.guide-step-body p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.guide-step-body .link-button { justify-self: start; padding: 0; font-size: 13px; }
.guide-count { padding: 1px 7px; border-radius: 10px; background: var(--warning-soft); color: var(--warning); font-size: 12px; font-style: normal; font-weight: 600; }
.guide-no-access { color: var(--text-4); font-size: 12px; }

.guide-rules dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px 20px; margin: 0; }
.guide-rules dl > div { display: grid; gap: 2px; align-content: start; }
.guide-rules dt { color: var(--text); font-size: 14px; font-weight: 600; }
.guide-rules dd { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }

/* 列数超过 15 的销售列表（如销售预定）：原来后面几列没有宽度被压成 0，状态和操作按钮看不见、点不到 */
.sales-order-list-shell th:nth-child(n+16),
.sales-order-list-shell td:nth-child(n+16) { width: 110px; }
.sales-order-list-shell th:last-child,
.sales-order-list-shell td:last-child { width: 270px; }

/* 销售类列表的“本页合计”是表格最后一行，跟表格一起滚动、按列对齐 */
.sales-order-list-shell tr:has(.sales-total-title) td {
  background: var(--bg-subtle);
  font-weight: 600;
}
.sales-order-list-shell tr:has(.sales-total-title):hover td { background: var(--bg-subtle); }

/* ---------- 菜单“更多”：默认只显示常用页 ---------- */

.module-menu-more {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--r-control) var(--r-control);
}

.module-menu-panel.wide .module-menu-more {
  grid-column: 1 / -1;
}

.module-menu-more[aria-expanded="false"]::after {
  content: "›";
  margin-left: auto;
  font-size: 14px;
}

.feature-tabs .tab-more {
  color: var(--text-3);
}

.feature-tabs .tab-more:hover {
  color: var(--primary);
}

/* 启动时先盖住页面：确认登录、读到服务端数据后才显示（以前会先闪出内置示例数据；数据大、网络慢时要等很久） */
.boot-loading {
  display: none;
}

body.booting .app-shell {
  visibility: hidden;
}

body.booting .boot-loading {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  background: #f5f7fa;
  color: #5b6b7a;
  font-size: 14px;
}

.login-submit:disabled {
  opacity: 0.75;
  cursor: progress;
}
