:root {
  --bg: #f3f7f5;
  --panel: #ffffff;
  --text: #18372e;
  --muted: #6e817a;
  --line: #dce7e2;
  --brand: #16856b;
  --brand-2: #d99a3d;
  --ok: #247a3d;
  --warn: #a66a00;
  --bad: #b3261e;
  --shadow: 0 12px 30px rgba(19,61,49,.08);
  --sidebar: #ffffff;
  --sidebar-text: #344054;
  --sidebar-muted: #7a8794;
  --sidebar-active: #e7f5f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

/* W3 business navigation, presented horizontally without changing module IDs. */
body { display:block; padding-top:76px; }
.top-navigation { position:fixed; inset:0 0 auto; z-index:80; display:flex; align-items:center; gap:18px; min-height:76px; height:auto; padding:9px 20px; overflow:visible; border:0; border-bottom:1px solid var(--line); box-shadow:0 3px 14px rgba(29,41,57,.08); }
.top-navigation .brand { flex:0 0 auto; min-height:52px; margin:0; padding:0 16px 0 0; border:0; border-right:1px solid var(--line); }
.top-navigation .brand span { display:none; }
.top-navigation .user-box { order:3; flex:0 0 auto; margin:0; padding:4px; border:0; background:transparent; }
.top-navigation .user-box span { flex:0 0 auto; max-width:120px; }
.top-navigation #nav { flex:1 1 auto; display:flex; align-items:center; gap:3px; min-width:0; overflow:visible; }
.nav-menu { position:relative; flex:0 0 auto; }
.top-navigation .nav-btn { display:flex; grid-template-columns:none; gap:7px; min-height:42px; width:auto; padding:7px 10px; white-space:nowrap; }
.top-navigation .nav-btn.active::before { inset:auto 9px 0; width:auto; height:3px; }
.top-navigation .nav-icon { width:28px; height:28px; }
.top-navigation .nav-copy small { display:none; }
.nav-caret { transition:transform .15s ease; }
.nav-menu.open .nav-caret { transform:rotate(180deg); }
.nav-dropdown { position:absolute; top:calc(100% + 8px); left:0; width:280px; max-height:min(70vh,520px); overflow:auto; padding:7px; border:1px solid var(--line); border-radius:10px; background:#fff; box-shadow:0 14px 32px rgba(29,41,57,.16); }
.nav-dropdown[hidden] { display:none; }
.nav-subitem { display:grid; gap:3px; width:100%; min-height:44px; padding:9px 11px; border:0; border-radius:7px; background:transparent; color:var(--text); text-align:left; }
.nav-subitem:hover,.nav-subitem:focus-visible { background:#f1f6f5; filter:none; outline:2px solid #9bc8c4; outline-offset:-2px; }
.nav-subitem.active { background:var(--sidebar-active); color:var(--brand); }
.nav-subitem small { color:var(--muted); font-size:11px; }
.main { max-width:none; }

@media (max-width: 1120px) {
  body { padding-top:120px; }
  .top-navigation { flex-wrap:wrap; align-content:center; }
  .top-navigation #nav { order:3; flex-basis:100%; overflow-x:auto; overflow-y:visible; padding-bottom:4px; }
  .top-navigation .user-box { margin-left:auto; }
  .top-navigation .nav-btn { min-height:38px; }
  .topbar { top:120px; }
}

@media (max-width: 640px) {
  body { padding-top:128px; }
  .top-navigation { padding:7px 10px; gap:8px; }
  .top-navigation .brand strong { font-size:13px; }
  .top-navigation .brand-mark { width:34px; height:34px; }
  .top-navigation .brand-mark img { width:32px; height:32px; }
  .top-navigation .user-box span { display:none; }
  .top-navigation .user-box button { min-height:28px; padding:4px 7px; }
  .top-navigation .nav-copy strong { font-size:13px; }
  .nav-dropdown { position:fixed; top:126px; right:8px; left:8px; width:auto; max-height:calc(100vh - 138px); }
  .topbar { top:128px; }
}

.auth-loading {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  background: #edf3f2;
  color: var(--text);
}

.auth-loading[hidden] {
  display: none;
}

.auth-loading img {
  width: 76px;
  height: 76px;
  margin-bottom: 8px;
  border-radius: 16px;
  object-fit: cover;
}

.auth-loading strong {
  font-size: 22px;
}

.auth-loading span {
  color: var(--muted);
  font-size: 14px;
}

.auth-pending .login-screen,
.auth-pending .sidebar,
.auth-pending .main {
  visibility: hidden;
}

.login-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #edf3f2;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 24px;
}

.login-card p,
.login-error {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 6px;
}

.login-card input {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.login-error {
  min-height: 20px;
  color: var(--bad);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  filter: brightness(0.95);
}

button.ghost {
  background: #eef3f3;
  color: var(--brand);
}

button.icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: #eef1f2;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  height: 100vh;
  padding: 18px 16px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  margin-bottom: 16px;
  padding: 8px 6px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.brand-mark img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand strong {
  color: #15212b;
  font-size: 15px;
  line-height: 1.25;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--sidebar-text);
  font-size: 13px;
}

.user-box span {
  flex: 1 1 100%;
  min-width: 0;
}

.user-box button {
  width: auto;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 5px;
}

.nav-btn {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
}

.nav-btn:hover {
  filter: none;
  background: #f5f8f8;
}

.nav-btn.active {
  border-color: #c8e3df;
  background: var(--sidebar-active);
  color: #0f4f4d;
}

.nav-btn.active::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  content: "";
}

.nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #edf1f2;
  color: #46545d;
  font-size: 16px;
  font-weight: 900;
}

.nav-btn.active .nav-icon {
  background: #d9eeee;
  color: var(--brand);
}

.nav-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.nav-copy strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-copy small {
  overflow: hidden;
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  color: #9fb0b5;
}

.main {
  min-width: 0;
  padding: 0 24px 28px;
}

.topbar {
  display: none !important;
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
  margin: 0 -24px 18px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

.topbar p,
.muted {
  margin-top: 5px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inventory-toolbar-actions {
  flex-wrap: nowrap;
  align-items: center;
}

.inventory-toolbar-actions button,
.inventory-toolbar-actions select {
  flex: 0 0 auto;
}

.inventory-toolbar-actions select {
  max-width: 190px;
}

.toolbar-select {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi,
.panel,
dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi {
  padding: 16px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.app-sort-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.app-sort-summary-bar span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #dce5e3;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.app-sort-summary-bar b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-sort-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.app-ops-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.app-ops-tool-card {
  min-height: 220px;
}

.app-ops-tool-card-muted {
  background: #f8faf9;
  border-style: dashed;
}

.northsea-monitor-panel {
  padding: 14px;
}

.northsea-monitor-kpis {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.northsea-monitor-kpis .kpi {
  min-height: 68px;
  padding: 10px 12px;
}

.northsea-monitor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.northsea-monitor-toolbar .module-tabs {
  margin: 0;
}

.northsea-monitor-toolbar .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.northsea-monitor-frame-wrap {
  overflow: hidden;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.northsea-monitor-frame {
  display: block;
  width: 100%;
  min-height: 1280px;
  border: 0;
  background: #fff;
}

.northsea-monitor-log {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf9;
}

.northsea-monitor-log summary {
  cursor: pointer;
  font-weight: 800;
}

.northsea-monitor-log pre {
  overflow: auto;
  max-height: 220px;
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 6px;
  background: #16211f;
  color: #dff4ee;
  font-size: 11px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .northsea-monitor-kpis {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .northsea-monitor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .northsea-monitor-toolbar .actions {
    justify-content: flex-start;
  }
}

/* Shared income-order desktop sizing: protect financial figures and keep editable columns separated. */
@media (min-width: 901px) {
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-money {
    width: 144px;
    min-width: 144px;
    max-width: 144px;
    white-space: normal;
  }

  .b2b-receivable-panel .b2b-order-list-table th[data-label="应收/应退"],
  .b2b-receivable-panel .b2b-order-list-table td[data-label="应收/应退"] {
    min-width: 146px;
    padding-right: 12px;
    white-space: nowrap;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-adjustment,
  .b2b-receivable-panel .b2b-order-list-table td[data-label="调整金额"] {
    width: 108px;
    min-width: 108px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-note,
  .b2b-receivable-panel .b2b-order-list-table td[data-label="备注"] {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
  }
}

.b2b-receivable-amount-detail,
.b2b-receivable-amount-detail strong,
.b2b-receivable-amount-detail > span {
  white-space: nowrap;
}

.b2b-note-preview {
  display: -webkit-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  line-height: 1.3;
  max-height: 5.2em;
  cursor: help;
}

.b2b-note-preview:focus { outline: 2px solid #0f766e; outline-offset: 2px; }
.b2b-note-tooltip {
  position: fixed;
  z-index: 4000;
  width: max-content;
  max-width: min(420px, calc(100vw - 16px));
  max-height: min(260px, calc(100vh - 16px));
  overflow: auto;
  padding: 9px 11px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 10px 28px rgba(15,23,42,.28);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.b2b-note-tooltip[hidden] { display: none; }

.app-sort-module-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.app-sort-module-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.app-sort-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.app-sort-card-stats span {
  min-width: 74px;
  padding: 8px 10px;
  border: 1px solid #dce5e3;
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 12px;
}

.app-sort-card-stats b {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.app-sort-label-table {
  margin-top: 12px;
}

.app-sort-summary-bar-compact {
  margin-bottom: 10px;
}

.app-sort-progress-card {
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid #cfe0dc;
  border-radius: 8px;
  background: #f7fbfa;
}

.app-sort-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.app-sort-progress-head strong {
  font-size: 14px;
}

.app-sort-progress-head span {
  color: var(--accent);
  font-weight: 800;
}

.app-sort-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce7e4;
}

.app-sort-progress-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #147a72, #2aa69a);
  transition: width 0.35s ease;
}

.app-sort-progress-card p {
  margin: 8px 0 0;
}

.app-zip-batch-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 12px;
  margin: 12px 0;
}

.app-zip-control-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.app-zip-control-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.app-zip-single-test-card {
  margin: 14px 0;
  border-color: #b9d7d3;
}

.app-zip-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.app-zip-card-heading p {
  margin: 4px 0 0;
}

.app-zip-single-test-card h4 {
  margin: 18px 0 8px;
  font-size: 14px;
  color: #215f59;
}

.app-zip-scope-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
}

.app-zip-scope-summary span {
  padding: 10px 12px;
  border-radius: 7px;
  background: #f3f8f7;
  border: 1px solid #d7e8e5;
}

.app-zip-scope-summary b {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--muted);
}

.app-zip-single-search {
  align-items: end;
  margin-top: 10px;
}

.app-zip-single-search-action {
  margin: 0;
}

.app-zip-single-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px 12px;
}

.app-zip-field-choice {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.2fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.app-zip-field-choice > span {
  font-weight: 600;
}

.app-zip-test-message {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 7px;
  background: #eef7f5;
  color: #205f58;
}

.app-zip-test-message.warning {
  background: #fff7e7;
  color: #805b12;
}

.app-zip-test-message.error {
  background: #fff0f0;
  color: #a12b2b;
}

.app-zip-test-message.success {
  background: #eaf7ee;
  color: #23673a;
}

.app-zip-test-message ul {
  margin: 8px 0 0 20px;
}

.app-zip-compare-table th:first-child {
  min-width: 150px;
}

.app-zip-section-divider {
  margin: 18px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.app-zip-section-divider h3,
.app-zip-section-divider p {
  margin: 0 0 4px;
}

@media (max-width: 1100px) {
  .app-sort-module-grid {
    grid-template-columns: 1fr;
  }
  .app-zip-batch-grid {
    grid-template-columns: 1fr;
  }
  .app-zip-scope-summary,
  .app-zip-single-fields {
    grid-template-columns: 1fr;
  }
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  overflow: hidden;
}

.panel header,
dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.panel h3 {
  font-size: 16px;
}

.panel-body {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 760px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
  overflow-x: auto;
}

.summary-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.summary-chip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.summary-chip b {
  font-size: 13px;
  font-weight: 800;
}

.summary-chip.strong {
  border-color: #b9d4cf;
  background: #eef7f5;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f9fbfb;
}

tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-actions button {
  padding: 6px 10px;
}

.table-actions .icon-action {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.table-actions .icon-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-actions .text-action {
  min-width: 58px;
  padding: 6px 8px;
  font-size: 12px;
}

.table-actions .danger-action {
  color: var(--bad);
  background: #fde7e4;
}

.table-actions .save-action {
  color: #fff;
  background: var(--ok);
}

button.global-action-busy,
button.global-action-busy:hover,
input.global-action-busy,
input.global-action-busy:hover {
  cursor: wait;
  border-color: #cbd5e1;
  background: #cbd5e1;
  color: #64748b;
  opacity: 0.9;
  box-shadow: none;
  pointer-events: none;
}

button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled {
  cursor: not-allowed;
  border-color: #cbd5e1;
  background: #cbd5e1;
  color: #64748b;
  opacity: 0.82;
  box-shadow: none;
  pointer-events: none;
}

button[aria-busy="true"],
input[aria-busy="true"] {
  cursor: wait;
}

.module-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.module-tabs button {
  min-height: 46px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.module-tabs button.active {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.42);
  background: rgba(20, 184, 166, 0.1);
  box-shadow: inset 0 -3px 0 rgba(15, 118, 110, 0.55);
}

.b2b-upload-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
}

.b2b-upload-grid .full {
  grid-column: 1 / -1;
}

.b2b-upload-grid textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  font-family: inherit;
}

.raw-sales-table-wrap {
  overflow-x: auto;
}

.raw-sales-table {
  min-width: 1500px;
}

.raw-sales-settings-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 72px;
  background: #fff;
}

.raw-column-settings {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.raw-column-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.raw-column-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.raw-column-item label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.file-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.file-actions a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.file-actions a:hover {
  text-decoration: underline;
}

.finance-doc-stack,
.finance-delivery-notes {
  display: grid;
  gap: 4px;
}

.finance-doc-stack small,
.finance-delivery-notes small {
  color: var(--muted);
  font-weight: 800;
}

.finance-delivery-notes a {
  max-width: 180px;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.finance-inline-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.finance-inline-upload {
  display: grid;
  min-width: 74px;
  min-height: 42px;
  padding: 5px 8px;
  border: 1px dashed #8fb5b0;
  border-radius: 7px;
  color: #0f5f58;
  background: #f4fbfa;
  text-align: center;
  cursor: pointer;
}

.finance-inline-upload span {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.finance-inline-upload small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.finance-inline-upload:hover,
.finance-inline-upload.dragging {
  border-color: #167f73;
  background: #e9f8f6;
}

.finance-entry-form-row > td {
  padding: 0;
  background: #f8fbfb;
}

.finance-entry-form-row .finance-request-form,
.finance-entry-inline-form .finance-request-form {
  margin: 10px;
  border: 1px solid #cfe1df;
  box-shadow: none;
}

.finance-todo-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.finance-todo-preview button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.finance-todo-preview button.has-work {
  border-color: #d6a83b;
  background: #fff8e8;
}

.finance-todo-preview strong {
  font-size: 18px;
}

.finance-due-rule-checks.is-disabled {
  opacity: 0.55;
}

.finance-due-rule-checks.is-disabled label {
  cursor: not-allowed;
}

.finance-cost-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.finance-cost-toolbar label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  margin: 0;
  font-weight: 800;
}

.finance-cost-toolbar output {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 900;
}

.finance-cost-entry-wrap {
  overflow-x: auto;
}

.finance-cost-entry-table {
  min-width: 760px;
  table-layout: fixed;
}

.finance-cost-entry-table th,
.finance-cost-entry-table td {
  padding: 5px 6px;
}

.finance-cost-entry-table input {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
}

.finance-cost-entry-table th:nth-child(1),
.finance-cost-entry-table td:nth-child(1) {
  width: 158px;
  min-width: 158px;
}

.finance-cost-entry-table input[data-finance-cost-field="cashDate"] {
  box-sizing: border-box;
  padding-left: 10px;
  padding-right: 50px;
  letter-spacing: 0;
}

.finance-cost-entry-table th:nth-child(2),
.finance-cost-entry-table td:nth-child(2) {
  width: 120px;
}

.finance-cost-entry-table th:nth-child(3),
.finance-cost-entry-table td:nth-child(3) {
  width: 220px;
}

.finance-cost-entry-table th:nth-child(4),
.finance-cost-entry-table td:nth-child(4) {
  width: 120px;
}

.finance-cost-history-table {
  min-width: 760px;
}

.finance-cash-cost-workspace > header {
  padding: 10px 14px;
}

.finance-cash-cost-workspace > header h3 {
  margin: 0;
}

.finance-cash-cost-workspace > header .muted {
  margin-top: 2px;
}

.finance-cash-cost-workspace > .panel-body {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
}

.finance-cash-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  margin: 0;
}

.finance-cash-summary-grid .kpi {
  min-height: 58px;
  padding: 8px 10px;
  box-shadow: none;
}

.finance-cash-summary-grid .kpi span {
  font-size: 12px;
}

.finance-cash-summary-grid .kpi strong {
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.15;
}

.finance-cash-summary-grid .finance-cash-balance-kpi {
  min-height: 92px;
}

.finance-cash-denomination-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.finance-cash-denomination-mini > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid #d9e5e1;
  border-radius: 7px;
  background: #f5faf8;
  font-variant-numeric: tabular-nums;
}

.finance-cash-denomination-mini > div:last-child {
  border-color: #eadcb9;
  background: #fffaf0;
}

.finance-cash-denomination-mini span {
  font-size: 11px;
  font-weight: 700;
}

.finance-cash-denomination-mini b {
  color: #21302b;
  font-size: 12px;
  white-space: nowrap;
}

.finance-cash-cost-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.finance-cash-cost-layout .sub-panel {
  box-shadow: none;
}

.finance-cash-cost-layout .sub-panel > header {
  min-height: 0;
  padding: 8px 12px;
}

.finance-cash-cost-layout .sub-panel > header h3 {
  font-size: 16px;
}

.finance-cash-cost-layout .sub-panel > header .muted {
  margin-top: 2px;
}

.finance-cash-cost-layout .finance-cost-toolbar {
  gap: 7px;
  padding: 8px 10px;
}

.finance-cash-cost-layout .finance-cost-toolbar label {
  min-width: 128px;
  gap: 3px;
}

.finance-cash-cost-layout .finance-cost-toolbar input,
.finance-cash-cost-layout .finance-cost-toolbar select {
  min-height: 32px;
  padding: 5px 8px;
}

.finance-cash-entry {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbfa 0%, #fff 100%);
}

.finance-cash-primary-row {
  display: grid;
  grid-template-columns: minmax(145px, 0.9fr) repeat(2, minmax(130px, 1fr)) auto;
  gap: 8px;
  align-items: stretch;
}

.finance-cash-primary-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #cfded9;
  border-radius: 10px;
  background: #fff;
}

.finance-cash-primary-field > span {
  color: #53645f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.finance-cash-primary-field input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 5px 8px;
  border-color: transparent;
  background: transparent;
  color: #17211e;
  font-size: 18px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.finance-cash-primary-field input:focus {
  border-color: var(--brand);
  background: #fff;
}

.finance-cash-money-field.banknote {
  border-color: #b9d9c9;
  background: #f1faf5;
}

.finance-cash-money-field.coin {
  border-color: #e2d1a4;
  background: #fff9e9;
}

.finance-cash-entry-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.finance-cash-source-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(78px, 1fr));
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid #e0e7e4;
  border-radius: 9px;
  background: #f4f7f6;
}

.finance-cash-source-row label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
  color: #475650;
  font-size: 12px;
  font-weight: 750;
}

.finance-cash-source-row input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 6px;
  text-align: right;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.finance-cash-cost-layout .finance-cost-entry-table th,
.finance-cash-cost-layout .finance-cost-entry-table td,
.finance-cash-cost-layout .finance-cost-history-table th,
.finance-cash-cost-layout .finance-cost-history-table td {
  padding: 4px 6px;
}

.finance-cash-cost-layout .finance-cost-entry-table input,
.finance-cash-cost-layout .finance-cost-entry-table select {
  width: 100%;
  min-height: 30px;
  padding: 4px 7px;
}

.finance-cost-entry-table th:nth-child(4),
.finance-cost-entry-table td:nth-child(4),
.finance-cost-entry-table th:nth-child(5),
.finance-cost-entry-table td:nth-child(5) {
  width: 140px;
  min-width: 140px;
}

.finance-cash-cost-layout .table-summary {
  margin: 6px 0;
  padding: 6px 10px;
}

.finance-cash-cost-layout .compact-table-wrap {
  max-height: 300px;
  overflow: auto;
}

@media (max-width: 1180px) {
  .finance-cash-cost-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .finance-cash-primary-row {
    grid-template-columns: 1fr 1fr;
  }

  .finance-cash-entry-actions {
    grid-column: 1 / -1;
  }

  .finance-cash-source-row {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 99px;
  color: #17434b;
  background: #e6f2f0;
  font-size: 12px;
}

.status.warn {
  color: var(--warn);
  background: #fff4df;
}

.status.bad {
  color: var(--bad);
  background: #fde7e4;
}

.status.ok {
  color: var(--ok);
  background: #e8f5eb;
}

.dashboard-alert-row td {
  color: var(--bad);
  font-weight: 700;
}

.dashboard-alert-row .status {
  color: var(--bad);
  background: #fde7e4;
}

.report-kpis .kpi:first-child,
.report-kpis .kpi:last-child {
  border-color: #b9d4cf;
  background: #eef7f5;
}

.risk-panel {
  margin-top: 16px;
}

.risk-panel header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.risk-panel td:nth-child(3) {
  min-width: 260px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.subtabs button {
  min-width: 92px;
}

.dispatch-tabs {
  gap: 4px;
  margin: 0 0 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.dispatch-tabs .module-switcher-card {
  min-width: auto;
}

.group-tabs {
  position: sticky;
  top: 86px;
  z-index: 24;
  display: flex;
  gap: 4px;
  margin: -18px -24px 16px;
  padding: 10px 24px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 248, 0.96);
  -webkit-overflow-scrolling: touch;
}

.group-tabs[hidden] {
  display: none;
}

.module-switcher-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 14px 11px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  white-space: normal;
}

.module-switcher-card:hover {
  filter: none;
  background: #eef2f4;
}

.module-switcher-card.active {
  border-bottom-color: var(--brand);
  background: #fff;
  color: var(--brand);
  box-shadow: none;
}

.module-switcher-card strong {
  font-size: 14px;
  line-height: 1.25;
}

.module-switcher-card span {
  display: none;
}

.module-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #d7251d;
  color: #fff;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(120, 22, 18, 0.25);
}

.toolbar input {
  width: min(420px, 100%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.toolbar input.toolbar-month {
  width: 150px;
  min-height: 38px;
  padding: 8px 10px;
}

.finance-toolbar {
  justify-content: flex-start;
}

.finance-toolbar .actions {
  margin-left: auto;
}

.inline-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.inline-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-filter input,
.inline-filter select {
  width: 150px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.inline-filter select {
  width: 110px;
}

.payroll-matrix {
  width: max-content;
  min-width: 0;
  table-layout: fixed;
}

.payroll-matrix th,
.payroll-matrix td {
  width: var(--payroll-employee-col-width, 132px);
  min-width: var(--payroll-employee-col-width, 132px);
  max-width: var(--payroll-employee-col-width, 132px);
  padding: 8px 9px;
  border: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.payroll-matrix th:first-child,
.payroll-matrix td:first-child,
.payroll-matrix th:nth-child(2),
.payroll-matrix td:nth-child(2) {
  position: sticky;
  z-index: 2;
  background: #fff;
  text-align: left;
}

.payroll-matrix th:first-child,
.payroll-matrix td:first-child {
  left: 0;
  width: 136px;
  min-width: 136px;
  max-width: 136px;
  color: var(--muted);
  font-weight: 800;
}

.payroll-matrix th:nth-child(2),
.payroll-matrix td:nth-child(2) {
  left: 136px;
  width: 154px;
  min-width: 154px;
  max-width: 154px;
  font-weight: 800;
}

.payroll-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fbfb;
}

.payroll-matrix thead th:first-child,
.payroll-matrix thead th:nth-child(2) {
  z-index: 4;
  background: #f8fbfb;
}

.payroll-matrix .link-button {
  width: 100%;
  min-height: 34px;
  justify-content: center;
  padding: 6px 8px;
  color: var(--brand);
  background: #edf6f5;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.payroll-subtotal-row td {
  background: #f4f7f6;
  font-weight: 800;
}

.payroll-total-row td {
  background: #fff4d6;
  color: #1f2e2f;
  font-weight: 900;
}

.payroll-subtotal-row td:first-child,
.payroll-subtotal-row td:nth-child(2) {
  background: #f4f7f6;
}

.payroll-total-row td:first-child,
.payroll-total-row td:nth-child(2) {
  background: #fff4d6;
}

.payroll-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
  min-width: 760px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.payroll-summary-strip div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.payroll-summary-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payroll-summary-strip strong {
  color: var(--brand);
  font-size: 18px;
  line-height: 1.2;
}

.payroll-summary-strip div:first-child {
  border-color: #ead28a;
  background: #fff8e5;
}

.payroll-summary-strip div:first-child strong {
  color: #8a5a00;
}

.toolbar-hint {
  color: var(--muted);
  font-size: 13px;
}

.danger-text {
  color: #b91c1c;
}

.health-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #f8fafc;
}

.health-summary strong {
  font-size: 18px;
}

.health-summary.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.health-summary.warn {
  border-color: #fed7aa;
  background: #fff7ed;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.health-grid div {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.health-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.health-grid strong {
  font-size: 16px;
}

.backup-cloud-settings {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.backup-cloud-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px auto;
  gap: 10px;
  align-items: end;
}

.backup-cloud-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.backup-cloud-status {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.finance-request-form {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.finance-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.finance-section-card {
  display: grid;
  gap: 6px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.finance-section-card.active {
  border-color: #167f73;
  background: #eefaf8;
}

.finance-section-card span {
  color: var(--muted);
  font-size: 13px;
}

.finance-section-card b {
  font-size: 24px;
}

.finance-section-card small {
  color: var(--muted);
  font-weight: 800;
}

.finance-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.finance-home-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 2fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.finance-home-layout .finance-overview-grid {
  margin-bottom: 0;
}

.finance-erp-upload-card {
  margin-bottom: 12px;
}

.finance-erp-upload-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.finance-erp-upload-mini {
  min-width: 0;
}

.finance-erp-upload-mini h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.finance-erp-dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  min-height: 118px;
  padding: 14px;
  border: 2px dashed rgba(15, 118, 110, 0.42);
  border-radius: 8px;
  background: #f2fbf9;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.finance-erp-dropzone strong {
  font-size: 16px;
}

.finance-erp-dropzone span,
.finance-erp-dropzone small {
  color: var(--muted);
  font-weight: 800;
}

.finance-erp-dropzone.dragging,
.finance-erp-dropzone:hover {
  border-color: #0f766e;
  background: #e7f8f4;
}

.finance-erp-dropzone:disabled {
  cursor: wait;
  opacity: 0.7;
}

.finance-authority-dropzone {
  position: relative;
  min-height: 178px;
  padding: 22px 18px;
  border-width: 2px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fdfc 0%, #effaf7 100%);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.04);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.finance-authority-dropzone .finance-dropzone-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #d9f3ec;
  color: #08765f;
  font-size: 26px;
  line-height: 1;
}

.finance-authority-dropzone .finance-dropzone-action {
  color: #08765f;
  font-weight: 800;
}

.finance-authority-dropzone.has-file {
  border-style: solid;
  border-color: #199473;
  background: #effbf6;
}

.finance-authority-dropzone.dragging {
  border-color: #08765f;
  background: #dcf7ee;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
  transform: translateY(-2px);
}

.finance-erp-upload-result {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-erp-progress {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-erp-progress-head,
.finance-erp-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.finance-erp-progress-head span,
.finance-erp-progress-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.finance-erp-progress-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.finance-erp-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #0f766e;
  transition: width 160ms ease;
}

.finance-erp-progress.warn .finance-erp-progress-bar span {
  background: #d97706;
}

.finance-erp-progress.danger .finance-erp-progress-bar span {
  background: #dc2626;
}

.finance-erp-progress.danger strong {
  color: #b91c1c;
}

.b2b-order-cost-cell {
  min-width: 160px;
}

.b2b-order-no-button {
  padding: 0;
  font-weight: 900;
}

.b2b-order-no-button.detail-pending {
  padding: 3px 7px;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #9a3412;
  background: #fff4cc;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

/* 宽屏单据一览：统一列宽，避免自动表格把个别空白列异常拉宽。 */
@media (min-width: 901px) {
  .b2b-receivable-panel .b2b-order-list-table {
    width: 100%;
    min-width: 1560px;
    table-layout: fixed;
  }

  .b2b-receivable-panel .b2b-order-list-table .select-column {
    width: 38px;
    min-width: 38px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-sales-date {
    width: 92px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-sales-no {
    width: 150px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-customer {
    width: 178px;
    min-width: 178px;
    max-width: 178px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-money {
    width: 106px;
    min-width: 106px;
    max-width: 106px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-adjustment {
    width: 92px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-reason {
    width: 142px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-cycle {
    width: 92px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-process-date {
    width: 112px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-status {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-note {
    width: 210px;
    min-width: 210px;
    max-width: 210px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-actions {
    width: 206px;
    min-width: 206px;
  }

  .b2b-receivable-panel .b2b-order-list-table .inline-money-input.b2b-adjustment-input,
  .b2b-receivable-panel .b2b-order-list-table .inline-reason-input.b2b-adjustment-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

.tiny-text {
  font-size: 11px;
}

.b2b-cost-detail-box {
  display: grid;
  gap: 8px;
  min-width: 720px;
  max-width: 960px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.b2b-order-detail-dialog {
  width: min(1120px, calc(100vw - 32px));
}

.b2b-order-detail-dialog .b2b-order-detail-body {
  padding: 16px;
  overflow: auto;
}

.b2b-order-detail-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.b2b-order-detail-table th,
.b2b-order-detail-table td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.b2b-order-detail-totals {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 14px;
}

.b2b-order-detail-totals strong {
  color: #0f766e;
}

.b2b-cost-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.b2b-cost-detail-table {
  font-size: 12px;
}

.b2b-cost-detail-table th,
.b2b-cost-detail-table td {
  padding: 6px 8px;
  white-space: nowrap;
}

.finance-erp-selected-file {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: #f8fffd;
}

.finance-erp-selected-file[hidden] {
  display: none !important;
}

.finance-erp-selected-file span,
.finance-erp-selected-file small {
  color: var(--muted);
  font-weight: 800;
}

.finance-erp-selected-file strong {
  overflow-wrap: anywhere;
}

.finance-erp-upload-actions {
  margin-top: 8px;
}

.finance-erp-upload-result span,
.finance-erp-upload-result small {
  color: var(--muted);
  font-weight: 800;
}

.b2b-tabs {
  margin: 10px 0;
}

.b2b-receivable-panel {
  margin-top: 10px;
}

.b2b-receivable-panel header {
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.b2b-receivable-panel header h3 {
  margin-bottom: 2px;
  font-size: 16px;
}

.income-list-title-line {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  flex-wrap: wrap;
}

.income-list-title-line h3 {
  flex: 0 0 auto;
  margin: 0;
}

.income-list-selection-summary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #38534c;
  font-size: 13px;
  white-space: nowrap;
}

.income-list-selection-summary b,
.income-list-selection-summary strong {
  color: #183d34;
}

.income-list-bulk-action {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 10px;
  color: #fff;
  background: var(--ok);
}

.income-list-bulk-action:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.b2b-list-title-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.b2b-monthly-customer-summary {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.b2b-summary-modal-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(15,23,42,.35); display:flex; align-items:center; justify-content:center; padding:24px; }
.b2b-summary-modal { width:min(1120px,96vw); height:min(720px,88vh); overflow:hidden; background:#fff; border-radius:14px; box-shadow:0 20px 60px rgba(15,23,42,.3); padding:16px; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
.b2b-summary-modal > header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.link-button { border:0; background:transparent; color:#087f8c; text-decoration:underline; padding:2px 4px; cursor:pointer; }
.b2b-summary-viewport { min-height:0; overflow:hidden; }
.b2b-summary-pages { height:100%; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:16px; }
.b2b-summary-pages.slide-next { animation:b2b-summary-next .24s ease-out; }
.b2b-summary-pages.slide-previous { animation:b2b-summary-previous .24s ease-out; }
@keyframes b2b-summary-next { from { transform:translateX(12%); opacity:.45; } to { transform:translateX(0); opacity:1; } }
@keyframes b2b-summary-previous { from { transform:translateX(-12%); opacity:.45; } to { transform:translateX(0); opacity:1; } }
.b2b-summary-pane { min-width:0; height:100%; overflow:auto; border:1px solid #cbd5e1; border-radius:10px; padding:10px; background:#fff; }
.b2b-summary-pane-title { margin-bottom:8px; color:var(--muted); font-size:12px; font-weight:800; }
.b2b-summary-pane-empty { min-height:320px; display:grid; place-items:center; color:var(--muted); }
.b2b-summary-pane table { width:100%; min-width:0; table-layout:fixed; }
.b2b-summary-pane th:first-child,.b2b-summary-pane td:first-child { width:auto; white-space:normal; overflow-wrap:anywhere; }
.b2b-summary-pane th:not(:first-child),.b2b-summary-pane td:not(:first-child) { width:112px; text-align:right; white-space:nowrap; }
.b2b-summary-pane .b2b-monthly-summary-table th:not(:first-child),.b2b-summary-pane .b2b-monthly-summary-table td:not(:first-child) { width:78px; }
.b2b-summary-modal .b2b-list-pagination { margin-top:12px; }
@media (max-width:800px) { .b2b-summary-modal { height:min(680px,92vh); } .b2b-summary-pages { display:block; } .b2b-summary-pane { display:none; } .b2b-summary-pane:first-child { display:block; } }

.b2b-monthly-customer-summary .debt-summary-wrap {
  max-height: 570px;
}

.b2b-monthly-summary-count {
  padding: 7px 10px;
  color: var(--muted);
  font-size: 11px;
}

.b2b-receivable-amount-detail {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 104px;
  line-height: 1.25;
}

.b2b-receivable-amount-detail > strong {
  color: #183d34;
  font-size: 15px;
  line-height: 1.15;
}

.b2b-receivable-amount-detail > span,
.receivable-tax-rate {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.b2b-receivable-amount-detail .b2b-receivable-net-amount {
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef6f4;
  color: #54706a;
  font-size: 11px;
  font-weight: 700;
}

.receivable-tax-rate {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.receivable-tax-rate select {
  width: 48px;
  min-width: 48px;
  height: 22px;
  margin: 0;
  padding: 0 14px 0 4px;
  font-size: 11px;
  line-height: 20px;
}

.b2b-receivable-panel header span {
  font-size: 12px;
}

.compact-panel-body {
  padding: 0;
}

.compact-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 360px);
}

.b2b-compact-table {
  min-width: 1080px;
  font-size: 12px;
}

.b2b-order-list-table {
  width: max-content;
  table-layout: auto;
  font-size: 11px;
}

.b2b-order-list-table th,
.b2b-order-list-table td {
  padding: 4px 6px;
  line-height: 1.2;
}

.b2b-order-list-table .inline-money-input.b2b-adjustment-input {
  width: 68px;
  min-width: 68px;
  height: 26px;
  padding: 3px 5px;
  font-size: 11px;
}

.b2b-order-list-table .inline-reason-input.b2b-adjustment-input {
  width: 100px;
  min-width: 100px;
  height: 26px;
  padding: 3px 5px;
  font-size: 11px;
}

.b2b-order-list-table th:nth-last-child(2),
.b2b-order-list-table td:nth-last-child(2) {
  width: 1%;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.b2b-order-list-table th:last-child,
.b2b-order-list-table td:last-child {
  width: 1%;
}

.b2b-compact-table th,
.b2b-compact-table td {
  padding: 6px 8px;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
}

.b2b-compact-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}

.b2b-compact-table td:nth-child(3) {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.b2b-compact-table .table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
}

.b2b-order-search-box input {
  width: 180px;
}

.b2b-active-search {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.b2b-bulk-save-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f5fbfa;
}

.b2b-bulk-save-bar .save-action {
  margin-left: auto;
  color: #fff;
  background: var(--ok);
}

.b2b-bulk-save-bar .save-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.b2b-list-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 0;
  color: var(--muted);
  font-size: 13px;
}

.b2b-list-pagination .mini-button {
  min-width: 72px;
}

.b2b-compact-table .select-column {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.b2b-compact-table .text-action,
.b2b-compact-table button {
  padding: 4px 7px;
  font-size: 12px;
  white-space: nowrap;
}

.b2b-move-action-select {
  width: 46px;
  min-width: 46px;
  min-height: 34px;
  padding: 5px 16px 5px 8px;
  border: 1px solid #99c8c2;
  border-radius: 7px;
  background-color: #f0fdfa;
  color: #0f766e;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
}

.b2b-move-action-select:hover,
.b2b-move-action-select:focus {
  border-color: #0f766e;
  background-color: #dff7f2;
  outline: none;
}

.global-erp-sales-report {
  margin-bottom: 16px;
}

.global-erp-sales-report > header {
  align-items: center;
}

.global-sales-head-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-left: auto;
  padding: 7px 12px;
  border-radius: 8px;
  background: #ecfdf5;
}

.global-sales-head-total strong {
  color: #14532d;
  font-size: 20px;
}

.global-sales-head-total small {
  color: var(--muted);
}

.global-sales-overview-row {
  display: grid;
  grid-template-columns: minmax(360px, 1.15fr) minmax(280px, 0.85fr);
  gap: 12px;
}

.global-sales-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 250px;
  padding: 18px 12px 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fffd 0%, #fff 100%);
}

.global-sales-chart-compact {
  position: relative;
  min-height: 330px;
  padding-top: 34px;
}

.global-sales-chart-compact .global-sales-bar-item {
  grid-template-rows: 42px 220px 28px;
  flex: 1 0 118px;
  min-width: 118px;
}

.global-sales-chart-compact .global-sales-bar-track {
  height: 220px;
}

.global-sales-handler-totals {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.global-sales-handler-totals h4 {
  margin: 0 0 6px;
}

.global-sales-handler-totals p {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(240px, 1.3fr);
  gap: 14px;
  align-items: center;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
}

.global-sales-handler-totals p:last-child {
  border-bottom: 0;
}

.global-sales-handler-totals small {
  color: var(--muted);
}

.global-sales-handler-finance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
}

.global-sales-handler-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  text-align: right;
}

.global-sales-handler-metric.total {
  grid-column: 1 / -1;
  padding-bottom: 5px;
  border-bottom: 1px dashed #dbe5e3;
  color: #111827;
}

.global-sales-handler-metric.total b,
.global-sales-handler-metric.total small {
  color: #111827;
}

.global-sales-handler-metric b {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-sales-handler-metric small {
  flex: 0 0 auto;
  font-size: 11px;
}

.global-sales-handler-metric.unpaid b {
  color: #b45309;
}

.global-sales-handler-metric.received b {
  color: #047857;
}

.global-sales-handler-amount-link {
  width: 100%;
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #475569;
  font: inherit;
  cursor: pointer;
}

.global-sales-handler-amount-link:hover,
.global-sales-handler-amount-link:focus-visible {
  background: #edf8f5;
  outline: 1px solid #99d5cd;
}

.global-sales-handler-name {
  color: #0f172a;
  font-weight: 750;
  text-decoration: none;
}

.global-sales-detail-unpaid {
  color: #dc2626;
  font-weight: 700;
}

.global-sales-chart-legend {
  position: absolute;
  top: 8px;
  left: 12px;
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.global-sales-chart-legend span::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 2px;
  background: #0f766e;
  content: "";
}

.global-sales-chart-legend .unpaid::before {
  background: #f59e0b;
}

.global-sales-bar-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  height: 220px;
}

.global-sales-bar-pair .global-sales-bar-track {
  width: min(26px, 38%);
}

.global-sales-bar-track.global-sales-bar-unpaid i {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.global-sales-bar-values {
  display: grid;
  grid-template-rows: repeat(2, 18px);
  align-content: start;
  min-width: 0;
}

.global-sales-bar-values strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-sales-bar-values strong.sales {
  padding-right: 18px;
  color: #111827;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
}

.global-sales-bar-values strong.unpaid {
  padding-left: 18px;
  color: #dc2626;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.global-sales-handler-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f766e;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(15, 118, 110, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
}

.global-sales-handler-link:hover,
.global-sales-handler-link:focus {
  color: #115e59;
  text-decoration-color: currentColor;
  outline: none;
}

.global-sales-bar-item > .global-sales-handler-link {
  display: block;
  overflow: hidden;
  width: 100%;
  font-size: 11px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-sales-handler-detail-table {
  width: 100%;
}

.global-sales-handler-detail-table th:nth-child(5),
.global-sales-handler-detail-table td:nth-child(5),
.global-sales-handler-detail-table th:nth-child(6),
.global-sales-handler-detail-table td:nth-child(6),
.global-sales-handler-detail-table th:nth-child(7),
.global-sales-handler-detail-table td:nth-child(7) {
  text-align: right;
}

.global-sales-bar-item {
  display: grid;
  grid-template-rows: 20px 170px 22px;
  gap: 5px;
  flex: 1 0 46px;
  min-width: 46px;
  text-align: center;
}

.global-sales-bar-item strong {
  overflow: hidden;
  color: #334155;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-sales-bar-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 170px;
  border-bottom: 1px solid #cbd5e1;
}

.global-sales-bar-track i {
  display: block;
  width: min(30px, 72%);
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
}

.global-sales-bar-item span {
  color: var(--muted);
  font-size: 11px;
}

.global-sales-summary {
  margin-top: 12px;
}

.global-sales-excel-wrap {
  border: 1px solid var(--line);
  border-radius: 9px;
}

.global-sales-excel-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.global-sales-excel-table th,
.global-sales-excel-table td {
  min-width: 88px;
  padding: 8px 10px;
  text-align: right;
  white-space: nowrap;
  border-right: 1px solid #e5eaf0;
  border-bottom: 1px solid #e5eaf0;
}

.global-sales-excel-table th:first-child,
.global-sales-excel-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 120px;
  text-align: left;
  background: #fff;
}

.global-sales-excel-table thead th {
  background: #f1f5f9;
}

.global-sales-excel-table thead th:first-child {
  z-index: 2;
  background: #f1f5f9;
}

.global-sales-excel-total td {
  color: #134e4a;
  font-weight: 700;
  background: #ecfdf5;
}

.global-sales-excel-total td:first-child {
  background: #ecfdf5;
}

.global-sales-store-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.global-sales-store-grid > button {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.global-sales-store-grid > button:hover,
.global-sales-store-grid > button:focus-visible {
  border-color: #70bdb4;
  background: #f0fdfa;
  outline: 2px solid rgba(20, 184, 166, 0.16);
}

.global-sales-store-grid strong {
  color: #0f766e;
  font-size: 18px;
}

.global-sales-store-grid small {
  color: var(--muted);
}

.global-sales-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.global-sales-daily-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.global-sales-daily-detail > header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.global-sales-daily-detail h4 {
  margin: 0;
}

.global-sales-daily-detail header span {
  color: var(--muted);
  font-size: 12px;
}

.global-sales-total {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  background: #ecfdf5;
}

.global-sales-total strong {
  color: #14532d;
  font-size: 26px;
}

.global-sales-total small {
  color: var(--muted);
}

.global-sales-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.global-sales-breakdown section {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.global-sales-breakdown h4 {
  margin: 0 0 8px;
}

.global-sales-breakdown p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px solid #edf2f7;
}

.global-sales-breakdown p:last-child {
  border-bottom: 0;
}

.global-sales-breakdown p b {
  white-space: nowrap;
}

@media (max-width: 980px) {
  .global-sales-overview-row {
    grid-template-columns: 1fr;
  }

  .global-sales-breakdown {
    grid-template-columns: 1fr;
  }

  .global-sales-store-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

.b2b-compact-table .locked-actions {
  min-width: 160px;
  flex-direction: column;
  align-items: flex-start;
}

.b2b-compact-table .action-note {
  display: grid;
  gap: 2px;
  padding: 5px 7px;
  border-radius: 6px;
  background: #eefdf8;
  color: #134e4a;
  font-size: 11px;
  line-height: 1.35;
}

.b2b-compact-table .action-note strong {
  font-size: 11px;
}

.b2b-compact-table .danger-note {
  background: #fff1f2;
  color: #9f1239;
}

.b2b-compact-table .readonly-value {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.b2b-customer-debt-panel {
  margin: 10px 0;
  border-color: rgba(15, 118, 110, 0.24);
}

.b2b-customer-debt-panel header {
  padding: 9px 12px;
}

.debt-summary-wrap {
  max-height: 220px;
}

.b2b-debt-summary-table {
  min-width: 720px;
}

.b2b-debt-summary-table td,
.b2b-debt-summary-table th {
  padding: 6px 10px;
}

.b2b-debt-summary-table strong {
  color: #b91c1c;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .finance-home-layout {
    grid-template-columns: 1fr;
  }
}

.finance-overview-card {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 260px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.finance-overview-card.active,
.finance-overview-card:hover {
  border-color: #167f73;
  background: #f2fbf9;
}

.finance-overview-title {
  font-size: 18px;
  font-weight: 900;
}

.finance-overview-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.finance-overview-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.finance-overview-card small {
  color: var(--muted);
  font-weight: 800;
}

.finance-overview-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.finance-overview-card dl div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.finance-overview-card dt,
.finance-overview-card dd {
  margin: 0;
  font-size: 13px;
}

.finance-overview-card dt {
  color: var(--muted);
  min-width: 0;
}

.finance-overview-card dd {
  font-weight: 900;
  min-width: max-content;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.finance-overview-card ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
}

.finance-monthly-orders-entry .report-kpis {
  margin-bottom: 0;
}

.finance-monthly-orders-page {
  width: 100%;
}

.finance-monthly-orders-page > .panel-body {
  padding: 0;
}

.finance-monthly-orders-overview {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.finance-monthly-orders-overview .report-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.finance-monthly-orders-overview .kpi {
  min-width: 0;
  padding: 9px 11px;
  box-shadow: none;
}

.finance-monthly-orders-overview .kpi span {
  font-size: 11px;
}

.finance-monthly-orders-overview .kpi strong {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.15;
}

.finance-monthly-orders-page .b2b-receivable-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.finance-subnav {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.finance-subnav button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.finance-subnav button.active {
  border-color: #167f73;
  background: #fff;
  color: #0f5f57;
  box-shadow: 0 4px 12px rgba(15, 95, 87, 0.08);
}

.finance-income-subnav {
  grid-template-columns: repeat(5, minmax(104px, 1fr));
  overflow-x: auto;
}

.finance-income-subnav button {
  white-space: nowrap;
}

.master-partner-subnav {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.finance-supplier-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.finance-supplier-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-purchase-company-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-purchase-company-panel strong,
.finance-purchase-company-panel span {
  display: block;
}

.finance-purchase-company-add {
  display: grid;
  gap: 8px;
}

.finance-purchase-company-list {
  display: grid;
  gap: 6px;
}

.finance-purchase-company-item {
  padding: 8px 9px;
  border: 1px solid #d9e4e2;
  border-radius: 6px;
  background: #f8fafb;
}

.finance-purchase-company-item span,
.finance-purchase-company-item small {
  display: block;
}

.finance-purchase-company-item small {
  margin-top: 2px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .finance-supplier-layout {
    grid-template-columns: 1fr;
  }
}

.finance-supplier-table {
  min-width: 1160px;
}

.finance-supplier-table textarea {
  min-height: 42px;
  resize: vertical;
}

.finance-supplier-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #b7d9d4;
  border-radius: 8px;
  background: #f6fbfa;
}

.finance-supplier-editor-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.finance-supplier-editor-fields .full {
  grid-column: 1 / -1;
}

.finance-bank-inline {
  display: grid;
  grid-template-columns: 1.2fr 1fr 90px 100px 1fr 1.2fr;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid #d9e4e2;
  border-radius: 8px;
  background: #fff;
}

.finance-bank-inline label {
  min-width: 0;
}

.finance-bank-inline input,
.finance-bank-inline select {
  min-width: 0;
}

@media (max-width: 1100px) {
  .finance-bank-inline {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

.finance-editor-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d9e4e2;
  border-radius: 6px;
  background: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.finance-supplier-compact-settings {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.finance-due-rule-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #d9e4e2;
  border-radius: 6px;
  background: #fff;
}

.finance-due-rule-checks > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-right: 4px;
}

.finance-due-rule-checks label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .finance-supplier-compact-settings {
    grid-template-columns: 1fr;
  }
}

.finance-supplier-editor textarea {
  min-height: 78px;
  resize: vertical;
}

.finance-form-head,
.finance-form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.finance-dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 112px;
  padding: 18px;
  border: 2px dashed #8fb5b0;
  border-radius: 8px;
  background: #f4fbfa;
  text-align: center;
}

.finance-dropzone.dragging,
.finance-dropzone.has-file {
  border-color: #167f73;
  background: #e9f8f6;
}

.finance-request-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.finance-request-fields .full {
  grid-column: 1 / -1;
}

.finance-ledger-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.finance-ledger-summary div {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-ledger-summary span,
.hash-line,
.pending-line,
.finance-log-line {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.finance-payment-board {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-payment-table {
  min-width: 1380px;
  border-collapse: collapse;
}

.finance-payment-table th {
  background: #e8f3ff;
  color: #172033;
  white-space: nowrap;
}

.finance-payment-table th,
.finance-payment-table td {
  border: 1px solid #dbe3ea;
  padding: 5px 7px;
  vertical-align: top;
}

.finance-payment-board .finance-form-head {
  margin-bottom: 0;
  padding-bottom: 6px;
}

.finance-payment-table .money-cell,
.finance-payment-table .due-cell {
  text-align: right;
  white-space: nowrap;
  font-weight: 800;
}

.finance-payment-table .money-cell.attention {
  background: #ef1f1f;
  color: #fff;
}

.finance-payment-table tr.is-paid {
  color: var(--muted);
  background: #f7f8fa;
}

.finance-payer-cell {
  display: grid;
  gap: 4px;
  min-width: 92px;
}

.finance-payer-cell small {
  color: var(--muted);
  font-weight: 700;
}

.finance-bank-dialog {
  width: min(560px, calc(100vw - 32px));
}

.finance-bank-dialog pre {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
  line-height: 1.55;
  font-family: inherit;
  font-weight: 700;
}

.finance-payment-table tr.is-placeholder {
  background: #fffdf2;
}

.finance-payment-table tr.is-placeholder .money-cell {
  color: #9a6700;
}

.finance-supplier-editor-row > td {
  background: #f8fafc;
  padding: 12px;
}

.finance-supplier-editor-row .finance-supplier-editor {
  margin: 0;
  border: 1px solid var(--line);
  box-shadow: none;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  white-space: nowrap;
}

.risk-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.risk-item {
  border-left: 4px solid #f97316;
  background: #fff7ed;
  padding: 9px 12px;
  font-weight: 700;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

.payroll-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 760px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.payroll-pager .actions {
  width: auto;
}

.payroll-editor-list {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #f7fbfa;
}

.payroll-month-block {
  display: grid;
  width: max-content;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.payroll-month-head {
  display: grid;
  grid-template-columns: 64px 96px minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.payroll-month-head strong {
  font-size: 16px;
}

.payroll-month-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.payroll-editor-list > label,
.payroll-month-block > label,
.payroll-editor-meta label {
  display: grid;
  grid-template-columns: 136px 154px 132px;
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fff;
}

.payroll-month-block > label:last-of-type {
  border-bottom: 1px solid var(--line);
}

.payroll-editor-group {
  color: var(--muted);
  font-weight: 800;
}

.payroll-editor-label {
  color: var(--text);
  font-weight: 800;
}

.payroll-editor-list input,
.payroll-editor-list select,
.payroll-editor-list output {
  width: 132px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: right;
}

.readonly-payroll-field output {
  background: #f2f5f4;
  font-weight: 800;
}

.payroll-grand-total-field {
  background: #fff4d6 !important;
}

.payroll-grand-total-field output {
  color: #1f2e2f;
  background: #fff8e5;
  font-size: 18px;
  font-weight: 900;
}

.payroll-editor-meta {
  display: grid;
  gap: 0;
  width: max-content;
  border-top: 1px solid var(--line);
}

.payroll-editor-list {
  justify-items: start;
}

.payroll-year-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.payroll-year-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px 0;
  background: #f7fbfa;
}

.payroll-year-summary div {
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.payroll-year-summary div:first-child {
  border-color: #d4e3e0;
  background: #f2faf8;
}

.payroll-year-summary div:last-child {
  border-color: #ead28a;
  background: #fff8e5;
}

.payroll-year-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.payroll-year-summary strong {
  color: var(--brand);
  font-size: 20px;
  line-height: 1.2;
}

.payroll-year-summary div:last-child strong {
  color: #8a5a00;
}

.year-switcher {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.year-switcher button {
  min-height: 32px;
  padding: 6px 10px;
}

.payroll-year-editor-table {
  width: max-content;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.payroll-year-editor-table th,
.payroll-year-editor-table td {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.payroll-year-editor-table th:first-child,
.payroll-year-editor-table td:first-child,
.payroll-year-editor-table th:nth-child(2),
.payroll-year-editor-table td:nth-child(2) {
  position: sticky;
  z-index: 2;
  background: #fff;
  text-align: left;
}

.payroll-year-editor-table th:first-child,
.payroll-year-editor-table td:first-child {
  left: 0;
  width: 136px;
  min-width: 136px;
  max-width: 136px;
  color: var(--muted);
  font-weight: 800;
}

.payroll-year-editor-table th:nth-child(2),
.payroll-year-editor-table td:nth-child(2) {
  left: 136px;
  width: 154px;
  min-width: 154px;
  max-width: 154px;
  font-weight: 800;
}

.payroll-year-editor-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fbfb;
  text-align: center;
}

.payroll-year-editor-table thead th:first-child,
.payroll-year-editor-table thead th:nth-child(2) {
  z-index: 4;
  background: #f8fbfb;
  text-align: left;
}

.payroll-year-editor-table thead th strong,
.payroll-year-editor-table thead th span {
  display: block;
}

.payroll-year-editor-table input,
.payroll-year-editor-table select,
.payroll-year-editor-table output {
  width: 116px;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: right;
}

.payroll-year-editor-table select {
  text-align: left;
}

.payroll-year-editor-table output {
  display: inline-block;
  background: #f2f5f4;
  font-weight: 800;
}

.payroll-year-editor-table .payroll-meta-row td {
  background: #fbfdfc;
}

.search-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto;
  gap: 8px;
  width: min(560px, 100%);
}

.search-wrap input {
  width: 100%;
}

.search-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  width: min(420px, 100%);
  max-height: 260px;
  overflow-y: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.search-suggestions:empty {
  display: none;
}

.search-suggestions button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.search-suggestions button:hover {
  background: #eef3f3;
}

dialog {
  width: min(840px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
}

dialog form {
  display: flex;
  max-height: calc(100vh - 28px);
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(15, 25, 28, 0.42);
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.form-error {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid #f1b8b4;
  border-radius: 6px;
  background: #fff0ee;
  color: var(--bad);
  font-size: 13px;
  font-weight: 800;
}

.page-editor .form-error {
  margin: 12px 16px 0;
}

.form-error[hidden] {
  display: none;
}

.inbound-fields {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
}

.inbound-fields > :not(.inbound-metric) {
  grid-column: span 6;
}

.inbound-fields .inbound-top {
  grid-column: span 4;
}

.inbound-fields .inbound-status {
  grid-column: 1 / -1;
}

.inbound-fields .inbound-metric {
  grid-column: span 3;
}

.inbound-fields .inbound-metric input {
  min-height: 44px;
  font-size: 18px;
  font-weight: 800;
  text-align: right;
}

.inbound-fields .inbound-estimate input {
  border-color: #cbd5d1;
  background: #f6f8f7;
  color: var(--accent);
  cursor: not-allowed;
  opacity: 1;
}

.ref-search-quick-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.ref-search-quick-add > input {
  min-width: 0;
}

.ref-quick-add-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.inbound-quick-master-dialog {
  width: min(620px, calc(100vw - 28px));
}

.inbound-quick-master-dialog .fields {
  max-height: min(52vh, 480px);
}

/* Exception-center v16: legacy dialogs use the same centered, bounded shell. */
dialog.w3-centered-scroll-dialog[open] {
  position: fixed;
  inset: 0 !important;
  margin: auto !important;
  transform: none !important;
  display: flex;
  width: min(960px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  height: min(760px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
  flex-direction: column;
  overflow: hidden;
}

dialog.w3-centered-scroll-dialog > header,
dialog.w3-centered-scroll-dialog > footer,
dialog.w3-centered-scroll-dialog > form > header,
dialog.w3-centered-scroll-dialog > form > footer { flex: 0 0 auto; }

dialog.w3-centered-scroll-dialog > .audit-log-body,
dialog.w3-centered-scroll-dialog > form > .fields {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

dialog.w3-centered-scroll-dialog > form {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.inbound-quick-master-dialog.w3-centered-scroll-dialog {
  width: min(620px, calc(100vw - 28px));
  height: min(680px, calc(100dvh - 28px));
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.permission-designer {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.permission-designer legend {
  padding: 0 6px;
  font-weight: 900;
}

.permission-designer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.permission-designer-head strong,
.permission-designer-head span {
  display: block;
}

.permission-save-state {
  min-height: 18px;
  color: #347267 !important;
}

.permission-save-state.is-dirty {
  color: #b45d00 !important;
  font-weight: 900;
}

dialog footer button.permission-save-dirty {
  box-shadow: 0 0 0 3px rgba(224, 142, 45, 0.22);
  background: #b96108;
}

dialog footer button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.75;
}

.app-notice {
  position: fixed;
  z-index: 10000;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 17px;
  border: 1px solid #8bc8bb;
  border-radius: 8px;
  background: #e9f8f4;
  color: #185f53;
  box-shadow: 0 10px 30px rgba(20, 54, 49, 0.18);
  font-weight: 900;
}

.app-notice.is-error {
  border-color: #e2a29c;
  background: #fff0ee;
  color: #9b2c22;
}

.permission-designer-head strong {
  font-size: 15px;
}

.permission-designer-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.permission-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: min(420px, 100%);
}

.permission-tools select {
  min-height: 38px;
  width: 100%;
}

.permission-levels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.permission-group-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.permission-group-card header {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef7f6;
}

.permission-group-check,
.permission-module-check,
.permission-action-list label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  font-weight: 800;
}

.permission-group-check span {
  font-size: 15px;
  white-space: nowrap;
}

.permission-module-list {
  display: grid;
}

.permission-module-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.35fr) minmax(420px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.permission-module-row:last-child {
  border-bottom: 0;
}

.permission-module-row.is-enabled {
  background: #fbfdfd;
}

.permission-module-check span {
  color: var(--text);
  white-space: nowrap;
}

.permission-action-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.permission-action-list label {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
  font-size: 12px;
  white-space: nowrap;
}

.permission-action-list label span {
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.permission-action-list input:checked + span {
  color: var(--brand);
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.role-checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.role-checkbox span {
  font-weight: 800;
}

.role-checkbox small {
  grid-column: 2;
  color: var(--muted);
  line-height: 1.35;
}

.user-capacity-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-width: 760px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.user-capacity-bar strong,
.user-capacity-bar span {
  display: block;
}

.user-capacity-bar strong {
  font-size: 17px;
}

.user-capacity-bar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-pager {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.family-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf9;
}

.family-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.family-editor-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.family-editor-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.family-editor-rows {
  display: grid;
  gap: 10px;
}

.family-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.family-row button {
  min-height: 40px;
}

.pdf-upload-field {
  display: grid;
  gap: 8px;
}

.pdf-upload-box {
  display: grid;
  grid-template-columns: minmax(190px, 0.55fr) 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf9;
}

.pdf-upload-box input[type="file"] {
  width: 100%;
  min-height: 38px;
  padding: 7px;
  background: #fff;
}

.pdf-upload-box span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf9;
}

.document-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.document-editor-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.document-editor-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.document-current-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.document-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.document-card-title {
  color: var(--text);
  font-weight: 800;
}

.document-preview {
  display: grid;
  height: 118px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #cbd5d1;
  border-radius: 6px;
  background: #f3f6f5;
  color: var(--muted);
  font-weight: 800;
}

.document-preview-button {
  width: 100%;
  padding: 0;
  cursor: zoom-in;
}

.document-preview-button:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 126, 96, 0.12);
}

.document-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdf-preview {
  color: var(--brand);
  font-size: 22px;
}

.document-card-meta {
  min-height: 34px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.document-upload-panel {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(150px, 0.8fr) minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.document-history {
  display: grid;
  gap: 8px;
}

.document-history > strong {
  color: var(--text);
}

.document-history-row {
  display: grid;
  grid-template-columns: 0.8fr 1fr auto;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.document-history-row b {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-viewer {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 15, 17, 0.72);
}

.document-viewer-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 100%);
  height: min(92vh, 760px);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.document-viewer-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.document-viewer-panel header strong,
.document-viewer-panel header span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-viewer-panel header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.document-viewer-body {
  min-height: 0;
  overflow: auto;
  background: #eef2f1;
}

.document-viewer-body img {
  display: block;
  max-width: 100%;
  min-height: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.document-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.permission-grid legend {
  padding: 0 6px;
  color: var(--muted);
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-editor {
  min-height: calc(100vh - 132px);
  overflow: hidden;
  background: #fff;
}

.page-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.page-editor-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.page-editor-head p {
  margin: 0;
  color: var(--muted);
}

.page-fields {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  align-items: start;
}

.page-fields .full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding-top: 20px;
  color: var(--text);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  min-height: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

dialog footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.notice-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 13px;
}

.notice-box strong {
  grid-column: 1 / -1;
  color: var(--text);
}

.lot-picker {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.lot-picker-title {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.lot-picker table {
  min-width: 1180px;
}

.lot-picker th,
.lot-picker td {
  padding: 9px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.lot-picker tbody tr {
  cursor: pointer;
}

.lot-picker tbody tr:hover {
  background: #f4f8f8;
}

.lot-picker tbody tr.selected {
  background: #e6f2f0;
}

.lot-picker button:disabled {
  cursor: not-allowed;
  background: #e2e7e8;
  color: #8a969c;
  filter: none;
}

.sale-lines input {
  min-width: 92px;
  padding: 7px 8px;
}

.trace-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.compact-panel-head {
  padding: 10px 12px;
}

.compact-panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.alias-manager-panel .panel-body {
  padding: 0;
}

.alias-manager-table {
  min-width: 700px;
}

.alias-manager-table th:nth-child(1),
.alias-manager-table td:nth-child(1) {
  width: 190px;
}

.alias-manager-table td:first-child {
  display: grid;
  gap: 2px;
}

.alias-manager-table th,
.alias-manager-table td {
  padding: 7px 9px;
  font-size: 13px;
}

.alias-manager-table td:first-child strong {
  line-height: 1.25;
}

.alias-manager-table td:first-child span {
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alias-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr)) auto;
  gap: 6px;
  align-items: center;
}

.alias-input-grid input {
  min-width: 0;
  padding: 6px 7px;
  font-size: 13px;
}

.icon-mini-button {
  width: 32px;
  min-width: 32px;
  padding: 5px 0;
  font-size: 17px;
  font-weight: 800;
}

.inventory-group {
  margin-bottom: 16px;
}

.inventory-group-head h3 {
  font-size: 18px;
}

.inventory-total-panel {
  margin-bottom: 16px;
}

.inventory-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-left: 5px solid var(--accent);
  background: #fff7ed;
}

.inventory-total > span small {
  display: block;
  margin-top: 4px;
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}

.inventory-total span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.inventory-total strong {
  padding: 4px 10px;
  border-radius: 6px;
  background: #f97316;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}

.inventory-amount-highlight {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffedd5;
  color: #c2410c;
  font-weight: 900;
}

.inventory-table-container {
  min-width: max-content;
  background: #fff;
}

.inventory-table {
  display: table !important;
  width: max-content !important;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: visible !important;
}

.inventory-table th,
.inventory-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #eef3f7;
  box-shadow: inset 0 -1px 0 var(--line);
}

.inventory-product-summary-row td {
  padding: 0;
  border-top: 7px solid #fff;
  border-bottom: 1px solid #cfd9e2;
  background: #edf3f7;
}

.inventory-product-summary {
  display: grid;
  grid-template-columns: minmax(280px, 1.45fr) repeat(6, minmax(112px, auto)) auto;
  gap: 14px;
  align-items: center;
  min-width: 1260px;
  padding: 11px 14px;
}

.inventory-product-toggle {
  grid-column: -1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #a8c9bd;
  border-radius: 7px;
  color: var(--brand);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.inventory-product-toggle i {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s ease;
}

.inventory-product-toggle[aria-expanded="true"] i {
  transform: rotate(225deg) translate(-1px, -1px);
}

.inventory-product-identity {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.inventory-product-name {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-product-identity small {
  overflow: hidden;
  color: #4b6b61;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-summary-metric {
  display: grid;
  gap: 2px;
  text-align: right;
}

.inventory-summary-metric em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.inventory-summary-metric b {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.inventory-summary-metric.muted-value b {
  color: var(--muted);
}

.inventory-summary-metric.warning b {
  color: #c56b00;
}

.inventory-summary-metric.amount b {
  color: #c2410c;
}

.inventory-summary-date b {
  font-variant-numeric: tabular-nums;
}

.inventory-lot-row:hover td {
  background: #f8fbfd;
}

.inventory-lot-row.inventory-month-end-aging > td,
.inventory-lot-row.inventory-month-end-aging:hover > td {
  background: #fff1c7;
}

.inventory-storage-expired {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #dc2626;
  border-radius: 999px;
  color: #991b1b;
  background: #fee2e2;
  font-weight: 850;
}

.inventory-storage-amount {
  color: #b45309;
}

.inventory-storage-free {
  color: #15803d;
}

.inventory-storage-pending {
  color: #b45309;
  font-weight: 750;
}

/* Keep the inventory navigation/header visible while the natural page scrolls. */
.inventory-page-flat > header {
  position: sticky;
  top: 90px;
  z-index: 28;
  height: 44px;
  min-height: 44px;
  background: #fff;
}

.inventory-page-flat .inventory-table thead th {
  position: sticky;
  top: 134px;
  z-index: 27;
  white-space: nowrap;
  background: #eef3f7;
}

@media (max-width: 1120px) {
  .inventory-page-flat > header { top: 126px; }
  .inventory-page-flat .inventory-table thead th { top: 170px; }
}

.inventory-operation-column {
  position: sticky !important;
  right: 0;
  z-index: 6;
  min-width: 92px;
  background: #fff !important;
  box-shadow: -1px 0 0 var(--line);
}

.inventory-table thead .inventory-operation-column {
  z-index: 10;
  background: #eef3f7 !important;
}

.inventory-ownership-panel {
  margin-bottom: 12px;
}

.inventory-ownership-panel .compact-panel-head {
  align-items: center;
  padding: 10px 12px;
}

.inventory-ownership-panel .compact-panel-head h3 {
  font-size: 14px;
}

.ownership-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  padding: 8px 10px 10px;
}

.ownership-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  align-items: baseline;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: #fbfcfc;
  text-align: left;
}

.ownership-card.active {
  border-color: var(--accent);
  background: #e9f2f1;
  color: var(--accent);
}

.ownership-card span {
  font-size: 13px;
  font-weight: 800;
}

.ownership-card strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.ownership-card em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.dispatch-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 0;
  background: var(--bg);
}

.dispatch-date-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.dispatch-planner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  align-items: start;
}

.dispatch-date-box,
.dispatch-driver-box,
.dispatch-stat-box {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.dispatch-date-box {
  display: grid;
  gap: 8px;
}

.dispatch-date-box h4,
.dispatch-driver-box h4,
.dispatch-stat-box h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.dispatch-date-box > strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.dispatch-calendar {
  display: grid;
  gap: 5px;
}

.dispatch-calendar-head {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 5px;
}

.dispatch-calendar-head span {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.dispatch-calendar-head button {
  min-width: 30px;
  padding: 4px 0;
}

.dispatch-calendar-weekdays,
.dispatch-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.dispatch-calendar-weekdays span {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.dispatch-calendar-day {
  display: grid;
  place-items: center;
  min-height: 31px;
  padding: 3px 1px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.dispatch-calendar-day span {
  line-height: 1;
}

.dispatch-calendar-day em {
  overflow: hidden;
  max-width: 100%;
  color: var(--accent);
  font-size: 9px;
  font-style: normal;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-calendar-day.other-month {
  opacity: 0.42;
}

.dispatch-calendar-day.today {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px #dc2626;
}

.dispatch-calendar-day.today em {
  color: #b91c1c;
}

.dispatch-calendar-day.selected {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  box-shadow: none;
}

.dispatch-calendar-day.today.selected {
  border-color: #dc2626;
  background: linear-gradient(135deg, #dc2626 0 48%, #2563eb 52% 100%);
  color: #fff;
  box-shadow: none;
}

.dispatch-calendar-day.selected em {
  color: #eff6ff;
}

.dispatch-date-buttons,
.dispatch-box-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.dispatch-box-footer {
  justify-content: space-between;
  font-size: 13px;
}

.dispatch-date-controls,
.dispatch-date-chips,
.dispatch-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dispatch-top-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.dispatch-date-box input {
  flex: 0 0 150px;
  min-width: 100%;
  width: 100%;
  padding: 7px 8px;
}

.dispatch-date-box button,
.dispatch-top-actions button {
  padding: 7px 9px;
}

.dispatch-top-actions select {
  min-width: 140px;
  width: 140px;
}

.dispatch-date-chips button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.dispatch-date-chips span {
  color: var(--muted);
  font-size: 12px;
}

.dispatch-stat-box {
  overflow-x: auto;
}

.compact-stats-table th,
.compact-stats-table td {
  padding: 8px 10px;
  font-size: 13px;
}

.vehicle-stats-table {
  min-width: 260px;
}

.vehicle-stats-table td:nth-child(1) {
  min-width: 110px;
}

.vehicle-stat-cell {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.vehicle-stat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mini-button {
  padding: 5px 7px;
  font-size: 12px;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.dispatch-customer-preview.inline {
  min-height: auto;
}

.compact-empty {
  padding: 12px;
}

.daily-driver-compact {
  display: grid;
  gap: 8px;
  align-items: stretch;
  padding: 0;
  border: 0;
  background: transparent;
}

.daily-driver-compact > strong {
  white-space: nowrap;
  font-size: 14px;
}

.daily-driver-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.daily-driver-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.daily-driver-card span {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-driver-card select {
  padding: 5px 7px;
  font-size: 13px;
}

.daily-driver-compact > button {
  justify-self: end;
  padding: 7px 12px;
}

.dispatch-driver-select {
  width: 100%;
}

/* Keep the three dispatch planning tools visible, but reduce their visual footprint. */
.dispatch-planner-grid.dispatch-planner-compact {
  grid-template-columns: minmax(220px, 0.9fr) minmax(210px, 0.9fr) minmax(250px, 1.1fr);
  gap: 6px;
}

.dispatch-planner-compact .dispatch-date-box,
.dispatch-planner-compact .dispatch-driver-box,
.dispatch-planner-compact .dispatch-stat-box {
  padding: 5px 7px;
  border-radius: 5px;
}

.dispatch-planner-compact .dispatch-date-box {
  gap: 4px;
}

.dispatch-planner-compact .dispatch-date-box h4,
.dispatch-planner-compact .dispatch-driver-box h4,
.dispatch-planner-compact .dispatch-stat-box h4 {
  font-size: 12px;
  line-height: 1.2;
}

.dispatch-planner-compact .dispatch-date-box > strong {
  font-size: 14px;
  line-height: 1.2;
}

.dispatch-planner-compact .dispatch-calendar {
  gap: 2px;
}

.dispatch-planner-compact .dispatch-calendar-head {
  grid-template-columns: 24px 1fr 24px;
  gap: 3px;
}

.dispatch-planner-compact .dispatch-calendar-head span,
.dispatch-planner-compact .dispatch-calendar-day {
  font-size: 10px;
}

.dispatch-planner-compact .dispatch-calendar-head button,
.dispatch-planner-compact .dispatch-date-box button,
.dispatch-planner-compact .daily-driver-compact > button {
  min-width: 24px;
  padding: 3px 5px;
  font-size: 11px;
}

.dispatch-planner-compact .dispatch-calendar-weekdays,
.dispatch-planner-compact .dispatch-calendar-grid {
  gap: 2px;
}

.dispatch-planner-compact .dispatch-calendar-weekdays span,
.dispatch-planner-compact .dispatch-calendar-day em {
  font-size: 8px;
}

.dispatch-planner-compact .dispatch-calendar-day {
  min-height: 23px;
  padding: 1px;
  border-radius: 4px;
}

.dispatch-planner-compact .dispatch-date-buttons,
.dispatch-planner-compact .dispatch-box-footer,
.dispatch-planner-compact .daily-driver-grid,
.dispatch-planner-compact .daily-driver-compact,
.dispatch-planner-compact .vehicle-stat-cell,
.dispatch-planner-compact .vehicle-stat-actions {
  gap: 3px;
}

.dispatch-planner-compact .dispatch-box-footer,
.dispatch-planner-compact .daily-driver-card span,
.dispatch-planner-compact .daily-driver-card select,
.dispatch-planner-compact .compact-stats-table th,
.dispatch-planner-compact .compact-stats-table td {
  font-size: 11px;
}

.dispatch-planner-compact .daily-driver-card {
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 4px;
  padding: 3px 5px;
}

.dispatch-planner-compact .daily-driver-card select,
.dispatch-planner-compact .compact-stats-table th,
.dispatch-planner-compact .compact-stats-table td {
  padding: 4px 5px;
}

@media (max-width: 920px) {
  .dispatch-planner-grid.dispatch-planner-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .dispatch-planner-grid.dispatch-planner-compact {
    grid-template-columns: 1fr;
  }
}

.global-sales-handler-adjust-button {
  margin-left: 6px;
  padding: 3px 7px;
  font-size: 11px;
}

.global-sales-handler-adjust-dialog {
  width: min(900px, calc(100vw - 24px));
  max-height: 80vh;
  padding: 0;
}

.global-sales-handler-adjust-dialog form {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
}

.global-sales-handler-adjust-dialog header,
.global-sales-handler-adjust-dialog footer {
  flex: 0 0 auto;
  padding: 9px 12px;
}

.global-sales-handler-adjust-dialog header h3,
.global-sales-handler-adjust-dialog header p {
  margin: 0;
}

.global-sales-handler-adjust-dialog header p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.global-sales-handler-adjust-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 12px;
  overflow: auto;
}

.global-sales-handler-adjust-dialog table {
  width: 100%;
  border-collapse: collapse;
}

.global-sales-handler-adjust-dialog th,
.global-sales-handler-adjust-dialog td {
  padding: 6px 7px;
  border: 1px solid var(--line);
  font-size: 12px;
}

.global-sales-handler-adjust-dialog select {
  min-width: 110px;
  padding: 5px 7px;
}

@media (max-width: 920px) {
  .dispatch-planner-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .dispatch-stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .dispatch-planner-grid {
    grid-template-columns: 1fr;
  }
}

.dispatch-summary-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.dispatch-summary-card strong {
  color: var(--text);
  font-size: 14px;
}

.dispatch-summary-title {
  cursor: pointer;
}

.dispatch-summary-card.waiting {
  border-color: #f0b7a8;
  background: #fff7f4;
}

.dispatch-order-count {
  color: var(--bad);
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.dispatch-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dispatch-summary-actions button {
  padding: 6px 8px;
  font-size: 12px;
}

.dispatch-customer-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 25px;
}

.dispatch-customer-preview span,
.dispatch-customer-preview em {
  padding: 3px 6px;
  border-radius: 999px;
  background: #eef5f5;
  color: var(--text);
  font-size: 12px;
  font-style: normal;
}

.dispatch-message-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.dispatch-message-grid label {
  min-width: 0;
}

.dispatch-message-grid textarea {
  min-height: 360px;
  resize: vertical;
}

@media (max-width: 1280px) {
  .dispatch-message-grid {
    grid-auto-columns: minmax(160px, 1fr);
  }
}

.dispatch-vehicle-select {
  min-width: 150px;
}

.dispatch-pick-sheet {
  break-inside: avoid;
  scroll-margin-top: 128px;
}

.print-only {
  display: none;
}

.dispatch-pick-head {
  align-items: stretch;
  background: #fbfcfc;
}

.dispatch-pick-head h3 {
  font-size: 20px;
}

.dispatch-detail-panel {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fffdf7;
}

.dispatch-detail-list {
  display: grid;
  gap: 8px;
}

.dispatch-customer-list {
  display: grid;
  gap: 8px;
}

.dispatch-customer-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.dispatch-customer-item small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.dispatch-customer-overview {
  margin-bottom: 14px;
  border-color: #b9d8d4;
}

.dispatch-customer-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.dispatch-customer-table {
  min-width: 1080px;
}

.dispatch-customer-table th,
.dispatch-customer-table td {
  border: 1px solid var(--line);
}

.dispatch-customer-table tfoot td {
  background: #f7fbfa;
  font-weight: 800;
}

.dispatch-detail-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.dispatch-detail-item strong {
  white-space: pre-line;
}

.dispatch-pick-footer span {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.dispatch-pick-table {
  min-width: 980px;
}

.dispatch-pick-table th,
.dispatch-pick-table td {
  border: 1px solid var(--line);
}

.dispatch-pick-table tr.dispatch-unarranged-row td {
  background: #fff6e5;
}

.dispatch-pick-table tr.dispatch-unarranged-row td:first-child {
  border-left: 4px solid var(--warn);
}

.dispatch-pick-table th:nth-child(1),
.dispatch-pick-table td:nth-child(1) {
  width: 52px;
  text-align: center;
}

.dispatch-pick-table th:nth-child(3),
.dispatch-pick-table td:nth-child(3) {
  min-width: 150px;
}

.dispatch-pick-table th:nth-child(4),
.dispatch-pick-table td:nth-child(4) {
  min-width: 280px;
}

.dispatch-pick-table th:nth-child(5),
.dispatch-pick-table td:nth-child(5) {
  width: 130px;
}

.dispatch-order-main-row td {
  vertical-align: middle;
}

.dispatch-order-summary {
  display: -webkit-box;
  overflow: hidden;
  max-width: 100%;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dispatch-load-summary {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.dispatch-order-detail-row > td {
  padding: 10px 12px;
  background: #f8fbfa;
}

.dispatch-order-detail-row .dispatch-line-items {
  min-width: 0;
}

.dispatch-inline-input {
  min-width: 90px;
  padding: 7px 8px;
}

.dispatch-inline-textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
}

.dispatch-line-items {
  display: grid;
  gap: 4px;
  min-width: 420px;
}

.dispatch-line-items-head,
.dispatch-line-item-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 100px;
  gap: 6px;
  align-items: stretch;
}

.dispatch-line-items-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dispatch-line-detail {
  min-height: 34px;
  resize: vertical;
}

.dispatch-line-quantity {
  min-width: 86px;
}

.dispatch-customer-table td:nth-child(2) .dispatch-inline-input,
.dispatch-customer-table td:nth-child(6) .dispatch-inline-input {
  min-width: 140px;
}

.dispatch-no {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.dispatch-pick-footer {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

.compact-select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-btn {
    flex: 0 0 220px;
  }

  .main {
    padding: 0 14px 22px;
  }

  .topbar {
    top: 92px;
    margin: 0 -14px 14px;
    padding: 14px;
  }

  .group-tabs {
    top: 178px;
    margin: -14px -14px 14px;
    padding-inline: 14px;
  }

  .kpis,
  .grid,
  .fields,
  .notice-box,
  .trace-summary {
    grid-template-columns: 1fr;
  }

  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
  }

  .page-editor-head {
    flex-direction: column;
  }

  .page-fields {
    grid-template-columns: 1fr;
  }

  .inbound-fields > *,
  .inbound-fields .inbound-metric {
    grid-column: 1 / -1;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;

    @bottom-right {
      content: "";
      font-size: 9pt;
    }
  }

  body {
    display: block;
    background: #fff;
  }

  .sidebar,
  .topbar,
  .toolbar,
  .subtabs,
  .dispatch-date-panel,
  .dispatch-import,
  .daily-driver-compact,
  .dispatch-overview,
  .dispatch-detail-panel,
  .dispatch-pick-head,
  .dispatch-pick-table,
  .dispatch-vehicle-select,
  .table-actions,
  .dispatch-pick-table th:nth-child(6),
  .dispatch-pick-table td:nth-child(6),
  .dispatch-pick-table th:nth-child(7),
  .dispatch-pick-table td:nth-child(7) {
    display: none !important;
  }

  .main {
    padding: 0;
  }

  .panel,
  .dispatch-pick-sheet {
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    page-break-inside: auto;
    break-inside: auto;
  }

  .dispatch-pick-sheet {
    page-break-after: always;
  }

  .dispatch-pick-sheet:last-child {
    page-break-after: auto;
  }

  body.print-dispatch-single .dispatch-pick-sheet {
    display: none !important;
  }

  body.print-dispatch-single .dispatch-pick-sheet.print-target {
    display: block !important;
    page-break-after: auto;
  }

  .dispatch-pick-head,
  .dispatch-pick-footer {
    background: #fff;
  }

  .print-only {
    display: block;
  }

  .dispatch-print-pages {
    display: block;
  }

  .dispatch-print-page {
    position: relative;
    display: block;
    width: 210mm;
    min-height: 297mm;
    overflow: hidden;
    box-sizing: border-box;
    page-break-after: always;
    break-after: page;
    background: #fff;
  }

  .dispatch-print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .dispatch-pick-footer span {
    border-color: #222;
    border-radius: 0;
    background: #fff;
  }

  .panel-body {
    overflow: visible;
  }

  .dispatch-print-head {
    padding: 10mm 8mm 7mm;
    border-bottom: 2px solid #111;
  }

  .dispatch-print-system {
    display: block;
    text-align: center;
  }

  .dispatch-print-system strong {
    font-size: 20px;
    letter-spacing: 0;
  }

  .dispatch-print-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
  }

  .dispatch-print-title h2 {
    margin: 0;
    font-size: 24px;
  }

  .dispatch-print-title span {
    min-width: 160px;
    text-align: right;
    font-size: 16px;
    font-weight: 800;
    transform: translateX(-15ch);
  }

  .dispatch-print-orders {
    display: block;
    padding: 7mm 14mm 28mm 8mm;
  }

  .dispatch-print-column {
    display: grid;
    align-content: start;
    gap: 8px;
  }

  .dispatch-print-note-space {
    display: none;
  }

  .dispatch-print-note-space::before {
    content: "备注";
    position: absolute;
    top: 8px;
    left: 10px;
    color: #555;
    font-size: 12pt;
    font-weight: 800;
  }

  .dispatch-print-order {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 6px;
    min-height: 52px;
    padding: 7px;
    border: 0;
    box-sizing: border-box;
    break-inside: avoid;
  }

  .dispatch-print-order span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid #222;
    font-size: 13px;
    font-weight: 800;
  }

  .dispatch-print-order p {
    margin: 0;
    color: #000;
    font-size: 12pt;
    line-height: 1.35;
    white-space: pre-line;
  }

  .dispatch-print-order strong {
    display: block;
    margin-bottom: 5px;
    color: #000;
    font-size: 12pt;
  }

  .dispatch-print-line-table {
    width: calc(100% - 2mm);
    margin-right: 2mm;
    border-collapse: collapse;
    border: 1px solid #222;
    color: #000;
    font-size: 12pt;
    table-layout: fixed;
    box-sizing: border-box;
  }

  .dispatch-print-line-table th,
  .dispatch-print-line-table td {
    padding: 5px 6px;
    border: 1px solid #222;
    text-align: left;
    vertical-align: top;
    box-sizing: border-box;
  }

  .dispatch-print-line-table th:first-child,
  .dispatch-print-line-table td:first-child {
    width: 50%;
  }

  .dispatch-print-line-table th:last-child,
  .dispatch-print-line-table td:last-child {
    width: 50%;
    padding-left: 6px;
    border-right: 1px solid #222;
  }

  .dispatch-print-line-table th {
    border-bottom: 1px solid #222;
  }

  .dispatch-print-line-table tbody tr + tr td {
    border-top: 1px dashed #c9c9c9;
  }

  .dispatch-print-line-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .dispatch-print-order.dispatch-unarranged-row {
    background: #fff2cc !important;
  }

  .dispatch-print-footer {
    position: absolute;
    right: 8mm;
    bottom: 5mm;
    left: 8mm;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    align-items: center;
    border-top: 1px solid #222;
    padding-top: 3mm;
    color: #000;
    font-size: 10pt;
  }

  .dispatch-print-footer span:last-child {
    justify-self: end;
  }

  .dispatch-print-page-count::after {
    content: "";
  }

  .dispatch-driver-list-print {
    display: none;
  }

  body.print-driver-list .dispatch-date-panel,
  body.print-driver-list .dispatch-print-pages,
  body.print-driver-list .dispatch-print-head,
  body.print-driver-list .dispatch-print-orders,
  body.print-driver-list .dispatch-print-footer {
    display: none !important;
  }

  body.print-driver-list .dispatch-driver-list-print {
    display: block !important;
    padding: 10mm 8mm;
  }

  .dispatch-driver-list-page {
    page-break-after: always;
  }

  .dispatch-driver-list-page:last-child {
    page-break-after: auto;
  }

  .dispatch-driver-list-head {
    display: grid;
    width: calc(100% - 5mm);
    grid-template-columns: 1fr auto;
    gap: 6px 16px;
    align-items: start;
    margin-bottom: 14px;
    color: #000;
  }

  .dispatch-driver-list-head h2 {
    grid-column: 1 / -1;
    margin: 0;
    text-align: center;
    font-size: 20pt;
  }

  .dispatch-driver-list-head span {
    font-size: 12pt;
  }

  .dispatch-driver-list-head strong {
    justify-self: end;
    font-size: 13pt;
  }

  .dispatch-driver-print-table {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    border-collapse: collapse;
    border: 0;
    font-size: 12pt;
    table-layout: fixed;
  }

  .dispatch-driver-print-table-frame {
    width: calc(100% - 5mm);
    margin-right: 5mm;
    box-sizing: border-box;
    border: 2px solid #222;
    overflow: hidden;
  }

  .dispatch-driver-print-table th,
  .dispatch-driver-print-table td {
    box-sizing: border-box;
    padding: 5px 5px;
    border: 1px solid #222;
    color: #000;
    text-align: left;
    vertical-align: top;
  }

  .dispatch-driver-print-table th:nth-child(1),
  .dispatch-driver-print-table td:nth-child(1) {
    width: 8mm;
    text-align: center;
  }

  .dispatch-driver-print-table th:nth-child(2),
  .dispatch-driver-print-table td:nth-child(2) {
    width: 32mm;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .dispatch-driver-print-table th:nth-child(3),
  .dispatch-driver-print-table td:nth-child(3) {
    width: 17mm;
  }

  .dispatch-driver-print-table th:nth-child(4),
  .dispatch-driver-print-table td:nth-child(4),
  .dispatch-driver-print-table th:nth-child(7),
  .dispatch-driver-print-table td:nth-child(7) {
    width: 21mm;
  }

  .dispatch-driver-print-table th:nth-child(5),
  .dispatch-driver-print-table td:nth-child(5),
  .dispatch-driver-print-table th:nth-child(6),
  .dispatch-driver-print-table td:nth-child(6) {
    width: 15mm;
  }

  .dispatch-driver-print-table th:nth-child(8),
  .dispatch-driver-print-table td:nth-child(8) {
    width: 22mm;
    white-space: normal;
    overflow-wrap: anywhere;
    border-right: 0;
  }

  .dispatch-driver-print-table tfoot td {
    font-weight: 800;
  }

  .dispatch-driver-print-table thead tr:first-child > th {
    border-top: 0;
  }

  .dispatch-driver-print-table tr > :first-child {
    border-left: 0;
  }

  .dispatch-driver-print-table tr > :last-child,
  .dispatch-driver-print-table tfoot tr > :last-child {
    border-right: 0;
  }

  .dispatch-driver-print-table tbody tr:last-child > td,
  .dispatch-driver-print-table tfoot tr:last-child > td {
    border-bottom: 0;
  }

  .dispatch-empty-customer-row td {
    height: 8mm;
  }
}


@media (max-width: 640px) {
  body {
    display: block;
    font-size: 14px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 8px 10px;
    box-shadow: 0 10px 24px rgba(29, 41, 57, 0.08);
  }

  .brand {
    gap: 9px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 7px;
  }

  .brand-mark img {
    width: 39px;
    height: 39px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand span {
    font-size: 11px;
  }

  .user-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px 8px;
  }

  .user-box button {
    width: auto;
    min-height: 32px;
    padding: 5px 10px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 1px 0 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 112px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    min-height: 58px;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--line);
    background: #fff;
  }

  .nav-icon {
    display: none;
  }

  .nav-copy {
    justify-items: center;
    text-align: center;
  }

  .nav-copy small {
    display: none;
  }

  .nav-count {
    display: inline-flex;
    min-width: 18px;
    justify-content: center;
  }

  .main {
    padding: 0 10px 18px;
  }

  .topbar {
    top: 116px;
    gap: 10px;
    min-height: auto;
    margin: 0 -10px 14px;
    padding: 12px 10px;
  }

  .group-tabs {
    display: flex;
    gap: 8px;
    top: 236px;
    margin: -14px -10px 12px;
    padding: 8px 10px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .module-switcher-card {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: 9px 12px 10px;
  }

  h1 {
    font-size: 22px;
  }

  .topbar p,
  .muted {
    font-size: 13px;
  }

  .actions,
  .toolbar .actions {
    width: 100%;
    gap: 8px;
  }

  .actions button,
  .toolbar .actions button,
  .toolbar .actions select {
    flex: 1 1 auto;
    min-width: 0;
  }

  button {
    min-height: 40px;
    padding: 9px 11px;
  }

  input,
  select,
  textarea {
    min-height: 40px;
    font-size: 16px;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 12px;
  }

  .kpi strong {
    font-size: 20px;
  }

  .panel,
  dialog {
    border-radius: 7px;
  }

  .panel header,
  dialog header {
    padding: 12px;
  }

  .panel-body {
    overflow-x: auto;
  }

  .payroll-editor-list > label,
  .payroll-month-block > label,
  .payroll-editor-meta label {
    grid-template-columns: 126px 138px 124px;
    gap: 8px;
  }

  .payroll-month-head {
    grid-template-columns: 56px 90px minmax(140px, 1fr);
  }

  .payroll-editor-list input,
  .payroll-editor-list select,
  .payroll-editor-list output {
    width: 124px;
    text-align: right;
  }

  .payroll-summary-strip {
    grid-template-columns: repeat(5, minmax(145px, 1fr));
    padding: 10px;
  }

  .payroll-toolbar {
    align-items: stretch;
  }

  .payroll-toolbar .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .payroll-toolbar .toolbar-month {
    grid-column: span 2;
    width: 100%;
  }

  .payroll-year-editor .page-editor-head {
    align-items: stretch;
  }

  .payroll-year-editor .page-editor-head .actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .year-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .health-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .health-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-kpis {
    grid-template-columns: 1fr;
  }

  .risk-panel td:nth-child(3) {
    min-width: 220px;
    white-space: normal;
    overflow: visible;
  }

  .permission-designer-head {
    align-items: stretch;
    flex-direction: column;
  }

  .permission-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .permission-tools select {
    grid-column: span 2;
  }

  .permission-levels {
    grid-template-columns: 1fr;
  }

  .permission-module-row {
    grid-template-columns: 1fr;
  }

  .permission-action-list {
    grid-template-columns: 1fr 1fr;
  }

  .user-capacity-bar {
    align-items: stretch;
    flex-direction: column;
    min-width: 680px;
  }

  .user-pager {
    justify-content: flex-start;
  }

  .table-summary {
    min-width: 620px;
    padding: 8px 10px;
  }

  .summary-chip {
    padding: 6px 8px;
  }

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 9px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  td {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .table-actions {
    flex-wrap: nowrap;
  }

  .table-actions .text-action {
    min-width: 52px;
  }

  .toolbar {
    gap: 8px;
  }

  .inventory-toolbar-actions {
    flex-wrap: wrap;
  }

  .inventory-toolbar-actions select {
    max-width: none;
    width: 100%;
  }

  .search-wrap {
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .search-wrap input {
    min-width: 0;
  }

  .search-suggestions {
    width: 100%;
  }

  dialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  dialog form {
    max-height: calc(100vh - 12px);
  }

  .fields {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
    max-height: none;
  }

  .family-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .family-row {
    grid-template-columns: 1fr;
  }

  .pdf-upload-box {
    grid-template-columns: 1fr;
  }

  .document-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .document-upload-panel,
  .document-history-row {
    grid-template-columns: 1fr;
  }

  dialog footer {
    padding: 12px;
  }

  dialog footer button {
    flex: 1 1 0;
  }

  .page-editor {
    min-height: auto;
    border-radius: 7px;
  }

  .page-editor-head {
    padding: 12px;
  }

  .page-editor-head h2 {
    font-size: 20px;
  }

  .page-fields {
    grid-template-columns: 1fr;
    padding: 12px;
    max-height: none;
  }

  .notice-box,
  .trace-summary {
    grid-template-columns: 1fr;
  }

  .lot-picker table {
    min-width: 980px;
  }

  .sale-lines input {
    min-width: 76px;
  }

  .dispatch-batch-grid,
  .dispatch-overview-grid,
  .dispatch-summary-grid,
  .dispatch-vehicle-grid,
  .dispatch-customer-grid {
    grid-template-columns: 1fr;
  }

  .dispatch-pick-footer {
    grid-template-columns: 1fr;
  }

  .dispatch-line-items,
  .dispatch-line-items-head,
  .dispatch-line-item-row {
    min-width: 320px;
  }

  .dispatch-line-items-head,
  .dispatch-line-item-row {
    grid-template-columns: minmax(190px, 1fr) 88px;
  }
}

@media (max-width: 420px) {
  .kpis {
    grid-template-columns: 1fr;
  }

  .search-wrap {
    grid-template-columns: 1fr;
  }

  .search-wrap button {
    width: 100%;
  }

  table {
    min-width: 620px;
  }

  .table-summary {
    min-width: 560px;
  }

  .nav-btn {
    min-width: 86px;
    padding-inline: 8px;
  }

  .brand strong {
    font-size: 13px;
  }
}

/* Final desktop contract for the inbound editor. Keep this after all generic
   compact/responsive rules so the requested row layout cannot be overridden. */
@media (min-width: 701px) {
  .compact-create-editor.inbound-create-editor .inbound-fields {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-warehouseProductName {
    grid-column: span 8;
  }

  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-lot-no {
    grid-column: span 4;
  }

  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-ownership {
    grid-column: 1 / span 4;
  }

  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-metric {
    grid-column: span 3;
    gap: 2px;
    font-size: 12px;
    line-height: 1.15;
  }

  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-metric input {
    min-height: 29px;
    height: 29px;
    padding: 3px 7px;
    font-size: 14px;
  }
}

/* 单据一览：按可用屏幕宽度分配列，给长备注保留完整阅读空间。 */
.b2b-receivable-panel .b2b-order-list-table {
  width: 100%;
  min-width: 1180px;
  table-layout: auto;
}

.b2b-receivable-panel .b2b-order-list-table th,
.b2b-receivable-panel .b2b-order-list-table td {
  padding: 4px 5px;
  line-height: 1.32;
}

.b2b-receivable-panel .b2b-order-list-table td[data-label="销售日期"] {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  white-space: nowrap;
}

.b2b-receivable-panel .b2b-order-list-table td[data-label="销售单号"] {
  width: 128px;
  min-width: 112px;
  max-width: 138px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.b2b-receivable-panel .b2b-order-list-table th:nth-last-child(2),
.b2b-receivable-panel .b2b-order-list-table td[data-label="备注"] {
  width: clamp(190px, 16vw, 270px);
  min-width: 190px;
  max-width: 270px;
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict;
  text-overflow: clip;
}

.b2b-receivable-panel .b2b-order-list-table td[data-label="备注"] {
  height: auto;
  font-size: 11px;
  line-height: 1.28;
  vertical-align: top;
}

.b2b-receivable-panel .b2b-order-list-table td.b2b-note-medium {
  font-size: 10px;
}

.b2b-receivable-panel .b2b-order-list-table td.b2b-note-long {
  font-size: 9px;
  line-height: 1.24;
}

.b2b-receivable-panel .b2b-order-list-table td[data-label="操作"] {
  width: 1%;
  min-width: 188px;
  white-space: nowrap;
}

.b2b-receivable-panel .b2b-order-list-table .b2b-col-customer {
  width: 126px;
  min-width: 116px;
  max-width: 146px;
}

.b2b-receivable-panel .b2b-order-list-table td.b2b-customer-single-line {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.b2b-receivable-panel .b2b-order-list-table td.b2b-customer-wrap {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict;
}

.b2b-receivable-panel .b2b-order-list-table .b2b-col-money {
  width: 82px;
  min-width: 76px;
  max-width: 92px;
  white-space: nowrap;
}

.b2b-receivable-panel .b2b-order-list-table .b2b-col-status {
  width: 64px;
  min-width: 58px;
  max-width: 76px;
  white-space: normal;
}

.b2b-receivable-panel .b2b-order-list-table .b2b-col-actions {
  min-width: 188px;
}

@media (max-width: 900px) {
  .b2b-receivable-panel .b2b-order-list-table.adaptive-data-table {
    min-width: 0;
  }

  .b2b-receivable-panel .b2b-order-list-table.adaptive-data-table td[data-label="销售日期"],
  .b2b-receivable-panel .b2b-order-list-table.adaptive-data-table td[data-label="销售单号"],
  .b2b-receivable-panel .b2b-order-list-table.adaptive-data-table td[data-label="备注"],
  .b2b-receivable-panel .b2b-order-list-table.adaptive-data-table td[data-label="操作"] {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .b2b-receivable-panel .b2b-order-list-table.adaptive-data-table td[data-label="备注"] {
    grid-template-columns: minmax(82px, 0.35fr) minmax(0, 2.65fr);
  }
}

/* Explicit field coordinates: do not let grid auto-placement move fields into
   a preceding row when another generic form rule changes their width. */
@media (min-width: 701px) {
  #editor .inbound-fields .inbound-field-warehouseProductName {
    grid-column: 1 / span 8 !important;
  }
  #editor .inbound-fields .inbound-field-lotNo {
    grid-column: 9 / span 4 !important;
  }
  #editor .inbound-fields .inbound-field-ownership {
    grid-column: 1 / span 4 !important;
  }
  #editor .inbound-fields .inbound-field-ownershipName {
    grid-column: 5 / span 4 !important;
  }
  #editor .inbound-fields .inbound-field-status {
    grid-column: 9 / span 4 !important;
  }
  #editor .inbound-fields .inbound-field-boxes {
    grid-column: 1 / span 3 !important;
  }
  #editor .inbound-fields .inbound-field-weightKg {
    grid-column: 4 / span 3 !important;
  }
  #editor .inbound-fields .inbound-field-unitPrice {
    grid-column: 7 / span 3 !important;
  }
  #editor .inbound-fields .inbound-field-averageBoxWeightKg {
    grid-column: 10 / span 3 !important;
  }
}

.sales-order-editor.compact-create-editor {
  border: 1px solid #cbded9;
  background: linear-gradient(180deg, #f5fbf9 0, #fff 150px);
  box-shadow: 0 18px 46px rgba(20, 70, 65, 0.13);
}

.sales-order-editor.compact-create-editor .page-editor-head {
  border-bottom-color: #d7e7e3;
}

.sales-order-editor.compact-create-editor .page-fields {
  background: rgba(255, 255, 255, 0.74);
}

input[data-calendar-kind] {
  padding-right: 46px;
  border-color: #bfd2ce;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='21' viewBox='0 0 24 24'%3E%3Crect x='3' y='4.5' width='18' height='16.5' rx='3' fill='%23ffffff' stroke='%230f766e' stroke-width='1.7'/%3E%3Cpath d='M3.8 9.2h16.4V7.3a2 2 0 0 0-2-2H5.8a2 2 0 0 0-2 2z' fill='%230f766e'/%3E%3Cpath d='M8 3v4M16 3v4' stroke='%230f766e' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='13' r='1' fill='%2349a89d'/%3E%3Ccircle cx='12' cy='13' r='1' fill='%2349a89d'/%3E%3Ccircle cx='16' cy='13' r='1' fill='%2349a89d'/%3E%3C/svg%3E") right 10px center / 21px 21px no-repeat,
    linear-gradient(to right, transparent calc(100% - 42px), #e7f4f1 calc(100% - 42px));
  cursor: pointer;
}

.custom-calendar-picker {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: 10000;
  width: 310px;
  padding: 12px;
  border: 1px solid #c9ddd8;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(22, 64, 60, 0.2);
  backdrop-filter: blur(12px);
}

.custom-calendar-picker:popover-open {
  display: block;
}

.custom-calendar-picker[hidden] {
  display: none;
}

.custom-calendar-head,
.custom-calendar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-calendar-head {
  padding-bottom: 10px;
  border-bottom: 1px solid #edf3f1;
}

.custom-calendar-head strong {
  color: #173f3b;
  font-size: 16px;
}

.custom-calendar-head button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: #edf7f5;
  color: #0f766e;
  font-size: 24px;
}

.custom-calendar-week,
.custom-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.custom-calendar-week {
  padding: 10px 0 5px;
  color: #7a8e8b;
  font-size: 12px;
  font-weight: 700;
}

.custom-calendar-days {
  gap: 3px;
}

.custom-calendar-days button,
.custom-calendar-months button {
  min-height: 34px;
  padding: 0;
  border-radius: 9px;
  background: transparent;
  color: #263c3a;
}

.custom-calendar-days button:hover,
.custom-calendar-months button:hover {
  background: #e9f6f3;
  color: #0b6d65;
}

.custom-calendar-days button.today {
  box-shadow: inset 0 0 0 1px #55a99f;
}

.custom-calendar-days button.selected,
.custom-calendar-months button.selected {
  background: #0f766e;
  color: #fff;
  box-shadow: 0 5px 12px rgba(15, 118, 110, 0.25);
}

.custom-calendar-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 12px 0;
}

.custom-calendar-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #edf3f1;
}

.custom-calendar-foot button {
  padding: 6px 11px;
  border-radius: 9px;
  background: #edf7f5;
  color: #0f766e;
  font-size: 13px;
}

dialog.compact-create-editor.inbound-create-editor {
  width: min(840px, calc(100vw - 24px));
}

.compact-create-editor.inbound-create-editor .inbound-fields .inbound-wide-name {
  grid-column: span 6;
}

.compact-create-editor.inbound-create-editor .inbound-fields .inbound-warehouseProductName {
  grid-column: span 8;
}

.compact-create-editor.inbound-create-editor .inbound-fields .inbound-lot-no {
  grid-column: span 4;
}

.compact-create-editor.inbound-create-editor .inbound-fields .inbound-ownership {
  grid-column: 1 / span 4;
}

.compact-create-editor.inbound-create-editor .inbound-wide-name input,
.compact-create-editor.inbound-create-editor .inbound-wide-name select {
  min-height: 36px;
  font-size: 16px;
}

.inbound-fields input.ownership-name-disabled,
.inbound-fields input.ownership-name-disabled:hover,
.inbound-fields input.ownership-name-disabled:focus {
  cursor: not-allowed;
  border-color: #d5dddc;
  background: #edf1f0;
  color: #8a9694;
  box-shadow: none;
}

@media (max-width: 700px) {
  dialog.compact-create-editor.inbound-create-editor {
    width: calc(100vw - 12px);
  }

  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-wide-name {
    grid-column: 1 / -1;
  }
}

/* Browser-width adaptive pass: keep every module inside the usable viewport. */
.main,
.view,
#dashboard,
#table-view,
.panel,
.panel-body {
  min-inline-size: 0;
}

.main {
  overflow-x: clip;
}

.panel-body input,
.panel-body select,
.panel-body textarea,
.toolbar input,
.toolbar select,
.inline-filter-group input,
.inline-filter-group select {
  max-width: 100%;
}

.b2b-receivable-panel > header {
  gap: clamp(8px, 1.2vw, 16px);
}

.b2b-receivable-panel > header > div:first-child {
  flex: 1 1 360px;
  min-width: 0;
}

.b2b-receivable-panel > header .inline-filter-group {
  flex: 1 1 620px;
  justify-content: flex-end;
  min-width: 0;
}

.b2b-bulk-save-bar {
  flex-wrap: wrap;
  gap: 8px 14px;
}

.b2b-bulk-save-bar button {
  margin-left: auto;
}

.b2b-order-list-table {
  width: 100%;
  min-width: 980px;
}

.b2b-order-list-table th,
.b2b-order-list-table td {
  max-width: min(230px, 18vw);
}

.b2b-order-list-table td[data-label="客户名称"],
.b2b-order-list-table td[data-label="备注"] {
  white-space: normal;
  overflow-wrap: anywhere;
}

.b2b-order-list-table td[data-label="操作"] {
  max-width: none;
}

@media (max-width: 900px) {
  .b2b-receivable-panel > header {
    align-items: stretch;
  }

  .b2b-receivable-panel > header > div:first-child,
  .b2b-receivable-panel > header .inline-filter-group {
    flex-basis: 100%;
    width: 100%;
  }

  .b2b-receivable-panel > header .inline-filter-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .b2b-receivable-panel > header .inline-filter,
  .b2b-receivable-panel > header .inline-filter input,
  .b2b-receivable-panel > header .inline-filter select,
  .b2b-receivable-panel > header .inline-filter-group > button {
    width: 100%;
    min-width: 0;
  }

  .b2b-receivable-panel .compact-table-wrap {
    max-height: none;
    overflow: visible;
    padding: 8px;
    background: #f4f7f8;
  }

  .b2b-order-list-table.adaptive-data-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .b2b-order-list-table.adaptive-data-table thead {
    display: none;
  }

  .b2b-order-list-table.adaptive-data-table tbody {
    display: grid;
    gap: 10px;
  }

  .b2b-order-list-table.adaptive-data-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    border: 1px solid #dce5e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(21, 52, 60, 0.05);
  }

  .b2b-order-list-table.adaptive-data-table td {
    display: grid;
    grid-template-columns: minmax(82px, 0.7fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: none;
    min-height: 38px;
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px solid #edf1f2;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .b2b-order-list-table.adaptive-data-table td::before {
    content: attr(data-label);
    color: #607078;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
  }

  .b2b-order-list-table.adaptive-data-table td[data-label="销售单号"],
  .b2b-order-list-table.adaptive-data-table td[data-label="客户名称"],
  .b2b-order-list-table.adaptive-data-table td[data-label="备注"],
  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] {
    grid-column: 1 / -1;
  }

  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] {
    background: #f7fbfa;
  }

  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] .table-actions {
    flex-wrap: wrap;
  }

  .b2b-order-list-table.adaptive-data-table .inline-money-input.b2b-adjustment-input,
  .b2b-order-list-table.adaptive-data-table .inline-reason-input.b2b-adjustment-input {
    width: 100%;
    min-width: 0;
  }

  .b2b-order-list-table.adaptive-data-table .select-column {
    grid-template-columns: 82px 1fr;
    grid-column: 1 / -1;
    background: #f7fbfa;
  }

  .b2b-order-list-table.adaptive-data-table tr.empty-row td {
    display: block;
    grid-column: 1 / -1;
    text-align: center;
  }

  .b2b-order-list-table.adaptive-data-table tr.empty-row td::before {
    content: none;
  }
}

@media (max-width: 560px) {
  .b2b-receivable-panel > header .inline-filter-group {
    grid-template-columns: 1fr;
  }

  .b2b-bulk-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .b2b-bulk-save-bar button {
    width: 100%;
    margin-left: 0;
  }

  .b2b-order-list-table.adaptive-data-table tr {
    grid-template-columns: 1fr;
  }

  .b2b-order-list-table.adaptive-data-table td {
    grid-column: 1 / -1;
    grid-template-columns: minmax(78px, 0.55fr) minmax(0, 1.45fr);
  }

  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] {
    display: block;
  }

  .b2b-order-list-table.adaptive-data-table td[data-label="操作"]::before {
    display: block;
    margin-bottom: 7px;
  }

  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] .table-actions,
  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] button,
  .b2b-order-list-table.adaptive-data-table td[data-label="操作"] select {
    width: 100%;
  }
}

.finance-income-quick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 8px 0 10px;
}

.finance-income-tools-above {
  margin-top: 0;
}

.finance-income-action-cards {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr) minmax(330px, 1.08fr) minmax(220px, 0.72fr);
  gap: 8px;
  min-width: 0;
}

.finance-income-quick-row .finance-erp-upload-card,
.finance-income-quick-row .finance-bank-payment-card,
.finance-income-quick-row .kpi-grid {
  margin: 0;
}

.finance-income-quick-row .finance-erp-upload-card header,
.finance-income-quick-row .finance-bank-payment-card header {
  padding: 9px 11px 7px;
}

.finance-income-quick-row .finance-erp-dropzone {
  min-height: 78px;
  gap: 3px;
  padding: 8px 10px;
}

.finance-bank-payment-card textarea {
  min-height: 78px;
  max-height: 78px;
  padding: 8px 10px;
  resize: vertical;
}

.b2b-receivable-panel > header {
  flex-wrap: nowrap;
}

.b2b-receivable-panel > header .inline-filter-group {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.finance-income-inline-kpis {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.finance-income-inline-kpi {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  white-space: nowrap;
}

.finance-income-inline-kpi em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.finance-income-inline-kpi strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1;
}

.finance-income-category-kpis {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}

.finance-income-category-kpis .kpi {
  min-height: 60px;
  padding: 8px 10px;
}

.finance-income-category-kpis .kpi span {
  font-size: 11px;
}

.finance-income-category-kpis .kpi strong {
  margin-top: 4px;
  font-size: 19px;
}

.finance-income-category-actions {
  min-width: 112px;
}

.finance-income-category-actions .b2b-move-action-select {
  width: 112px;
}

.finance-income-workspace > header {
  align-items: center;
  padding: 10px 14px;
}

.finance-income-workspace > header h3 {
  margin-bottom: 2px;
}

.finance-income-workspace > header .muted {
  margin-bottom: 0;
  font-size: 12px;
}

.finance-income-workspace-body > .finance-income-subnav {
  gap: 5px;
  margin-bottom: 8px;
  padding: 4px;
}

.finance-income-workspace-body > .finance-income-subnav button {
  min-height: 36px;
  padding: 6px 10px;
}

.finance-income-action-cards .panel h3 {
  font-size: 14px;
}

.finance-income-action-cards .panel header .muted {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.35;
}

.finance-income-action-cards .panel-body {
  padding: 8px 10px 10px;
}

.finance-income-action-cards .finance-erp-upload-split {
  gap: 8px;
}

.finance-erp-upload-split.finance-erp-upload-single {
  grid-template-columns: minmax(0, 1fr);
}

.finance-income-management-launcher .panel-body {
  padding: 8px 10px 10px;
}

.bank-receipt-lock {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.bank-receipt-unlock-button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 11px;
}

.bank-receipt-latest {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 2px 7px;
  align-items: center;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.bank-receipt-lock .bank-receipt-latest {
  flex: 1 1 auto;
}

.bank-receipt-latest span,
.bank-receipt-latest small {
  color: var(--muted);
  font-size: 9px;
}

.bank-receipt-latest strong {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-receipt-latest b {
  font-size: 13px;
  white-space: nowrap;
}

.bank-receipt-latest small {
  grid-column: 2 / 4;
}

.bank-receipt-latest.empty-latest {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.finance-bank-receipts-card:not(:has(.bank-receipt-lock)) .bank-receipt-latest {
  margin-bottom: 6px;
}

.bank-receipt-card-preview {
  display: grid;
  gap: 5px;
}

.bank-receipt-pending-preview {
  max-height: 174px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.bank-receipt-pending-item {
  display: grid;
  grid-template-columns: 82px minmax(100px, 1fr) auto 72px;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  background: #fff;
  text-align: left;
  scroll-snap-align: start;
}

.bank-receipt-pending-item:last-child {
  border-bottom: 0;
}

.bank-receipt-pending-item:hover {
  background: var(--primary-soft);
}

.bank-receipt-pending-item span,
.bank-receipt-pending-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.bank-receipt-pending-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-receipt-pending-item b {
  color: var(--text);
  white-space: nowrap;
}

.bank-receipt-pending-item em {
  color: #b45309;
  text-align: right;
  white-space: nowrap;
}

.bank-receipt-title-link {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}

.bank-receipt-title-link:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bank-receipt-summary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
}

.bank-receipt-summary-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.bank-receipt-summary-button span {
  color: var(--muted);
  font-size: 10px;
}

.bank-receipt-card-preview > small {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.bank-receipt-ticker {
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.bank-receipt-ticker-track:has(.bank-receipt-ticker-item:nth-child(2)) {
  animation: bank-receipt-scroll 12s linear infinite;
}

.bank-receipt-ticker:hover .bank-receipt-ticker-track {
  animation-play-state: paused;
}

.bank-receipt-ticker-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 2px 7px;
  align-items: center;
  height: 48px;
  padding: 5px 8px;
}

.bank-receipt-ticker-item span,
.bank-receipt-ticker-item small {
  color: var(--muted);
  font-size: 9px;
}

.bank-receipt-ticker-item strong {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-receipt-ticker-item b {
  font-size: 13px;
  white-space: nowrap;
}

.bank-receipt-ticker-item small {
  grid-column: 2 / 4;
}

@keyframes bank-receipt-scroll {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

.bank-receipt-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 7px;
}

.bank-receipt-secondary-entry {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.bank-receipt-entry-locked {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #f8fafc;
  font-size: 10px;
}

.bank-receipt-search-bar {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.bank-receipt-search-bar label {
  display: grid;
  flex: 1;
  max-width: 520px;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.bank-receipt-search-bar input {
  width: 100%;
  min-height: 32px;
}

.bank-receipt-search-bar > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.bank-receipt-search-bar .danger-action {
  border-color: #fecaca;
  color: var(--bad);
  background: #fee2e2;
}

.bank-receipt-search-bar .danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.bank-receipt-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.bank-receipt-entry-head div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.bank-receipt-entry-head span {
  color: var(--muted);
  font-size: 10px;
}

.bank-receipt-entry-table {
  min-width: 920px;
}

.bank-receipt-entry-table th:first-child,
.bank-receipt-entry-table td:first-child {
  width: 44px;
  text-align: center;
}

.bank-receipt-entry-table input {
  width: 100%;
  min-width: 105px;
  min-height: 29px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
}

.bank-receipt-entry-table [data-bank-receipt-customer-preview] {
  display: inline-block;
  min-width: 80px;
  color: var(--primary);
}

.bank-receipt-entry-table [data-bank-receipt-customer-preview].unmatched {
  color: #b45309;
}

.bank-receipt-secondary-entry .bank-receipt-entry-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.bank-receipt-entry-grid label {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.bank-receipt-entry-grid input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 7px;
  font-size: 11px;
}

.bank-receipt-match-line {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  align-items: center;
  margin-top: 7px;
  font-size: 10px;
}

.bank-receipt-match-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-receipt-match-line strong.unmatched {
  color: #b45309;
}

.bank-receipt-match-line small {
  margin-left: auto;
  white-space: nowrap;
}

.bank-receipt-match-line .save-action {
  min-height: 30px;
  padding: 4px 8px;
  white-space: nowrap;
}

.finance-bank-receipts-ledger {
  margin-bottom: 10px;
}

.bank-receipts-scroll-wrap {
  max-height: min(58vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
}

.bank-receipts-scroll-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}

.finance-bank-receipt-binding {
  width: min(820px, calc(100vw - 32px)) !important;
  max-height: min(76vh, 640px);
  margin: 0;
  overflow: auto;
  scroll-margin-top: 12px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.finance-bank-receipt-binding > header {
  min-height: 46px;
  padding: 7px 10px !important;
}

.finance-bank-receipt-binding > header h3 {
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1.2;
}

.finance-bank-receipt-binding > header .bank-receipt-binding-summary {
  display: block;
  font-size: 11px;
  line-height: 1.35;
}

.finance-bank-receipt-binding > header button,
.finance-bank-receipt-binding .bank-receipt-binding-toolbar button,
.finance-bank-receipt-binding .bank-receipt-binding-actions button {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.finance-bank-receipt-binding .compact-panel-body {
  padding: 0;
}

.finance-bank-binding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
}

.bank-receipt-customer-search {
  flex: 1 1 320px;
}

.bank-receipt-customer-search input {
  width: min(420px, 100%);
}

.bank-receipt-selected-customer {
  color: var(--brand);
  white-space: nowrap;
}

.bank-receipt-customer-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 5px;
  max-height: 92px;
  padding: 6px 8px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.finance-bank-receipt-binding .compact-table-wrap {
  max-height: min(34vh, 300px);
  overflow: auto;
}

.finance-bank-receipt-binding > header,
.finance-bank-receipt-binding .bank-receipt-binding-toolbar,
.finance-bank-receipt-binding .bank-receipt-binding-actions {
  padding-block: 7px;
}

.bank-receipt-binding-summary em {
  margin-left: 4px;
  color: #dc2626;
  font-style: normal;
  font-weight: 800;
}

.bank-receipt-binding-summary > strong {
  color: var(--brand);
}

.bank-order-select-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.bank-receipt-customer-results button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 34px;
  padding: 5px 7px;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.bank-receipt-customer-results button.selected {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand);
}

.bank-receipt-customer-results small {
  color: var(--muted);
}

.bonded-order-pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.bonded-order-pagination select {
  min-height: 30px;
  padding: 3px 26px 3px 8px;
}

/* Bonded warehouse lists keep their column headings visible; only data scrolls. */
.bonded-data-scroll {
  max-height: calc(100vh - 300px);
  min-height: 180px;
  overflow: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* 进货入库、预约出库和退补结算共用同一规格的列表输出框。 */
.bonded-order-output {
  height: min(620px, calc(100vh - 300px));
  min-height: 360px;
  max-height: 620px;
}

/* Ten-record order pages grow naturally; only wide columns scroll horizontally. */
.bonded-paged-table {
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-gutter: auto;
}

.bonded-paged-table + .bonded-order-pagination {
  margin: 10px 12px 12px;
}

.bonded-data-scroll > table,
.bonded-data-scroll .panel-body > table {
  display: table;
  width: max-content;
  min-width: 100%;
  overflow: visible;
}

.bonded-data-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  box-shadow: 0 1px 0 var(--line);
}

@media (max-height: 720px) {
  .bonded-data-scroll {
    max-height: calc(100vh - 240px);
  }

  .bonded-order-output {
    height: calc(100vh - 240px);
    min-height: 260px;
    max-height: none;
  }
}

.bank-receipt-binding-toolbar,
.bank-receipt-binding-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: #f8fafc;
}

.bank-receipt-binding-toolbar {
  border-bottom: 1px solid var(--line);
}

.bank-receipt-binding-toolbar label {
  display: flex;
  gap: 5px;
  align-items: center;
  font-weight: 800;
}

.finance-bank-receipt-binding .b2b-compact-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 12px;
}

.finance-bank-receipt-binding .b2b-compact-table th,
.finance-bank-receipt-binding .b2b-compact-table td {
  padding: 3px 4px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-bank-receipt-binding .b2b-compact-table th:nth-child(1),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(1) { width: 52px; }
.finance-bank-receipt-binding .b2b-compact-table th:nth-child(2),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(2) { width: 96px; }
.finance-bank-receipt-binding .b2b-compact-table th:nth-child(3),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(3) { width: 142px; max-width: 142px; }
.finance-bank-receipt-binding .b2b-compact-table th:nth-child(4),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(4) { width: 184px; white-space: normal; }
.finance-bank-receipt-binding .b2b-compact-table th:nth-child(5),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(5) { width: 62px; }
.finance-bank-receipt-binding .b2b-compact-table th:nth-child(6),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(6) { width: 92px; }
.finance-bank-receipt-binding .b2b-compact-table th:nth-child(7),
.finance-bank-receipt-binding .b2b-compact-table td:nth-child(7) { width: 132px; }

.finance-bank-receipt-binding .b2b-compact-table input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 27px;
  padding: 3px 6px;
  font-size: 12px;
}

.bank-receipt-binding-toolbar select {
  min-width: 220px;
}

.bank-receipt-binding-toolbar span,
.bank-receipt-binding-actions span {
  color: var(--muted);
  font-size: 12px;
}

.bank-receipt-binding-toolbar button,
.bank-receipt-binding-actions button {
  margin-left: auto;
}

.bank-receipt-binding-tools {
  margin-left: auto;
}

.bank-receipt-binding-tools button {
  margin-left: 0;
}

.bank-receipt-binding-actions {
  border-top: 1px solid var(--line);
}

.finance-income-management-icons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.finance-income-management-icon {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.finance-income-management-icon:hover,
.finance-income-management-icon.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.finance-income-management-icon > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
}

.finance-income-management-icon strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-income-management-icon small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.finance-income-standalone-management {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.finance-income-standalone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
}

.finance-income-standalone-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.finance-income-standalone-head span {
  color: var(--muted);
  font-size: 11px;
}

.finance-income-standalone-management > .panel,
.finance-income-standalone-management > .toolbar {
  margin: 0;
}

.finance-income-action-cards .finance-erp-upload-mini h4 {
  margin-bottom: 5px;
  font-size: 12px;
}

.finance-income-action-cards .finance-erp-dropzone strong {
  font-size: 14px;
}

.finance-income-action-cards .finance-erp-dropzone span,
.finance-income-action-cards .finance-erp-dropzone small {
  font-size: 11px;
}

.finance-income-action-cards .finance-erp-upload-actions {
  margin-top: 6px;
}

.finance-income-action-cards .finance-erp-upload-actions button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1180px) {
  .finance-income-quick-row {
    grid-template-columns: 1fr;
  }

  .finance-income-action-cards {
    grid-template-columns: 1fr;
  }

  .finance-erp-upload-split {
    grid-template-columns: 1fr;
  }

  .b2b-receivable-panel > header {
    flex-wrap: wrap;
  }

  .b2b-receivable-panel > header .inline-filter-group {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .finance-income-category-kpis {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }
}

.inline-money-input,
.inline-reason-input {
  width: 100%;
  min-width: 84px;
  height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.inline-reason-input {
  min-width: 140px;
}

.b2b-adjustment-input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
  outline: none;
}

.b2b-operation-history-dialog {
  max-width: 760px;
}

.b2b-history-list {
  display: grid;
  gap: 10px;
}

.b2b-history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.b2b-history-item strong {
  display: block;
  color: var(--ink);
}

.b2b-history-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.b2b-history-item p {
  margin: 6px 0 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.payroll-range-export-panel {
  margin-bottom: 12px;
}

.payroll-range-export-body {
  display: grid;
  gap: 12px;
}

.payroll-range-export-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.payroll-range-export-controls label {
  min-width: 160px;
  margin: 0;
}

.payroll-range-check-all {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  font-weight: 700;
}

.payroll-range-employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.payroll-range-employee-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "check name"
    "check meta";
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid #e5eeee;
  border-radius: 8px;
  background: #fff;
}

.payroll-range-employee-item input {
  grid-area: check;
}

.payroll-range-employee-item span {
  grid-area: name;
  font-weight: 700;
}

.payroll-range-employee-item small {
  grid-area: meta;
  color: var(--muted);
}

.order-classification-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 12px;
  align-items: start;
}

.order-classification-grid .finance-erp-upload-mini,
.order-classification-grid > div {
  min-width: 0;
}

.batch-actions {
  margin: 8px 0;
  gap: 8px;
}

.raw-sales-table .muted-row {
  opacity: 0.68;
}

.trial-page {
  display: grid;
  gap: 14px;
}

.trial-toolbar,
.trial-period,
.trial-preview-head,
.trial-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.trial-toolbar {
  justify-content: space-between;
}

.trial-period label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trial-period select {
  min-width: 120px;
}

.trial-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(420px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.trial-input-panel,
.trial-preview-panel {
  min-width: 0;
}

.trial-preview-main h3 {
  margin-top: 0;
}

.trial-preview-panel {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.trial-excel-wrap {
  overflow: auto;
  max-height: calc(100vh - 210px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trial-excel-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.trial-excel-table th,
.trial-excel-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px;
  background: #fff;
}

.trial-excel-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf5f4;
  white-space: nowrap;
}

.trial-excel-table .trial-sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 170px;
  text-align: left;
  background: #f8fbfb;
}

.trial-excel-table th small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 400;
}

.trial-excel-table input {
  width: 104px;
  padding: 7px 8px;
  text-align: right;
}

.trial-excel-table input[data-historical-trial] {
  color: var(--muted);
  background: #f4f7f7;
  border-style: dashed;
}

.trial-excel-table thead small {
  color: #0f766e;
  font-size: 11px;
}

.trial-preview-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.trial-preview-head > div {
  min-width: 120px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.trial-preview-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.trial-preview-head strong {
  font-size: 18px;
}

@media (max-width: 1180px) {
  .trial-layout {
    grid-template-columns: 1fr;
  }

  .trial-preview-panel {
    position: static;
    max-height: none;
  }
}

.trial-preview-head .bad,
.trial-alerts:not(.ok) {
  color: var(--bad);
}

.trial-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.trial-report h3 {
  margin: 0 0 8px;
}

.trial-report table {
  width: 100%;
  border-collapse: collapse;
}

.trial-report td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}

.trial-row-strong td {
  font-weight: 800;
  background: #f7faf9;
}

.trial-metrics {
  margin-top: 12px;
}

.trial-metrics span {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef6f4;
}

.trial-alerts {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4f2;
}

.trial-alerts.ok {
  color: var(--ok);
  background: #f0f8f2;
}

.trial-alerts p {
  margin: 0;
}

@media (max-width: 900px) {
  .order-classification-grid {
    grid-template-columns: 1fr;
  }

  .trial-layout,
  .trial-report-grid {
    grid-template-columns: 1fr;
  }
}

.app-zip-single-test-fold {
  margin-top: 16px;
}

.app-zip-single-test-fold > summary {
  cursor: pointer;
  padding: 14px 18px;
  border: 1px solid #d8e7e5;
  border-radius: 10px;
  background: #f3f8f7;
  color: #0f6f69;
  font-weight: 700;
}

.app-zip-single-test-fold[open] > summary {
  margin-bottom: 10px;
}
.godoor-module-shell {
  min-height: calc(100vh - 170px);
}

.godoor-runtime-note {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff7df;
  color: #76530a;
  font-size: 13px;
}

.godoor-runtime-note a {
  margin-left: 10px;
  color: #176b50;
  font-weight: 700;
}

.godoor-module-frame {
  display: block;
  width: 100%;
  min-height: 900px;
  border: 1px solid #dce4e0;
  border-radius: 14px;
  background: #f3f6f3;
}

/* Global adaptive layout: keep every module usable from wide monitors to phones. */
:root {
  --business-dialog-width: 700px;
  --business-dialog-wide-width: 960px;
  --adaptive-page-gap: clamp(10px, 1.4vw, 24px);
  --adaptive-module-gap: clamp(8px, 1vw, 14px);
  --adaptive-card-padding: clamp(10px, 1.2vw, 18px);
}

html {
  overflow-x: hidden;
}

body {
  grid-template-columns: clamp(220px, 16vw, 280px) minmax(0, 1fr);
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.main,
.view,
#dashboard,
#table-view,
.panel,
.panel-body,
.content,
.finance-income-page,
.finance-income-shell,
.finance-monthly-orders-page,
.finance-bank-receipt-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.main {
  padding-right: var(--adaptive-page-gap);
  padding-left: var(--adaptive-page-gap);
}

.kpis,
.report-kpis {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: var(--adaptive-module-gap);
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--adaptive-module-gap);
}

.finance-income-action-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--adaptive-module-gap);
}

.finance-income-category-kpis,
.finance-monthly-orders-overview .report-kpis {
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: var(--adaptive-module-gap);
}

.panel,
.kpi,
.report-kpi,
.finance-income-action-card,
.finance-income-category-kpi {
  min-width: 0;
}

.panel > header,
.panel-header,
.toolbar,
.topbar,
.actions,
.table-actions,
.inline-filter-group,
.finance-income-toolbar,
.finance-income-list-head,
.finance-dashboard-header,
.bank-receipt-search-bar {
  flex-wrap: wrap;
}

.panel > header > *,
.panel-header > *,
.toolbar > *,
.finance-income-toolbar > *,
.finance-income-list-head > * {
  min-width: 0;
}

.table-wrap,
.compact-table-wrap,
.finance-income-table-wrap,
.finance-bank-receipt-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  max-width: none;
}

dialog,
.modal,
.modal-card {
  width: min(960px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
}

.godoor-module-frame {
  min-height: clamp(620px, 78vh, 900px);
}

@media (max-width: 1400px) {
  .finance-income-action-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-income-category-kpis,
  .finance-monthly-orders-overview .report-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  body {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .main {
    padding: clamp(10px, 1.5vw, 18px);
  }

  .kpis,
  .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  body {
    display: block;
  }

  .sidebar {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    max-height: none;
  }

  .topbar {
    top: 0;
  }

  .finance-income-action-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-income-category-kpis,
  .finance-monthly-orders-overview .report-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  :root {
    --adaptive-page-gap: 10px;
    --adaptive-card-padding: 10px;
  }

  .main {
    padding: 10px;
  }

  .finance-income-action-cards {
    grid-template-columns: 1fr;
  }

  .kpis,
  .report-kpis,
  .finance-income-category-kpis,
  .finance-monthly-orders-overview .report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel > header,
  .panel-header,
  .finance-income-list-head,
  .finance-dashboard-header {
    align-items: stretch;
  }

  .panel > header > .actions,
  .panel-header > .actions,
  .table-actions,
  .finance-income-list-head > .actions {
    width: 100%;
  }

  .inline-filter-group,
  .bank-receipt-search-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .inline-filter-group input,
  .inline-filter-group select,
  .inline-filter-group button,
  .bank-receipt-search-bar input,
  .bank-receipt-search-bar select,
  .bank-receipt-search-bar button {
    width: 100%;
    min-width: 0;
  }

  dialog,
  .modal,
  .modal-card {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
}

@media (max-width: 480px) {
  .kpis,
  .report-kpis,
  .finance-income-category-kpis,
  .finance-monthly-orders-overview .report-kpis,
  .inline-filter-group,
  .bank-receipt-search-bar {
    grid-template-columns: 1fr;
  }

  .panel,
  .kpi,
  .report-kpi,
  .finance-income-action-card,
  .finance-income-category-kpi {
    border-radius: 10px;
  }

  .global-sales-handler-totals p {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .global-sales-handler-finance {
    width: 100%;
  }
}

/* Full-program responsive audit: module layouts follow the usable content width. */
.view > *,
#dashboard > *,
#table-view > *,
.panel > *,
.panel-body > *,
.finance-home-layout > *,
.finance-overview-grid > *,
.finance-section-grid > *,
.app-sort-module-grid > *,
.app-ops-tool-grid > *,
.dispatch-planner-grid > *,
.order-classification-grid > *,
.trial-layout > * {
  min-width: 0;
  max-width: 100%;
}

.fields,
.page-fields,
.finance-request-fields,
.finance-supplier-editor-fields,
.app-zip-single-fields {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

.app-sort-module-grid,
.app-ops-tool-grid,
.finance-section-grid,
.finance-overview-grid,
.health-grid,
.ownership-cards,
.dispatch-overview,
.dispatch-planner-grid,
.document-current-grid,
.role-checkbox-grid,
.payroll-range-employee-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.panel-body > table,
.panel > table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.finance-subnav,
.finance-income-subnav,
.master-partner-subnav,
.module-tabs,
.subtabs {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.finance-subnav button,
.finance-income-subnav button,
.master-partner-subnav button,
.module-tabs button,
.subtabs button {
  min-width: max-content;
}

.finance-income-inline-kpis {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 1500px) {
  .finance-home-layout {
    grid-template-columns: 1fr;
  }

  .finance-section-grid,
  .finance-overview-grid,
  .health-grid,
  .finance-request-fields,
  .finance-supplier-editor-fields,
  .page-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-ledger-summary,
  .finance-monthly-orders-overview .report-kpis,
  .finance-income-category-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finance-bank-inline {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .trial-layout,
  .order-classification-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .app-sort-module-grid,
  .app-ops-tool-grid,
  .finance-income-action-cards,
  .finance-erp-upload-split,
  .report-grid,
  .health-grid,
  .trace-summary,
  .document-upload-panel,
  .family-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .backup-cloud-form,
  .finance-cash-primary-row,
  .finance-cash-source-row,
  .finance-bank-inline,
  .dispatch-customer-toolbar,
  .dispatch-line-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-supplier-layout,
  .finance-cash-cost-layout,
  .permission-module-row,
  .pdf-upload-box,
  .order-classification-grid,
  .trial-layout {
    grid-template-columns: 1fr;
  }

  .trial-preview-panel {
    position: static;
    max-height: none;
  }

  .b2b-receivable-panel > header,
  .finance-toolbar,
  .northsea-monitor-toolbar,
  .finance-form-head,
  .bank-receipt-binding-toolbar,
  .bank-receipt-binding-actions {
    flex-wrap: wrap;
  }

  .b2b-receivable-panel > header .inline-filter-group {
    flex: 1 1 100%;
    width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 980px) {
  .app-sort-module-grid,
  .app-ops-tool-grid,
  .finance-section-grid,
  .finance-overview-grid,
  .finance-income-action-cards,
  .finance-erp-upload-split,
  .finance-request-fields,
  .finance-supplier-editor-fields,
  .health-grid,
  .trace-summary,
  .document-upload-panel,
  .family-row,
  .permission-action-list,
  .trial-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-ledger-summary,
  .finance-monthly-orders-overview .report-kpis,
  .finance-income-category-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-bank-inline,
  .bank-receipt-secondary-entry .bank-receipt-entry-grid,
  .inbound-fields,
  .dispatch-message-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-subnav,
  .finance-income-subnav,
  .master-partner-subnav {
    display: flex;
    flex-wrap: nowrap;
  }

  .finance-subnav button,
  .finance-income-subnav button,
  .master-partner-subnav button {
    flex: 1 0 150px;
  }

  .user-capacity-bar {
    min-width: 0;
    flex-wrap: wrap;
  }

  .bank-receipt-binding-toolbar,
  .bank-receipt-binding-actions {
    align-items: stretch;
  }

  .bank-receipt-binding-toolbar label,
  .bank-receipt-binding-toolbar select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .app-sort-module-grid,
  .app-ops-tool-grid,
  .app-zip-batch-grid,
  .finance-section-grid,
  .finance-overview-grid,
  .finance-income-action-cards,
  .finance-erp-upload-split,
  .finance-request-fields,
  .finance-supplier-editor-fields,
  .finance-bank-inline,
  .finance-ledger-summary,
  .finance-monthly-orders-overview .report-kpis,
  .finance-income-category-kpis,
  .finance-cash-summary-grid,
  .finance-cash-primary-row,
  .finance-cash-source-row,
  .health-grid,
  .backup-cloud-form,
  .page-fields,
  .inbound-fields,
  .permission-grid,
  .permission-module-row,
  .permission-action-list,
  .family-row,
  .pdf-upload-box,
  .document-upload-panel,
  .document-history-row,
  .notice-box,
  .trace-summary,
  .alias-input-grid,
  .dispatch-planner-grid,
  .dispatch-message-grid,
  .dispatch-customer-toolbar,
  .dispatch-line-item-row,
  .bank-receipt-entry-grid,
  .bank-receipt-secondary-entry .bank-receipt-entry-grid,
  .order-classification-grid,
  .trial-layout,
  .trial-report-grid {
    grid-template-columns: 1fr;
  }

  .global-sales-store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar,
  .finance-toolbar,
  .finance-form-head,
  .finance-income-workspace > header,
  .finance-income-standalone-head,
  .bank-receipt-entry-head,
  .family-editor-head,
  .document-editor-head,
  .page-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > *,
  .finance-toolbar > *,
  .finance-form-head > *,
  .finance-income-workspace > header > *,
  .bank-receipt-entry-head > * {
    width: 100%;
    max-width: 100%;
  }

  .bank-receipt-binding-toolbar,
  .bank-receipt-binding-actions,
  .bank-receipt-match-line {
    flex-direction: column;
    align-items: stretch;
  }

  .bank-receipt-binding-toolbar button,
  .bank-receipt-binding-actions button,
  .bank-receipt-binding-tools {
    width: 100%;
    margin-left: 0;
  }

  .finance-income-inline-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .finance-income-inline-kpi {
    white-space: normal;
  }

  dialog footer {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .global-sales-store-grid,
  .finance-income-inline-kpis,
  .finance-section-grid,
  .finance-overview-grid,
  .finance-monthly-orders-overview .report-kpis,
  .finance-income-category-kpis,
  .health-grid {
    grid-template-columns: 1fr;
  }
}
/* Compact new-document forms: larger readable type in shorter, multi-column fields. */
dialog.compact-create-editor {
  width: min(700px, calc(100vw - 24px));
}

.compact-create-editor form > header,
.compact-create-editor .page-editor-head {
  padding: 10px 12px;
}

.compact-create-editor form > header h2,
.compact-create-editor .page-editor-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.compact-create-editor form > header p,
.compact-create-editor .page-editor-head p {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
}

.compact-create-editor .fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px 11px;
  padding: 11px 14px;
}

.compact-create-editor .inbound-fields {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.compact-create-editor .inbound-fields > :not(.inbound-metric):not(.inbound-status):not(.full),
.compact-create-editor .inbound-fields .inbound-status {
  grid-column: span 4;
}

.compact-create-editor .inbound-fields .inbound-metric {
  grid-column: span 3;
  font-weight: 800;
  color: #173f3b;
  font-size: 13px;
  white-space: nowrap;
}

.compact-create-editor.inbound-create-editor .inbound-fields .inbound-metric input {
  min-height: 32px;
  border: 1.5px solid #86bdb6;
  background: #f3fbf9;
  color: #123f3a;
  font-size: 15px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.04);
}

.compact-create-editor.inbound-create-editor .inbound-fields .inbound-estimate input:disabled {
  border-color: #cbd3d1;
  background: #e9edec;
  color: #53615f;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
  text-align: center;
}

.compact-create-editor .fields label {
  gap: 3px;
  font-size: 14px;
  line-height: 1.25;
}

.compact-create-editor .fields input,
.compact-create-editor .fields select,
.compact-create-editor .fields textarea {
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.15;
}

.compact-create-editor .fields textarea {
  min-height: 56px;
}

.compact-create-editor .inbound-metric input {
  min-height: 32px;
  font-size: 15px;
}

.compact-create-editor footer {
  gap: 6px;
  padding: 7px 10px 8px;
}

.compact-create-editor footer button,
.compact-create-editor .page-editor-head button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.page-editor.compact-create-editor {
  max-width: 780px;
  margin-inline: auto;
}

input[type="date"],
input[type="month"] {
  position: relative;
  padding-right: 46px;
  border-color: #bfd2ce;
  background-color: #fcfefd;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='21' viewBox='0 0 24 24'%3E%3Crect x='3' y='4.5' width='18' height='16.5' rx='3' fill='%23ffffff' stroke='%230f766e' stroke-width='1.7'/%3E%3Cpath d='M3.8 9.2h16.4V7.3a2 2 0 0 0-2-2H5.8a2 2 0 0 0-2 2z' fill='%230f766e'/%3E%3Cpath d='M8 3v4M16 3v4' stroke='%230f766e' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='13' r='1' fill='%2349a89d'/%3E%3Ccircle cx='12' cy='13' r='1' fill='%2349a89d'/%3E%3Ccircle cx='16' cy='13' r='1' fill='%2349a89d'/%3E%3Ccircle cx='8' cy='17' r='1' fill='%2349a89d'/%3E%3Ccircle cx='12' cy='17' r='1' fill='%2349a89d'/%3E%3C/svg%3E"),
    linear-gradient(to right, transparent calc(100% - 42px), #e7f4f1 calc(100% - 42px));
  background-position: right 10px center, right top;
  background-size: 21px 21px, 42px 100%;
  background-repeat: no-repeat;
  color: #263c3a;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

input[type="date"]:hover,
input[type="month"]:hover {
  border-color: #72aaa4;
  background-color: #fff;
}

input[type="date"]:focus,
input[type="month"]:focus {
  border-color: #2d8c82;
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 140, 130, 0.13);
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0 0 0 auto;
  width: 42px;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 700px) {
  dialog.compact-create-editor {
    width: calc(100vw - 12px);
  }

  .compact-create-editor .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-create-editor .inbound-fields > :not(.full),
  .compact-create-editor .inbound-fields .inbound-metric {
    grid-column: span 6;
  }
}

@media (max-width: 420px) {
  .compact-create-editor .fields {
    grid-template-columns: 1fr;
  }

  .compact-create-editor .inbound-fields > *,
  .compact-create-editor .inbound-fields .inbound-metric {
    grid-column: 1 / -1;
  }
}

@media (min-width: 701px) {
  .compact-create-editor.inbound-create-editor .inbound-fields {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-warehouseProductName {
    grid-column: span 8;
  }
  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-lot-no {
    grid-column: span 4;
  }
  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-ownership {
    grid-column: 1 / span 4;
  }
  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-metric {
    grid-column: span 3;
    gap: 2px;
    font-size: 12px;
    line-height: 1.15;
  }
  .compact-create-editor.inbound-create-editor .inbound-fields .inbound-metric input {
    min-height: 29px;
    height: 29px;
    padding: 3px 7px;
    font-size: 14px;
  }
}
.bonded-order-import-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  background: rgba(20, 31, 38, .52);
  z-index: 3000;
}

.bonded-order-import-card {
  display: flex;
  flex-direction: column;
  width: min(1500px, 96vw);
  height: min(900px, 92vh);
  margin: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 41, 46, .28);
  overflow: hidden;
}

.bonded-order-import-card > header,
.bonded-order-import-card > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #dce8e7;
}

.bonded-order-import-card > footer {
  justify-content: flex-end;
  border-top: 1px solid #dce8e7;
  border-bottom: 0;
}

.bonded-order-import-card h2,
.bonded-order-import-card p { margin: 0; }

.bonded-import-readonly {
  margin: 14px 20px 0;
  padding: 10px 14px;
  border: 1px solid #83c9bf;
  border-radius: 10px;
  color: #075e56;
  background: #effbf8;
  font-weight: 700;
}

.bonded-import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 20px;
}

.bonded-import-table-wrap { flex: 1; min-height: 0; overflow: auto; padding: 0 20px 16px; }
.bonded-import-table-wrap table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.bonded-import-table-wrap th { position: sticky; top: 0; z-index: 1; background: #f1f7f6; }
.bonded-import-table-wrap th,
.bonded-import-table-wrap td { padding: 8px; border-bottom: 1px solid #e2eae9; text-align: left; vertical-align: top; }
.bonded-import-status { display: inline-block; padding: 3px 8px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.bonded-import-status.ok { color: #086b55; background: #dff7ef; }
.bonded-import-status.warn { color: #875a00; background: #fff2c7; }
.bonded-import-status.danger { color: #a32525; background: #ffe0e0; }
.bonded-import-messages { display: block; max-width: 260px; margin-top: 5px; color: #697b7a; line-height: 1.45; }
.bonded-import-estimated-weight { color: #c62828; font-weight: 700; }
.bonded-import-estimated-weight .bonded-import-messages { color: #c62828; }
.shared-product-notice {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  color: #45645f;
  background: #f6fbfa;
  font-size: 13px;
}
.bank-receipt-linked-customers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #d8e5e2;
  border-radius: 8px;
  background: #f7fbfa;
  font-size: 13px;
}

.bank-receipt-linked-customers span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f4f1;
  color: #145f57;
}

.b2b-order-payment-setting { padding:12px; border:1px solid var(--line); border-radius:10px; background:#f8fafc; }
.b2b-order-payment-setting h3 { margin:0 0 8px; }
.b2b-order-payment-setting dl { display:flex; flex-wrap:wrap; gap:10px 24px; margin:0 0 10px; }
.b2b-order-payment-setting dl div { display:grid; gap:2px; min-width:130px; }
.b2b-order-payment-setting dt { color:var(--muted); font-size:11px; }
.b2b-order-payment-setting dd { margin:0; font-weight:800; }

/* Final shared income-order column contract; kept last to win over legacy responsive rules. */
@media (min-width: 901px) {
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-money {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    white-space: nowrap;
  }
  .b2b-receivable-panel .b2b-order-list-table td[data-label="应收/应退"],
  .b2b-receivable-panel .b2b-order-list-table td[data-label="应收金额"] {
    width: 164px;
    min-width: 164px;
    max-width: 164px;
    padding-left: 10px;
    padding-right: 12px;
    white-space: normal;
  }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-adjustment,
  .b2b-receivable-panel .b2b-order-list-table td[data-label="调整金额"] {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-note,
  .b2b-receivable-panel .b2b-order-list-table td[data-label="备注"] {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
  }
}

/* Unified partner master */
.partner-master-toolbar{display:grid;grid-template-columns:minmax(260px,1fr) repeat(5,auto) auto;gap:8px;align-items:center}.partner-master-table-wrap{overflow-x:auto;overflow-y:visible;max-height:none;border:1px solid var(--border,#d9e0e8);border-radius:10px}.partner-master-table{border-collapse:separate;border-spacing:0;min-width:100%;width:max-content}.partner-master-table th{position:sticky;top:0;z-index:4;background:#f4f7fa}.partner-master-table td,.partner-master-table th{padding:10px;border-bottom:1px solid #e7ebef;background:#fff}.partner-master-table tr.is-disabled td{color:#7a8490;background:#f7f7f7}.partner-select-column{width:42px!important;min-width:42px!important;text-align:center}.partner-select-column input{width:18px;height:18px}.partner-fixed{position:sticky!important;left:0;z-index:3;box-shadow:1px 0 #dde3e9}.partner-fixed-1{left:120px!important}.partner-master-table th.partner-fixed{z-index:6;background:#f4f7fa}.partner-actions-sticky{position:sticky!important;right:0;z-index:5;background:#fff!important;box-shadow:-2px 0 4px rgba(30,50,70,.08);min-width:230px}.master-data-natural-page,.master-data-natural-page .panel-body{height:auto!important;max-height:none!important;overflow-y:visible!important}.master-data-pagination{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;padding:9px 12px}.master-data-pagination label{display:inline-flex;align-items:center;gap:6px}.master-data-pagination select{width:auto;min-width:88px;height:34px}.partner-column-settings{position:fixed;right:24px;top:90px;z-index:40;width:min(680px,calc(100vw - 48px));max-height:calc(100vh - 120px);overflow:auto;background:#fff;border:1px solid #cad3dc;border-radius:12px;padding:16px;box-shadow:0 18px 50px rgba(20,40,60,.2)}.partner-column-settings header,.partner-column-settings footer{display:flex;justify-content:space-between;align-items:center;gap:10px}.partner-column-presets{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}.partner-column-row{display:grid;grid-template-columns:28px 1fr 90px 100px 40px 40px;gap:7px;align-items:center;padding:6px 0;border-top:1px solid #edf0f3}.partner-editor-section{border:1px solid #dbe2e8;border-radius:10px;padding:14px;margin:6px 0}.partner-editor-section>header{display:flex;flex-direction:column;gap:3px;margin-bottom:12px}.partner-editor-section>header span{font-size:12px;color:#65717e}.partner-editor-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.partner-editor-grid label.full{grid-column:1/-1}.alias-master-toolbar{display:grid;grid-template-columns:minmax(180px,auto) minmax(360px,1fr) auto;gap:10px;align-items:end}.alias-list-search{width:100%;max-width:none}.alias-list-search input{min-width:220px}@media(max-width:900px){.partner-master-toolbar{grid-template-columns:1fr 1fr}.alias-master-toolbar{grid-template-columns:1fr}.partner-editor-grid{grid-template-columns:1fr}.partner-column-row{grid-template-columns:28px 1fr 80px}.partner-column-row label,.partner-column-row button{display:none}}
.partner-more-menu{position:relative}.partner-more-menu>summary{cursor:pointer;list-style:none;color:var(--primary);padding:6px 8px}.partner-more-menu[open]{z-index:8}.partner-more-menu[open]>button{display:block;width:100%;margin-top:4px;white-space:nowrap}.partner-alias-editor{margin-top:14px;padding-top:12px;border-top:1px solid #e1e6eb}.partner-alias-editor>header{display:flex;justify-content:space-between;align-items:center}.partner-alias-row{display:grid;grid-template-columns:1.2fr 110px 75px 100px 1fr 60px;gap:7px;align-items:center;margin:7px 0}
.partner-master-table .partner-select-column{position:sticky!important;left:0!important;z-index:7;background:#fff!important}.partner-master-table .partner-fixed-0{left:42px!important}.partner-master-table .partner-fixed-1{left:162px!important}

/* Finance income list: keep the first page compact and open product lines on demand. */
.b2b-order-cost-cell {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-width: 0;
}

.b2b-order-no-button {
  display: grid;
  justify-items: start;
  gap: 2px;
  max-width: 100%;
  text-align: left;
  white-space: normal;
}

.b2b-order-no-text {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.b2b-order-detail-hint {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

.b2b-compact-table tbody tr.order-detail-missing > td {
  background: #ffe8e6 !important;
  border-top-color: #fda29b;
  border-bottom-color: #fda29b;
}

.b2b-compact-table tbody tr.order-detail-missing > td:first-child {
  box-shadow: inset 6px 0 0 #d92d20;
}

.b2b-compact-table tbody tr.order-detail-missing:hover > td {
  background: #ffd7d3 !important;
}

.b2b-order-no-button.detail-pending .b2b-order-no-text,
.order-detail-missing .b2b-order-no-text {
  color: #b42318;
  font-weight: 800;
}

.b2b-no-order-details-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-top: 3px;
  color: #fff;
  background: #d92d20;
  border-color: #b42318;
  font-weight: 800;
}

.b2b-order-no-button:hover .b2b-order-detail-hint,
.b2b-order-no-button:focus-visible .b2b-order-detail-hint {
  color: var(--primary);
  text-decoration: underline;
}

.b2b-order-detail-dialog .table-wrap {
  max-width: 100%;
  overflow: auto;
}

.b2b-order-detail-table th:nth-child(3),
.b2b-order-detail-table td:nth-child(3),
.b2b-order-detail-table th:nth-child(4),
.b2b-order-detail-table td:nth-child(4) {
  min-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.b2b-order-detail-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}

.b2b-order-detail-sources span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 138px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.b2b-order-detail-sources b {
  margin-left: auto;
  color: var(--primary);
}

.b2b-order-detail-table .b2b-detail-source {
  min-width: 110px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.b2b-order-detail-table .b2b-detail-source small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.b2b-order-detail-empty {
  display: grid;
  gap: 5px;
  justify-items: start;
  text-align: left;
}

.b2b-finance-date {
  display: inline-grid;
  gap: 2px;
  min-width: 0;
  line-height: 1.2;
}

.b2b-finance-date-main {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.b2b-finance-date-time {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* This final desktop contract deliberately follows legacy rules above. */
@media (min-width: 901px) {
  .b2b-receivable-panel .compact-table-wrap {
    overflow-x: auto;
    scrollbar-gutter: stable;
  }

  .b2b-receivable-panel .b2b-order-list-table {
    min-width: 1640px;
    table-layout: fixed;
  }

  .b2b-receivable-panel .b2b-order-list-table th,
  .b2b-receivable-panel .b2b-order-list-table td {
    padding: 7px 8px;
    vertical-align: top;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-sales-no {
    width: 154px;
    min-width: 154px;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-sales-no,
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-category,
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-status {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-customer {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-reason,
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-note {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .b2b-receivable-panel .b2b-order-list-table .b2b-col-actions {
    width: 210px;
    min-width: 210px;
  }
}

@media (max-width: 900px) {
  .b2b-order-detail-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }

  .b2b-order-detail-dialog .b2b-order-detail-body {
    padding: 10px;
  }

  .b2b-order-detail-totals {
    justify-content: flex-start;
  }

  .b2b-order-list-table.adaptive-data-table td,
  .b2b-order-list-table.adaptive-data-table td > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .b2b-order-list-table.adaptive-data-table .b2b-finance-date {
    justify-self: start;
  }
}

/* Income-list totals and batch receipt action live in the title row.  Keeping
   them in normal flow avoids the former sticky top offset leaving a blank band
   above every B2B/B2C table. */
.b2b-receivable-panel .income-list-title-line {
  width: 100%;
}

.b2b-payment-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.b2b-payment-actions .save-action {
  font-weight: 800;
}

/* Keep the four primary income-row actions aligned as a compact 2 x 2 block. */
.b2b-compact-table .b2b-receivable-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-items: stretch;
  width: 100%;
  min-width: 168px;
}

.b2b-receivable-row-actions > .b2b-payment-actions {
  display: contents;
}

.b2b-receivable-row-actions > button,
.b2b-receivable-row-actions > select,
.b2b-receivable-row-actions > .b2b-payment-actions > button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  margin: 0;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.b2b-receivable-row-actions > .b2b-move-action-select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 18px 4px 6px;
}

/* Finance income table readability and difference-payment dialog. */
.finance-classification-control {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.finance-classification-control .b2b-move-action-select {
  width: 116px;
  min-width: 96px;
  height: auto;
  min-height: 30px;
  padding: 4px 20px 4px 6px;
  font-size: 12px;
}
.finance-classification-control button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.b2b-receivable-row-actions > .finance-classification-control { grid-column: 1 / -1; }
.b2b-finance-date-time {
  white-space: normal;
  line-height: 1.25;
}
.b2b-finance-date-time span,
.b2b-finance-date-time b { display: block; }
.b2b-finance-date-time b { color: #526a66; font-size: 11px; }
.b2b-finance-date-time-missing { max-width: 94px; overflow-wrap: anywhere; }
.b2b-finance-new-order { display: block; width: fit-content; padding: 2px 5px; border-radius: 4px; background: #e4f4ec; color: #167249; font-size: 11px; line-height: 1.4; white-space: normal; }
.b2b-finance-review-required { display: block; margin-top: 3px; color: #986600; font-size: 11px; overflow-wrap: anywhere; }
.finance-collected-raw-json { max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.finance-collected-raw td { overflow-wrap: anywhere; }
.finance-income-action-cards.finance-income-action-cards-collection-only { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .finance-income-action-cards.finance-income-action-cards-collection-only { grid-template-columns: minmax(0, 1fr); } }
.b2b-payment-actions button { min-height: 30px; padding: 5px 8px; white-space: nowrap; }
.receivable-tax-rate { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 5px; white-space: normal; }
.receivable-tax-rate select { min-width: 62px; width: auto; padding-right: 20px; }
.b2b-payment-difference-dialog { width: min(560px, calc(100vw - 24px)); }
.b2b-payment-difference-dialog form { display: grid; max-height: calc(100dvh - 24px); }
.b2b-payment-difference-dialog header,
.b2b-payment-difference-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; }
.b2b-payment-difference-dialog header h3,
.b2b-payment-difference-dialog header p { margin: 0; }
.b2b-payment-difference-dialog header p { margin-top: 4px; color: var(--muted); }
.b2b-payment-difference-body { display: grid; gap: 14px; padding: 18px; border-block: 1px solid var(--line); }
.b2b-payment-difference-body label { display: grid; gap: 6px; font-weight: 700; }
.b2b-payment-difference-body small { color: var(--muted); font-weight: 400; }
.b2b-payment-difference-body input,
.b2b-payment-difference-body textarea { width: 100%; }

@media (min-width: 901px) {
  .b2b-receivable-panel .b2b-order-list-table th:last-child,
  .b2b-receivable-panel .b2b-order-list-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 3;
    background: #fff;
    box-shadow: -4px 0 8px rgba(15, 61, 51, 0.06);
  }

  .b2b-receivable-panel .b2b-order-list-table th:last-child {
    z-index: 4;
    background: #f5f8f7;
  }
}

@media (max-width: 420px) {
  .b2b-order-list-table.adaptive-data-table td {
    grid-template-columns: minmax(72px, .5fr) minmax(0, 1.5fr);
  }
}

@media (min-width: 901px) {
  .b2b-receivable-panel .compact-table-wrap {
    max-height: min(68vh, 760px);
    overflow: auto;
  }
  .b2b-receivable-panel .compact-table-wrap > .w3-table-wrap {
    overflow: visible;
  }
  .b2b-receivable-panel .b2b-order-list-table { min-width: 1480px; table-layout: fixed; }
  .b2b-receivable-panel .b2b-order-list-table thead {
    position: sticky;
    top: 0;
    z-index: 7;
  }
  .b2b-receivable-panel .b2b-order-list-table th,
  .b2b-receivable-panel .b2b-order-list-table td { padding: 7px 6px; vertical-align: top; overflow-wrap: anywhere; }
  .b2b-receivable-panel .b2b-order-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 7;
    background: #f5f8f7;
    box-shadow: 0 1px 0 var(--line);
  }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-sales-date { width: 112px; min-width: 112px; max-width: 112px; }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-sales-no { width: 140px; min-width: 140px; }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-customer { width: 156px; min-width: 156px; max-width: 156px; }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-category { width: 72px; min-width: 72px; max-width: 72px; }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-status { width: 82px; min-width: 82px; max-width: 82px; }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-reason,
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-note { width: 130px; min-width: 130px; max-width: 130px; }
  .b2b-receivable-panel .b2b-order-list-table .b2b-col-actions { width: 184px; min-width: 184px; }
  .b2b-receivable-panel .b2b-order-list-table th:last-child { z-index: 9; }
}

/* Final cascade overrides for the authorized top-navigation layout. */
body { display:block; grid-template-columns:none; padding-top:76px; }
.sidebar.top-navigation { position:fixed; inset:0 0 auto; z-index:80; display:flex; align-items:center; gap:18px; min-height:76px; height:auto; padding:9px 20px; overflow:visible; border:0; border-bottom:1px solid var(--line); }
.sidebar.top-navigation { width:100%; max-width:none; }
.sidebar.top-navigation + .main { margin-left:0; width:100%; }
.sidebar.top-navigation #nav { display:flex; flex:1 1 auto; gap:3px; min-width:0; overflow:visible; }
.sidebar.top-navigation .nav-btn { display:flex; flex:0 0 auto; width:auto; min-height:42px; }
@media (max-width:1120px){body{padding-top:120px}.sidebar.top-navigation{flex-wrap:wrap}.sidebar.top-navigation #nav{order:3;flex-basis:100%;overflow-x:auto}.topbar{top:120px}}
@media (max-width:640px){body{padding-top:128px}.sidebar.top-navigation{padding:7px 10px}.nav-dropdown{position:fixed;top:126px;right:8px;left:8px;width:auto}.topbar{top:128px}}

/* The inbound purchase editor is the canonical ordinary-business dialog size. */
#editor.business-dialog{width:min(var(--business-dialog-width),calc(100vw - 24px));max-height:calc(100dvh - 24px)}
#editor.business-dialog.dialog-wide{width:min(var(--business-dialog-wide-width),calc(100vw - 24px))}
#editor.business-dialog form{height:min(760px,calc(100dvh - 24px));max-height:calc(100dvh - 24px);overflow:hidden}
#editor.business-dialog form>header,#editor.business-dialog form>footer{flex:0 0 auto;position:relative;z-index:2;background:#fff}
#editor.business-dialog #fields{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
#editor.business-dialog.warehouse-editor-dialog form{height:auto;max-height:calc(100dvh - 24px)}
#editor.warehouse-editor-dialog #fields{grid-template-columns:repeat(2,minmax(0,1fr));align-content:start}
#editor.warehouse-editor-dialog #fields label{align-content:start;gap:4px}
#editor.warehouse-editor-dialog #fields label:first-child{grid-column:1/-1}
#editor.warehouse-editor-dialog #fields input{height:34px;min-height:34px;width:100%}
#editor.warehouse-editor-dialog #fields textarea{height:64px;min-height:64px}
#editor.partner-editor-dialog .fields{padding:10px 12px;display:block}

.collection-center-live {
  display: grid;
  gap: 16px;
  margin: 18px 0 22px;
}

.collection-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.collection-source-card,
.collection-pipeline,
.collection-exceptions {
  border: 1px solid var(--border, #dfe5ec);
  border-radius: 12px;
  background: var(--surface, #fff);
  padding: 16px;
}

.collection-source-card > header,
.collection-exceptions > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.collection-source-card h3,
.collection-pipeline h3,
.collection-exceptions h3 {
  margin: 0 0 4px;
}

.collection-state {
  border-radius: 999px;
  background: #e9f7ef;
  color: #176b3a;
  padding: 4px 10px;
  white-space: nowrap;
}

.collection-state.danger,
.collection-pipeline-steps .has-exception {
  background: #fff0f0;
  color: #a72a2a;
}

.collection-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
}

.collection-metric {
  min-height: 82px;
  border-radius: 9px;
  background: #f6f8fb;
  padding: 10px;
}

.collection-metric span,
.collection-metric small {
  display: block;
  color: var(--muted, #667085);
}

.collection-metric strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 1.25rem;
}

.collection-pipeline-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
}

.collection-pipeline-steps span {
  flex: 0 0 auto;
  border-radius: 8px;
  background: #eef4ff;
  color: #254b87;
  padding: 9px 12px;
  font-weight: 650;
}

.collection-pipeline p,
.collection-exceptions p {
  margin: 4px 0 0;
  color: var(--muted, #667085);
}

.collection-exceptions .table-wrap {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .collection-metrics { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .collection-source-card > header, .collection-exceptions > header { align-items: stretch; flex-direction: column; }
}

/* Multi-page workspace: keep frequently used modules open without duplicating business pages. */
.workspace-tabs{position:sticky;top:52px;z-index:48;display:flex;align-items:stretch;gap:1px;min-height:38px;padding:0 14px;overflow-x:auto;overflow-y:hidden;border-bottom:1px solid #d8e0e5;background:#eef2f4;box-shadow:0 2px 7px rgba(29,41,57,.06);scrollbar-width:thin}
.workspace-tabs[hidden]{display:none}
.workspace-tab{position:relative;display:flex;align-items:stretch;flex:0 0 auto;min-width:126px;max-width:240px;border-right:1px solid #d6dde2;background:#e8ecef;color:#40515f}
.workspace-tab>button[role="tab"]{display:flex;align-items:center;gap:7px;min-width:0;min-height:37px;padding:7px 9px;border:0;border-radius:0;background:transparent;color:inherit;box-shadow:none;font-size:13px;font-weight:600;text-align:left;filter:none}
.workspace-tab>button[role="tab"] span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.workspace-tab>button[role="tab"] i{display:none;width:6px;height:6px;flex:none;border-radius:50%;background:#f59e0b}
.workspace-tab.dirty>button[role="tab"] i{display:block}
.workspace-tab.active{background:#fff;color:#13863a;box-shadow:inset 0 -3px #1e9c49}
.workspace-tab-close{align-self:center;width:24px;height:24px;margin-right:5px;padding:0;border:0;border-radius:4px;background:transparent;color:#74828d;font-size:18px;line-height:24px;box-shadow:none;filter:none}
.workspace-tab-close:hover{background:#dfe7e5;color:#b42318;filter:none}
.workspace-tabs + .topbar{top:90px}
@media(max-width:1120px){.workspace-tabs{top:88px}.workspace-tabs + .topbar{top:126px}}

/* Compact ERP workspace inspired by the information density of mainstream web ERP systems. */
:root{
  --brand:#249f45;
  --brand-strong:#177f36;
  --bg:#eef1f4;
  --panel:#fff;
  --line:#d9e0e6;
  --text:#263445;
  --muted:#6c7888;
  --shadow:0 1px 4px rgba(30,55,75,.12);
}
body{padding-top:0;font-size:12px;background:var(--bg)}
.sidebar.top-navigation{
  min-height:52px;height:52px;padding:0 14px;gap:10px;
  color:#fff;background:#249f45;border-bottom:1px solid #177f36;
  box-shadow:0 1px 4px rgba(20,85,42,.22);
}
.sidebar.top-navigation .brand{
  min-height:36px;height:36px;padding:0 14px 0 0;border-right:1px solid rgba(255,255,255,.3);
}
.sidebar.top-navigation .brand strong{color:#fff;font-size:14px;white-space:nowrap}
.sidebar.top-navigation .brand-mark{width:34px;height:34px;background:#fff;border-radius:6px}
.sidebar.top-navigation .brand-mark img{width:32px;height:32px;border-radius:6px}
.sidebar.top-navigation #nav{height:100%;gap:0}
.sidebar.top-navigation .nav-menu{height:100%;display:flex;align-items:stretch}
.sidebar.top-navigation .nav-btn{
  height:100%;min-height:0;padding:0 13px;border:0;border-radius:0;
  color:#fff;background:transparent;font-size:14px;font-weight:600;
}
.sidebar.top-navigation .nav-btn:hover,.sidebar.top-navigation .nav-btn:focus-visible,
.sidebar.top-navigation .nav-btn.active{color:#fff;background:#177f36;filter:none}
.sidebar.top-navigation .nav-btn.active::before{inset:auto 10px 0;height:3px;background:#fff}
.sidebar.top-navigation .user-box{height:100%;padding:0;gap:5px;color:#fff}
.sidebar.top-navigation .user-box span{color:#fff}
.sidebar.top-navigation .user-box button{
  min-height:26px;padding:3px 8px;border:1px solid rgba(255,255,255,.28);
  border-radius:2px;color:#fff;background:rgba(255,255,255,.12);font-size:12px;
}
.nav-dropdown{
  top:52px;left:0;width:176px;max-height:calc(100vh - 64px);padding:4px 0;
  border:1px solid #cfd7df;border-radius:2px;background:#fafafa;
  box-shadow:3px 3px 7px rgba(70,80,90,.28);
}
.nav-menu:nth-last-child(-n+2) .nav-dropdown{left:auto;right:0}
.nav-subitem{
  display:block;min-height:34px;padding:8px 14px;border-radius:0;
  color:#273444;background:#fafafa;font-size:13px;font-weight:500;
}
.nav-subitem:hover,.nav-subitem:focus-visible{color:#fff;background:#249f45;outline:0}
.nav-subitem.active{color:#fff;background:#177f36}
.main{width:100%;margin:0;padding-top:52px;background:var(--bg)}
.topbar{
  top:52px;min-height:66px;padding:12px 18px;background:#fff;
  border-bottom:1px solid var(--line);box-shadow:none;
}
.topbar h1{font-size:22px;line-height:1.25}
.topbar p{margin-top:3px;font-size:12px}
.view{padding:12px 14px}
.panel,.summary-card,.metric-card,.finance-overview-card{
  border:1px solid #dbe1e7;border-radius:2px;box-shadow:var(--shadow);
}
.panel>header,.panel-header{min-height:38px;padding:8px 12px;border-bottom:1px solid #e2e7eb}

/* System > Data collection is a permission-aware hub. Connector credentials
   remain isolated in each connector's secondary settings page. */
.data-collection-hub { padding-bottom: 16px; }
.data-collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}
.data-collection-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 168px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.data-collection-card p { color: var(--muted); line-height: 1.6; }
.data-collection-card .primary { justify-self: start; margin-top: auto; }
@media (max-width: 640px) {
  .data-collection-grid { grid-template-columns: 1fr; padding: 10px; }
  .data-collection-card { min-height: 0; }
}
.panel-body{padding:10px 12px}
button,input,select,textarea{border-radius:2px}
table{font-size:12px}
th,td{padding:7px 8px}
@media(max-width:1120px){
  body{padding-top:0}
  .main{padding-top:88px}
  .sidebar.top-navigation{height:88px;min-height:88px;align-content:flex-start;padding-top:4px}
  .sidebar.top-navigation #nav{height:36px;flex-basis:100%;overflow-x:auto;overflow-y:hidden}
  .sidebar.top-navigation .nav-btn{height:36px}
  .nav-dropdown{position:fixed;top:88px}
  .topbar{top:88px}
}
@media(max-width:640px){
  body{padding-top:0}
  .main{padding-top:88px}
  .sidebar.top-navigation{height:88px;min-height:88px;padding:4px 8px}
  .nav-dropdown{top:88px;right:6px;left:6px;width:auto}
  .topbar{top:88px}
}
#editor.partner-editor-dialog .partner-editor-section{padding:10px 12px;margin:0 0 9px}
#editor.partner-editor-dialog .partner-editor-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px 10px}
#editor.partner-editor-dialog .partner-field{grid-column:span 3;min-width:0}
#editor.partner-editor-dialog .partner-field-short{grid-column:span 2}
#editor.partner-editor-dialog .partner-field-wide{grid-column:1/-1}
#editor.partner-editor-dialog textarea{min-height:58px;max-height:120px}
#editor.partner-editor-dialog input,#editor.partner-editor-dialog select,#editor.partner-editor-dialog textarea{max-width:100%;min-width:0}
@media(max-width:700px){#editor.business-dialog,#editor.business-dialog.dialog-wide{width:calc(100vw - 12px);max-width:calc(100vw - 12px);max-height:calc(100dvh - 12px)}#editor.business-dialog form{height:calc(100dvh - 12px);max-height:calc(100dvh - 12px)}#editor.partner-editor-dialog .partner-editor-grid{grid-template-columns:1fr}#editor.partner-editor-dialog .partner-field,#editor.partner-editor-dialog .partner-field-short,#editor.partner-editor-dialog .partner-field-wide{grid-column:1/-1}.partner-alias-row{grid-template-columns:1fr 1fr}.partner-alias-row input[data-partner-alias-note]{grid-column:1/-1}}

/* Vehicle/driver masters share the save pipeline, but use a smaller scoped dialog. */
#editor.dispatch-master-editor {
  width: min(580px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: 80vh;
}

#editor.dispatch-master-editor #editor-form {
  height: auto;
  max-height: 80vh;
  overflow: hidden;
}

#editor.dispatch-master-editor #editor-form > header {
  padding: 9px 12px;
}

#editor.dispatch-master-editor #editor-title {
  font-size: 17px;
  line-height: 1.25;
}

#editor.dispatch-master-editor #editor-help {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
}

#editor.dispatch-master-editor #fields {
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  min-height: 0;
  padding: 10px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#editor.dispatch-master-editor #fields > label {
  gap: 3px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
}

#editor.dispatch-master-editor #fields > label.full {
  grid-column: 1 / -1;
}

#editor.dispatch-master-editor #fields input,
#editor.dispatch-master-editor #fields select,
#editor.dispatch-master-editor #fields textarea {
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1.2;
}

#editor.dispatch-master-editor #fields textarea {
  min-height: 58px;
  max-height: 110px;
  resize: vertical;
}

#editor.dispatch-master-editor #editor-form > footer {
  gap: 7px;
  padding: 8px 12px;
}

#editor.dispatch-master-editor #editor-form > header button,
#editor.dispatch-master-editor #editor-form > footer button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

@media (max-width: 620px) {
  #editor.dispatch-master-editor {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  #editor.dispatch-master-editor #fields {
    grid-template-columns: 1fr;
  }

  #editor.dispatch-master-editor #fields > label.full {
    grid-column: 1;
  }
}
.dispatch-recognition-panel .panel-body{display:grid;gap:14px}.dispatch-recognition-card{border:1px solid var(--border,#d9dee7);border-radius:10px;padding:14px;background:#fff}.dispatch-recognition-card>header{display:flex;gap:12px;align-items:center;margin-bottom:10px}.dispatch-recognition-card textarea[readonly]{min-height:88px;background:#f7f8fa}.dispatch-recognition-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:12px 0}.dispatch-recognition-grid label{display:grid;gap:5px}.dispatch-recognition-grid .full,.dispatch-recognition-card>.full{grid-column:1/-1;display:grid;gap:5px}@media(max-width:800px){.dispatch-recognition-grid{grid-template-columns:1fr}}
.native-nav-group { margin: 0 0 12px; }
.native-nav-group h3 { margin: 14px 12px 6px; color: #7b8794; font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.native-nav-group .nav-btn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.native-business-panel > header > div { display: grid; gap: 4px; }
.native-business-panel > header p { margin: 0; color: #687786; font-size: 13px; }

/* candidate.2: deterministic navigation geometry at desktop, tablet and narrow widths. */
@media (min-width:1121px){
  .sidebar.top-navigation{height:52px;min-height:52px}
  .main{padding-top:52px}
  .topbar{top:52px}
}
@media (min-width:641px) and (max-width:1120px){
  .sidebar.top-navigation{
    display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:48px 40px;
    grid-template-areas:"brand user" "nav nav";height:88px;min-height:88px;padding:0 12px;gap:0 10px;
  }
  .sidebar.top-navigation .brand{grid-area:brand;min-width:0;height:40px}
  .sidebar.top-navigation .user-box{grid-area:user;min-width:0;justify-self:end}
  .sidebar.top-navigation #nav{grid-area:nav;width:100%;height:40px;min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:thin}
  .sidebar.top-navigation .nav-menu,.sidebar.top-navigation .nav-btn{height:40px}
  .main{padding-top:88px}
  .topbar,.nav-dropdown{top:88px}
}
@media (max-width:640px){
  .sidebar.top-navigation{
    display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:48px 40px;
    grid-template-areas:"brand user" "nav nav";height:88px;min-height:88px;padding:0 8px;gap:0 6px;
  }
  .sidebar.top-navigation .brand{grid-area:brand;min-width:0;height:40px;padding-right:6px;overflow:hidden}
  .sidebar.top-navigation .brand strong{overflow:hidden;text-overflow:ellipsis}
  .sidebar.top-navigation .user-box{grid-area:user;min-width:0;justify-self:end}
  .sidebar.top-navigation #nav{grid-area:nav;width:100%;height:40px;min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:thin}
  .sidebar.top-navigation .nav-menu,.sidebar.top-navigation .nav-btn{height:40px}
  .sidebar.top-navigation .nav-btn{padding:0 10px}
  .main{padding-top:88px}
  .topbar,.nav-dropdown{top:88px}
}
.native-business-panel .empty-state { min-height: 220px; display: grid; place-content: center; gap: 8px; text-align: center; color: #7b8794; }
.native-business-panel .empty-state strong { color: #263746; font-size: 18px; }
.toast-host{position:fixed;top:62px;right:14px;z-index:1400;display:grid;gap:7px;width:min(360px,calc(100vw - 28px));pointer-events:none}
.toast-message{padding:9px 12px;border:1px solid #177f36;border-radius:3px;background:#effaf2;color:#155d2a;box-shadow:0 4px 14px rgba(20,55,30,.18);font-size:13px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere}
.toast-message.error{border-color:#c94545;background:#fff1f1;color:#9b2929}

/* Separate operational receipts from historical bank statements. */
.finance-bank-tabs{display:flex;gap:8px;margin:12px 0;flex-wrap:wrap}
.finance-bank-tabs button{flex:1;min-width:140px;padding:10px 16px;border:1px solid #cbded8;background:#fff;color:#22685b;border-radius:6px}
.finance-bank-tabs button.active{background:#e1f3ec;border-color:#22985a;font-weight:700}
.finance-bank-natural-flow .compact-table-wrap,
.finance-bank-natural-flow .finance-bank-receipt-table-wrap,
.finance-bank-natural-flow .panel-body{height:auto!important;max-height:none!important;overflow:visible!important;scroll-behavior:auto!important}
.finance-bank-natural-flow table{width:100%!important;min-width:0!important;table-layout:fixed}
.finance-bank-natural-flow th,.finance-bank-natural-flow td{white-space:normal!important;overflow-wrap:anywhere;max-width:none!important}
.finance-bank-natural-flow thead,.finance-bank-natural-flow th{position:static!important}
/* Category tables have eight columns, unlike the wider B2B receivable table. */
.finance-category-orders-panel { min-width:0; max-width:100%; }
.finance-category-orders-panel .panel-body { min-width:0; max-width:100%; }
.finance-category-orders-panel .compact-table-wrap { width:100%; max-width:100%; overflow:auto; max-height:68vh; }
.finance-category-orders-panel .compact-table-wrap > .w3-table-wrap { overflow:visible; min-width:0; }
.finance-category-orders-panel table.finance-category-orders-table { width:100%; min-width:0; table-layout:fixed; }
.finance-category-orders-table .finance-category-select { width:32px; }
.finance-category-orders-table .finance-category-operation { width:160px; }
.finance-category-orders-panel table.finance-category-orders-table th,
.finance-category-orders-panel table.finance-category-orders-table td { min-width:0; max-width:none; width:auto; white-space:normal; overflow-wrap:anywhere; padding:8px 6px; vertical-align:top; }
.finance-category-orders-panel table.finance-category-orders-table thead { position:sticky; top:0; z-index:7; }
.finance-category-orders-panel table.finance-category-orders-table th { position:sticky; top:0; background:#f5f8f7; }
.finance-category-orders-panel .income-list-title-line { width:100%; }
.finance-category-orders-panel .finance-income-category-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; min-width:0; }
.finance-category-orders-panel .finance-income-category-actions > div { display:contents; }
.finance-category-orders-panel .finance-income-category-actions button,
.finance-category-orders-panel .finance-income-category-actions select { width:100%; min-width:0; max-width:100%; min-height:32px; height:auto; white-space:normal; padding:5px 4px; font-size:12px; }
.finance-category-orders-panel .status { white-space:normal; overflow-wrap:anywhere; }
/* B2C desktop table: keep the operational controls on one row and use the
   reclaimed vertical space for denser order browsing. */
@media(min-width:901px) {
 .finance-category-orders-panel table.b2c-finance-orders-table { min-width:1580px; }
 .b2c-finance-orders-table .finance-category-select { width:2%; }
 .b2c-finance-orders-table .finance-category-order-no { width:9%; }
 .b2c-finance-orders-table .finance-category-date { width:8%; }
 .b2c-finance-orders-table .finance-category-source { width:7%; }
 .b2c-finance-orders-table .finance-category-customer { width:8%; }
 .b2c-finance-orders-table .finance-category-store { width:7%; }
 .b2c-finance-orders-table .finance-category-amount { width:11%; }
 .b2c-finance-orders-table .finance-category-payment { width:11%; }
 .b2c-finance-orders-table .finance-category-remark { width:10%; }
 .b2c-finance-orders-table .finance-category-operation { width:27%; }
 .finance-category-orders-panel table.b2c-finance-orders-table th,
 .finance-category-orders-panel table.b2c-finance-orders-table td { padding:5px 5px; line-height:1.25; }
 .finance-category-orders-panel .b2c-finance-orders-table .finance-income-category-actions {
   display:flex;
   flex-flow:row nowrap;
   align-items:center;
   gap:4px;
   min-width:430px;
   white-space:nowrap;
 }
 .finance-category-orders-panel .b2c-finance-orders-table .finance-income-category-actions > .b2b-payment-actions,
 .finance-category-orders-panel .b2c-finance-orders-table .finance-income-category-actions > .finance-classification-control {
   display:inline-flex;
   flex-flow:row nowrap;
   align-items:center;
   gap:4px;
   width:auto;
   max-width:none;
 }
 .finance-category-orders-panel .b2c-finance-orders-table .finance-income-category-actions button,
 .finance-category-orders-panel .b2c-finance-orders-table .finance-income-category-actions select {
   flex:0 0 auto;
   width:auto;
   min-width:0;
   min-height:30px;
   padding:4px 7px;
   font-size:11px;
   line-height:1.2;
   white-space:nowrap;
 }
 .finance-category-orders-panel .b2c-finance-orders-table .finance-income-category-actions .b2b-move-action-select {
   width:96px;
   min-width:96px;
   padding-right:20px;
 }

 /* B2B uses a wider dynamic table. Compact the descriptive columns, reserve
    stable room for operations, and keep all primary controls in one row. */
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) {
   min-width:1800px;
   table-layout:auto;
 }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-sales-no { width:132px; min-width:118px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-sales-date { width:88px; min-width:88px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-source { width:96px; min-width:86px; max-width:110px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-customer { width:142px; min-width:128px; max-width:170px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-money { width:94px; min-width:88px; max-width:104px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-status { width:72px; min-width:68px; max-width:84px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-note { width:190px; min-width:180px; max-width:240px; }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-col-actions {
   width:470px;
   min-width:470px;
   max-width:none;
 }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-receivable-row-actions {
   display:flex;
   flex-flow:row nowrap;
   align-items:center;
   gap:4px;
   width:auto;
   min-width:450px;
 }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-receivable-row-actions > .b2b-payment-actions,
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-receivable-row-actions > .finance-classification-control {
   display:inline-flex;
   flex-flow:row nowrap;
   align-items:center;
   gap:4px;
   width:auto;
   max-width:none;
 }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-receivable-row-actions button,
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-receivable-row-actions select {
   flex:0 0 auto;
   width:auto;
   min-width:0;
   min-height:30px;
   margin:0;
   padding:4px 7px;
   font-size:11px;
   line-height:1.2;
   white-space:nowrap;
 }
 .b2b-receivable-panel table.b2b-order-list-table:not(.b2c-finance-orders-table) .b2b-receivable-row-actions .b2b-move-action-select {
   width:96px;
   min-width:96px;
   padding-right:20px;
 }
}
.finance-order-source {
 display:inline-flex;
 align-items:center;
 justify-content:center;
 min-height:24px;
 padding:3px 7px;
 border-radius:999px;
 background:#edf3f1;
 color:#3d5850;
 font-size:11px;
 font-weight:700;
 line-height:1.2;
 text-align:center;
 white-space:normal;
}
.finance-order-source.source-app { background:#e8f5ff; color:#1769aa; }
.finance-order-source.source-erp { background:#eef0ff; color:#4b55a8; }
.finance-order-source.source-app-erp { background:#e6f6ef; color:#147349; }
.finance-order-source.source-w3 { background:#e8f8e9; color:#177b34; }
.finance-order-source.source-manual { background:#f3f0e8; color:#746127; }
/* Final desktop income-action contract: every income order row keeps all
   operational controls in one horizontal line. Horizontal table scrolling is
   intentional when the viewport cannot contain the complete row. */
@media(min-width:901px) {
 .finance-category-orders-panel table.finance-category-orders-table {
   min-width:1700px;
 }
 .finance-category-orders-panel table.finance-category-orders-table .finance-category-operation {
   width:480px;
 }
 .finance-category-orders-panel .finance-income-category-actions,
 .b2b-receivable-panel .b2b-order-list-table .b2b-receivable-row-actions,
 .b2b-receivable-panel .b2b-order-list-table .locked-actions {
   display:flex !important;
   flex-flow:row nowrap !important;
   align-items:center !important;
   gap:4px !important;
   min-width:450px;
   width:max-content;
   white-space:nowrap;
 }
 .finance-category-orders-panel .finance-income-category-actions > div,
 .finance-category-orders-panel .finance-income-category-actions > .b2b-payment-actions,
 .finance-category-orders-panel .finance-income-category-actions > .finance-classification-control,
 .b2b-receivable-panel .b2b-order-list-table .b2b-receivable-row-actions > .b2b-payment-actions,
 .b2b-receivable-panel .b2b-order-list-table .b2b-receivable-row-actions > .finance-classification-control {
   display:inline-flex !important;
   flex-flow:row nowrap !important;
   align-items:center !important;
   gap:4px !important;
   width:auto !important;
   max-width:none !important;
 }
 .finance-category-orders-panel .finance-income-category-actions button,
 .finance-category-orders-panel .finance-income-category-actions select,
 .b2b-receivable-panel .b2b-order-list-table .b2b-col-actions button,
 .b2b-receivable-panel .b2b-order-list-table .b2b-col-actions select {
   flex:0 0 auto !important;
   width:auto !important;
   min-width:0 !important;
   white-space:nowrap !important;
 }
 .finance-category-orders-panel .finance-income-category-actions .b2b-move-action-select,
 .b2b-receivable-panel .b2b-order-list-table .b2b-col-actions .b2b-move-action-select {
   width:96px !important;
   min-width:96px !important;
 }
}
@media(max-width:900px) {
 .finance-category-orders-panel table.finance-category-orders-table { display:block; }
 .finance-category-orders-table colgroup,.finance-category-orders-panel table.finance-category-orders-table thead { display:none; }
 .finance-category-orders-panel table.finance-category-orders-table tbody { display:block; }
 .finance-category-orders-panel table.finance-category-orders-table tr { display:block; border-bottom:1px solid var(--line); padding:8px 0; }
 .finance-category-orders-panel table.finance-category-orders-table td { display:grid; grid-template-columns:100px minmax(0,1fr); position:static; width:auto; }
 .finance-category-orders-panel table.finance-category-orders-table td::before { content:attr(data-label); font-weight:600; }
}
.finance-bank-natural-flow .table-actions{display:flex;flex-wrap:wrap;gap:6px}
.finance-bank-natural-flow input,.finance-bank-natural-flow select{min-width:0;max-width:100%;box-sizing:border-box}
.finance-bank-natural-flow .finance-bank-receipts-table{table-layout:fixed;font-size:13px}
.finance-bank-receipts-table .bank-col-select{width:3%}
.finance-bank-receipts-table .bank-col-date{width:9%}
.finance-bank-receipts-table .bank-col-source{width:10%}
.finance-bank-receipts-table .bank-col-remitter{width:15%}
.finance-bank-receipts-table .bank-col-amount{width:11%}
.finance-bank-receipts-table .bank-col-customer{width:17%}
.finance-bank-receipts-table .bank-col-status{width:10%}
.finance-bank-receipts-table .bank-col-actions{width:25%}
.finance-bank-receipts-table th,.finance-bank-receipts-table td{padding:7px 8px;vertical-align:middle}
.finance-bank-receipts-table .bank-receipt-actions-cell{overflow:visible!important;white-space:nowrap!important}
.finance-bank-receipts-table .bank-receipt-actions-cell .table-actions{display:flex;flex-wrap:nowrap;align-items:center;gap:5px;white-space:nowrap}
.finance-bank-receipts-table .bank-receipt-actions-cell button{flex:0 0 auto;min-width:0;padding:6px 9px;font-size:12px;white-space:nowrap}
@media(max-width:700px){
 .finance-bank-natural-flow table,.finance-bank-natural-flow thead,.finance-bank-natural-flow tbody{display:block}
 .finance-bank-natural-flow tr{display:flex;flex-wrap:wrap;border-bottom:1px solid #dce7e2;padding:6px 0}
 .finance-bank-natural-flow th,.finance-bank-natural-flow td{display:block;flex:1 1 125px;width:auto!important;min-width:0}
 .finance-bank-natural-flow button{max-width:100%;white-space:normal;overflow-wrap:anywhere}
}

/* Daily cash count: five independent actual channels, never an order receipt editor. */
.finance-cash-five-channels{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:12px 0}
.finance-cash-five-channels label,.finance-cash-entry label{min-width:0;display:flex;flex-direction:column;gap:6px}
.finance-cash-five-channels input,.finance-cash-entry input{box-sizing:border-box;max-width:100%;width:100%;min-width:0}
.finance-cash-entry .finance-cash-primary-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.finance-cash-reconcile-totals{display:flex;flex-wrap:wrap;gap:16px;padding:12px 0}
.finance-cash-entry-actions{display:flex;flex-wrap:wrap;gap:8px}
.finance-cash-close-history{max-width:100%;overflow-x:auto}
@media(max-width:900px){.finance-cash-five-channels{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:480px){.finance-cash-five-channels,.finance-cash-entry .finance-cash-primary-row{grid-template-columns:minmax(0,1fr)}.finance-cash-entry-actions button{flex:1 1 130px;min-width:0;white-space:normal}}

/* Cash management workspace: readable on wide monitors without stretching every field. */
.finance-cash-cost-workspace{max-width:1480px;margin:18px auto!important;border:1px solid #dfe8e4;border-radius:16px;overflow:hidden;background:#f8fbfa}
.finance-cash-cost-workspace>.panel-body{gap:16px;padding:18px 20px 22px}
.finance-cash-summary-grid{grid-template-columns:1.25fr 1.25fr .8fr .8fr;gap:12px}
.finance-cash-summary-grid .kpi{min-height:104px;padding:16px;border:1px solid #dce8e3;border-radius:14px;background:#fff}
.finance-cash-summary-grid .kpi strong{font-size:26px}
.finance-cash-summary-grid .finance-cash-settlement-kpi{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:100%;color:inherit;text-align:left;cursor:pointer;border-color:#8bcdb3;background:linear-gradient(135deg,#e9f8f1,#fff)}
.finance-cash-summary-grid .finance-cash-settlement-kpi:hover{border-color:#199b5f;box-shadow:0 8px 22px rgba(22,135,82,.12);transform:translateY(-1px)}
.finance-cash-summary-grid .finance-cash-settlement-kpi strong{color:#087a45}
.finance-cash-summary-grid .finance-cash-settlement-kpi small{margin-top:8px;color:#537267;font-weight:700}
.finance-cash-cost-layout{gap:16px}
.finance-cash-cost-layout .sub-panel{overflow:hidden;border:1px solid #dfe8e4;border-radius:14px;background:#fff}
.finance-cash-cost-layout .sub-panel>header{padding:14px 16px;border-bottom:1px solid #e5ece9}
.finance-cash-entry{padding:16px;background:#fff}
.finance-cash-check-grid{display:grid;grid-template-columns:minmax(230px,.7fr) minmax(0,2.3fr);gap:16px;align-items:start}
.finance-cash-evidence-card{padding:16px;border:1px solid #cfe1da;border-radius:13px;background:linear-gradient(180deg,#f0f9f5,#fff)}
.finance-cash-evidence-card .eyebrow{display:block;margin-bottom:12px;color:#177c50;font-size:12px;font-weight:850;letter-spacing:.08em}
.finance-cash-date-field{display:grid;gap:6px;color:#455b53;font-size:12px;font-weight:800}
.finance-cash-date-field input{min-height:38px}
.finance-cash-evidence-card dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:14px 0 0}
.finance-cash-evidence-card dl div{padding:10px;border-radius:9px;background:#fff;border:1px solid #e0ebe6}
.finance-cash-evidence-card dt{color:#687a73;font-size:11px;font-weight:700}
.finance-cash-evidence-card dd{margin:5px 0 0;color:#172b24;font-size:16px;font-weight:850;font-variant-numeric:tabular-nums}
.finance-cash-count-form{min-width:0}
.finance-cash-entry .finance-cash-five-channels{grid-template-columns:repeat(3,minmax(150px,1fr));gap:10px;margin:0 0 10px}
.finance-cash-entry .finance-cash-five-channels label,.finance-cash-entry .finance-cash-primary-row label{padding:10px;border:1px solid #dce7e3;border-radius:10px;background:#fbfdfc;color:#455b53;font-size:12px;font-weight:800}
.finance-cash-entry .finance-cash-five-channels input,.finance-cash-entry .finance-cash-primary-row input{min-height:38px;margin-top:3px;background:#fff;font-size:17px;font-weight:800;text-align:right}
.finance-cash-entry .finance-cash-five-channels small{color:#71827b;font-weight:600}
.finance-cash-entry .finance-cash-primary-row{grid-template-columns:repeat(2,minmax(180px,1fr));gap:10px}
.finance-cash-entry .finance-cash-money-field.banknote{background:#f0faf5}.finance-cash-entry .finance-cash-money-field.coin{background:#fff9ed}
.finance-cash-reconcile-totals{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:10px}
.finance-cash-reconcile-totals span{display:flex;justify-content:space-between;gap:8px;padding:10px 12px;border-radius:9px;background:#f1f5f3;color:#53645e;font-size:12px;font-weight:750}
.finance-cash-reconcile-totals strong{color:#192c25;font-size:15px}
.finance-cash-entry-actions{justify-content:flex-end;margin-top:10px}
.finance-cash-help{margin:0;padding-top:10px;border-top:1px dashed #dce7e2;font-size:12px}
.finance-cash-history-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px 8px;border-top:1px solid #e5ece9}
.finance-cash-history-head strong{display:block}.finance-cash-history-head span{display:block;margin-top:2px;color:#718078;font-size:12px}
.finance-cash-close-history{max-height:360px!important;margin:0 14px 14px;border:1px solid #e1e9e6;border-radius:10px}
.finance-cash-close-history .finance-cost-history-table{min-width:960px}
.finance-cash-close-history th{position:sticky;top:0;z-index:1;background:#f1f6f4}
.finance-cash-close-history td{vertical-align:top;padding:10px!important}
.finance-cash-close-history td span,.finance-cash-close-history td small{display:block;margin-top:3px;white-space:normal}
.finance-cash-close-history td small{color:#718078;font-size:11px}
.finance-cash-close-history td .danger{color:#c53030}
dialog.finance-cash-settlement-dialog{width:min(1120px,94vw)!important;height:min(720px,88vh)!important}
.finance-cash-settlement-dialog .finance-cash-preview-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:14px}
.finance-cash-preview-summary>div{padding:14px;border:1px solid #dce8e3;border-radius:12px;background:#f5faf8}
.finance-cash-preview-summary span{display:block;color:#60736b;font-size:12px}.finance-cash-preview-summary strong{display:block;margin-top:5px;color:#087a45;font-size:24px}
.finance-cash-settlement-dialog table{min-width:840px}.finance-cash-settlement-dialog th{position:sticky;top:0;background:#eff6f3}
.finance-cash-preview-pager{display:flex;align-items:center;justify-content:center;gap:12px;padding:12px 0}
@media(max-width:1050px){.finance-cash-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-cash-check-grid{grid-template-columns:1fr}.finance-cash-evidence-card dl{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:720px){.finance-cash-cost-workspace{margin:8px!important;border-radius:12px}.finance-cash-cost-workspace>.panel-body{padding:12px}.finance-cash-summary-grid{grid-template-columns:1fr}.finance-cash-check-grid{display:block}.finance-cash-evidence-card{margin-bottom:12px}.finance-cash-evidence-card dl{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-cash-entry .finance-cash-five-channels{grid-template-columns:1fr}.finance-cash-entry .finance-cash-primary-row,.finance-cash-reconcile-totals{grid-template-columns:1fr}.finance-cash-settlement-dialog .finance-cash-preview-summary{grid-template-columns:1fr}}

/* Finance secondary dialogs share the cash-document summary geometry. */
:root{--finance-summary-width:min(1120px,96vw);--finance-summary-height:min(720px,88vh)}
.b2b-summary-modal-backdrop{padding:0}
.b2b-summary-modal,.w3-finance-summary-dialog{box-sizing:border-box;width:var(--finance-summary-width);height:var(--finance-summary-height);border-radius:14px;background:#fff;box-shadow:0 20px 60px rgba(15,23,42,.3)}
.finance-bank-binding-overlay.w3-finance-summary-backdrop{display:flex;align-items:center;justify-content:center;padding:0;background:rgba(15,23,42,.35)}
.finance-bank-receipt-binding.w3-finance-summary-dialog,
dialog.w3-finance-summary-dialog{width:var(--finance-summary-width)!important;max-width:96vw!important;height:var(--finance-summary-height)!important;max-height:var(--finance-summary-height)!important;padding:16px;border:0;overflow:hidden;min-width:0}
dialog.w3-finance-summary-dialog[open]{position:fixed;inset:0!important;margin:auto!important;transform:none!important;display:flex;flex-direction:column;overflow:hidden!important}
dialog.w3-finance-summary-dialog::backdrop{background:rgba(15,23,42,.35)}
.exception-center-shell{display:grid;gap:14px}.exception-center-header>header,.exception-center-list>header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line)}.exception-center-header h2,.exception-center-header p,.exception-center-list h3,.exception-center-list p{margin:0}.exception-center-header p,.exception-center-list p{margin-top:4px;color:var(--muted);font-size:12px}.exception-center-filters{display:flex;flex-wrap:wrap;gap:12px;padding:14px 16px}.exception-center-filters label{display:grid;gap:5px;min-width:220px}.exception-center-table{max-height:calc(100dvh - 370px);min-height:240px;overflow:auto;overscroll-behavior:contain}.exception-center-table table{min-width:900px}.exception-center-table td:nth-child(3){min-width:280px}.exception-center-table td strong,.exception-center-table td small{display:block}.exception-center-table td small{margin-top:4px;color:var(--muted)}.exception-center-actions{display:flex;flex-wrap:wrap;gap:6px}.exception-center-list>footer{display:flex;align-items:center;justify-content:center;gap:10px;padding:12px 16px;border-top:1px solid var(--line)}.risk-level{display:inline-flex;min-width:28px;justify-content:center;padding:3px 8px;border-radius:999px;font-weight:800}.risk-高{background:#fee2e2;color:#b91c1c}.risk-中{background:#fef3c7;color:#92400e}.risk-低{background:#dcfce7;color:#166534}
@media(max-width:700px){dialog.w3-centered-scroll-dialog[open]{width:calc(100vw - 12px);max-width:calc(100vw - 12px);height:calc(100dvh - 12px);max-height:calc(100dvh - 12px)}.inbound-quick-master-dialog.w3-centered-scroll-dialog{width:calc(100vw - 12px);height:calc(100dvh - 12px)}.exception-center-header>header,.exception-center-list>header{align-items:flex-start}.exception-center-filters{display:grid}.exception-center-filters label{min-width:0}.exception-center-table{max-height:calc(100dvh - 420px)}}
.finance-bank-receipt-binding.w3-finance-summary-dialog{display:flex;flex-direction:column;margin:0}
.w3-finance-summary-dialog>header,.w3-finance-summary-dialog>form>header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding:0 0 12px!important;margin:0 0 12px;min-height:0}
.w3-finance-summary-dialog>header h3,.w3-finance-summary-dialog>form>header h3,.w3-finance-summary-dialog>header strong{font-size:18px;line-height:1.4;margin:0}
.finance-bank-receipt-binding.w3-finance-summary-dialog>header .bank-receipt-binding-summary{font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.w3-finance-summary-dialog button{min-height:32px;white-space:normal}
.w3-finance-summary-dialog>form{display:flex;flex-direction:column;min-height:0;max-height:none;height:100%;overflow:hidden}
.w3-finance-summary-dialog>.compact-panel-body,.w3-finance-summary-dialog>.audit-log-body,.w3-finance-summary-dialog>.b2b-order-detail-body,.w3-finance-summary-dialog>pre,.w3-finance-summary-dialog>form>.b2b-payment-difference-body{flex:1 1 auto;min-height:0;overflow:auto;max-height:none;margin:0}
.w3-finance-summary-dialog>pre{white-space:pre-wrap;overflow-wrap:anywhere}
.w3-finance-summary-dialog>form>footer{flex:none;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding:12px 0 0}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap{max-height:none;overflow:auto}
.finance-bank-receipt-binding.w3-finance-summary-dialog .bank-receipt-binding-actions{position:sticky;bottom:0;background:#fff;z-index:2;display:flex;flex-wrap:wrap;gap:8px;padding:12px 0}
.finance-bank-receipt-binding.w3-finance-summary-dialog .bank-receipt-binding-toolbar{display:flex;flex-wrap:wrap;gap:8px}
.w3-finance-summary-dialog input,.w3-finance-summary-dialog select,.w3-finance-summary-dialog textarea{max-width:100%;box-sizing:border-box}
@media(max-width:800px){:root{--finance-summary-height:min(680px,92vh)}.w3-finance-summary-dialog{padding:12px!important}.w3-finance-summary-dialog>header,.w3-finance-summary-dialog>form>header{align-items:flex-start}.finance-bank-receipt-binding.w3-finance-summary-dialog .bank-receipt-binding-toolbar>*{min-width:0;max-width:100%}.finance-bank-receipt-binding.w3-finance-summary-dialog .bank-receipt-customer-search{flex:1 1 100%}.finance-bank-receipt-binding.w3-finance-summary-dialog .bank-receipt-selected-customer{white-space:normal}}

.customer-import-panel{margin:12px 0;border:1px solid #b9dfcf;background:#fbfffd}.customer-import-panel>header{display:flex;justify-content:space-between;align-items:flex-start;padding:14px 16px;border-bottom:1px solid #dceae4}.customer-import-panel h3{margin:0 0 4px}.customer-import-controls{display:flex;align-items:end;gap:10px;flex-wrap:wrap;padding:14px 16px}.customer-import-controls label{display:grid;gap:5px;min-width:210px}.customer-import-controls select{min-height:38px}.customer-import-file{max-width:360px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#52646c}.customer-import-stats{display:grid;grid-template-columns:repeat(9,minmax(100px,1fr));gap:8px;padding:0 16px 12px}.customer-import-stats>div{border:1px solid #dce7e2;border-radius:8px;padding:9px 10px;background:#fff}.customer-import-stats span{display:block;color:#6a7b82;font-size:12px}.customer-import-stats strong{font-size:20px;color:#0d7148}.customer-import-summary{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:10px 16px;background:#edf7f2;border-block:1px solid #d6e9df}.customer-import-summary button{margin-left:auto}.customer-import-table{max-height:420px;overflow:auto;margin:12px 16px 16px;border:1px solid #dde6e2;border-radius:8px}.customer-import-table table,.customer-import-history table{width:100%;border-collapse:collapse}.customer-import-table th{position:sticky;top:0;background:#f1f6f4;z-index:1}.customer-import-table th,.customer-import-table td,.customer-import-history th,.customer-import-history td{padding:8px 10px;border-bottom:1px solid #e6ece9;text-align:left}.customer-import-history{margin:14px 16px 16px;overflow:auto}.customer-import-history h4{margin:0 0 8px}.customer-import-history table{min-width:720px;border:1px solid #dde6e2}.customer-import-review,.customer-import-error{background:#fff5f2}.customer-import-update{background:#fffdf1}.customer-import-committed{background:#f0faf4}@media(max-width:1100px){.customer-import-stats{grid-template-columns:repeat(3,1fr)}}@media(max-width:700px){.customer-import-controls>*{width:100%;max-width:none}.customer-import-stats{grid-template-columns:repeat(2,1fr)}.customer-import-summary button{margin-left:0;width:100%}.customer-import-table,.customer-import-history{margin-inline:8px}.customer-import-panel>header{padding-inline:10px}}

/* W3 bank allocation scroll isolation 20260916 */
.finance-bank-receipt-binding.w3-finance-summary-dialog>.compact-panel-body{flex:1 1 0;min-height:0;height:auto!important;max-height:100%!important;overflow:auto!important;overscroll-behavior:contain}
/* W3 customer account allocation 20260916 */
.finance-bank-receipt-binding.w3-finance-summary-dialog>.bank-receipt-binding-actions{flex:none;position:static;padding-bottom:0}
.finance-bank-receipt-binding [data-bank-receipt-difference]{color:inherit}
.finance-bank-receipt-binding input[type="checkbox"]{width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;flex:none;padding:0}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap{max-height:min(42vh,320px)!important;overflow:auto!important;position:relative}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap thead th{position:sticky!important;top:0;z-index:3;background:#f3f8f7}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap table{display:table;min-width:700px!important}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap thead{display:table-header-group}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap tbody{display:table-row-group}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap tr{display:table-row}
.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap th,.finance-bank-receipt-binding.w3-finance-summary-dialog .compact-table-wrap td{display:table-cell}
#finance-customer-account [data-account-body]{padding-top:12px;overflow:auto;min-height:0}
#finance-customer-account nav{display:flex;gap:8px;flex-wrap:wrap;flex:none}

/* Order detail uses the same centered summary-dialog shell, with a complete scrollable data region. */
dialog.b2b-order-detail-dialog.w3-finance-summary-dialog{width:min(1680px,96vw)!important;height:min(800px,90vh)!important;max-height:90vh!important;padding:20px;font-size:14px;line-height:1.45}
.b2b-order-detail-dialog>form{gap:12px}
.b2b-order-detail-dialog>form>header{padding:0 0 12px!important;margin:0!important;border-bottom:1px solid #e2e8f0;align-items:flex-start}
.b2b-order-detail-dialog>form>header h3{font-size:20px;line-height:1.35;margin:0 0 4px;overflow-wrap:anywhere}
.b2b-order-detail-dialog>form>header p{margin:0;color:#64748b;font-size:13px;line-height:1.45;overflow-wrap:anywhere}
.b2b-order-detail-dialog .close-button{flex:none;width:40px;min-width:40px;height:40px;padding:0;font-size:18px}
.b2b-order-detail-dialog .b2b-order-detail-body{display:flex;flex-direction:column;gap:10px;min-height:0;padding:0!important;overflow:hidden!important}
.b2b-order-detail-dialog .b2b-order-payment-setting{flex:none;margin:0;padding:12px 14px}
.b2b-order-detail-dialog .b2b-order-payment-setting h3{font-size:16px;margin:0 0 8px}
.b2b-order-detail-dialog .b2b-order-payment-setting dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0}
.b2b-order-detail-dialog .b2b-order-payment-setting dl div{min-width:0}
.b2b-order-detail-dialog .b2b-order-payment-setting dt{font-size:12px;color:#64748b}
.b2b-order-detail-dialog .b2b-order-payment-setting dd{margin:2px 0 0;font-weight:700;overflow-wrap:anywhere}
.b2b-order-detail-dialog .b2b-order-payment-setting p{margin:8px 0 0;font-size:12px;line-height:1.45}
.b2b-order-detail-dialog .b2b-order-detail-sources{flex:none;margin:0}
.b2b-order-detail-dialog .b2b-order-detail-table-wrap{flex:1 1 320px;min-height:180px;max-height:none;overflow:auto!important;overscroll-behavior:contain;border:1px solid #e2e8f0;border-radius:8px}
.b2b-order-detail-dialog .b2b-order-detail-table{display:table;width:100%;min-width:1420px;table-layout:fixed;border-collapse:separate;border-spacing:0;font-size:13px;line-height:1.45}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-source-col{width:130px}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-code-col{width:230px}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-name-col{width:260px}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-spec-col{width:180px}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-unit-col{width:70px}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-quantity-col{width:80px}
.b2b-order-detail-dialog .b2b-order-detail-table col.detail-money-col{width:110px}
.b2b-order-detail-dialog .b2b-order-detail-table th,.b2b-order-detail-dialog .b2b-order-detail-table td{display:table-cell;padding:10px 12px;vertical-align:top;font-size:13px;white-space:normal;overflow-wrap:anywhere;word-break:break-word;border-width:0 1px 1px 0}
.b2b-order-detail-dialog .b2b-order-detail-table th{position:sticky;top:0;z-index:3;background:#f3f7f6;color:#475569;font-size:12px;line-height:1.35;white-space:normal}
.b2b-order-detail-dialog .b2b-order-detail-table th:nth-child(n+5),.b2b-order-detail-dialog .b2b-order-detail-table td:nth-child(n+5){text-align:right;font-variant-numeric:tabular-nums}
.b2b-order-detail-dialog .b2b-order-detail-table th:nth-child(5),.b2b-order-detail-dialog .b2b-order-detail-table td:nth-child(5){text-align:center}
.b2b-order-detail-dialog .b2b-order-detail-table td:nth-child(n+6){white-space:nowrap}
.b2b-order-detail-dialog .b2b-order-detail-totals{flex:none;justify-content:flex-end;gap:8px 18px;margin:0;padding:8px 12px;border:1px solid #dbe7e4;border-radius:8px;background:#f8fbfa;font-size:13px}
.b2b-order-detail-dialog>form>footer{border-top:1px solid #e2e8f0;margin-top:0;padding-top:12px!important}
@media(max-width:800px){dialog.b2b-order-detail-dialog.w3-finance-summary-dialog{width:calc(100vw - 16px)!important;height:calc(100dvh - 24px)!important;max-height:calc(100dvh - 24px)!important;padding:12px}.b2b-order-detail-dialog .b2b-order-payment-setting dl{grid-template-columns:1fr}.b2b-order-detail-dialog .b2b-order-payment-setting{padding:10px}.b2b-order-detail-dialog .b2b-order-detail-table-wrap{flex-basis:240px}.b2b-order-detail-dialog .b2b-order-detail-totals{justify-content:flex-start}}
#finance-customer-account table{width:100%;table-layout:fixed}
#finance-customer-account td{overflow-wrap:anywhere}
.finance-petty-cash-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:14px 16px;border-bottom:1px solid var(--line);background:#f7faf9}.finance-petty-cash-summary>div{display:grid;gap:5px;padding:12px 14px;border:1px solid #dce7e3;border-radius:10px;background:#fff}.finance-petty-cash-summary span{color:var(--muted);font-size:12px}.finance-petty-cash-summary strong{font-size:22px;color:#1e4838}.finance-petty-cash-summary .balance{border-color:#96cfb5;background:#eef9f3}.finance-petty-cash-summary .balance strong{color:#08734b;font-size:25px}.petty-flow-kind{display:inline-flex;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:800}.petty-flow-kind.in{background:#dcfce7;color:#166534}.petty-flow-kind.out{background:#fee2e2;color:#b91c1c}.finance-cost-history-table .money-in{color:#08734b;font-weight:800}.finance-cost-history-table .money-out{color:#b42318;font-weight:800}
@media(max-width:800px){.finance-petty-cash-summary{grid-template-columns:1fr}.finance-petty-cash-summary>div{padding:10px 12px}}
/* API-backed global overview */
.global-overview-shell{display:grid;gap:16px;min-width:0}
.global-overview-header{margin:0;overflow:visible}
.global-overview-header>header{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 20px}
.global-overview-heading h2,.global-overview-heading p,.global-overview-table-panel header h3,.global-overview-table-panel header p,.global-overview-business-panel header h3,.global-overview-business-panel header p,.global-overview-risk-panel header h3,.global-overview-risk-panel header p{margin:0}
.global-overview-heading p,.global-overview-table-panel header p,.global-overview-business-panel header p,.global-overview-risk-panel header p{margin-top:4px;color:var(--muted);font-size:12px;font-weight:400}
.global-overview-toolbar{display:flex;align-items:flex-end;justify-content:flex-end;gap:10px;flex-wrap:wrap}
.global-overview-toolbar label{display:grid;gap:5px;color:var(--muted);font-size:12px}
.global-overview-toolbar input{min-width:150px}
.global-overview-notice{padding:0 20px 14px;color:#946200}
.global-channel-overview-panel{margin:0;overflow:hidden;border-color:#d7e4df;background:#f8fbfa}.global-channel-overview-panel>header{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:18px 20px 15px;border-bottom:1px solid #dfeae6;background:#fff}
.global-channel-overview-panel header h3,.global-channel-overview-panel header p{margin:0}.global-channel-overview-panel header h3{font-size:19px;letter-spacing:-.02em}.global-channel-overview-panel header p{margin-top:5px;color:var(--muted);font-size:12px;font-weight:400}.global-channel-kicker{display:block;margin-bottom:4px;color:#21855d;font-size:10px;font-weight:800;letter-spacing:.13em}.global-channel-count{display:flex;align-items:baseline;gap:5px;color:#123c2e;font-size:25px;font-weight:800}.global-channel-count small{color:#71827b;font-size:11px;font-weight:600}
.global-channel-dashboard{display:grid;grid-template-columns:minmax(270px,.8fr) minmax(0,2.2fr);gap:14px;padding:16px}.global-channel-hero,.global-channel-card{appearance:none;min-width:0;border-radius:15px;text-align:left;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease}.global-channel-hero:hover,.global-channel-card:hover{transform:translateY(-2px);box-shadow:0 10px 26px rgba(23,65,49,.1)}
.global-channel-dashboard .global-channel-hero{display:flex;flex-direction:column;padding:20px;border:1px solid #176f4c!important;background:linear-gradient(145deg,#0d6544,#16805a)!important;color:#fff!important;box-shadow:0 10px 24px rgba(13,101,68,.16)}.global-channel-dashboard .global-channel-hero *{color:inherit}.global-channel-card-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%}.global-channel-card-heading>span{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:800}.global-channel-card-heading i{width:8px;height:8px;border-radius:50%;background:currentColor;box-shadow:0 0 0 4px rgba(255,255,255,.13)}.global-channel-card-heading em{font-size:11px;font-style:normal;font-weight:700;opacity:.75}.global-channel-hero-label{margin-top:27px;color:rgba(255,255,255,.7)!important;font-size:11px}.global-channel-hero>strong{margin-top:5px;font-size:31px;line-height:1.08;letter-spacing:-.03em;overflow-wrap:anywhere}.global-channel-hero-metrics{display:grid;grid-template-columns:1fr 1fr;gap:11px 13px;margin-top:23px}.global-channel-hero-metrics>span{display:grid;gap:3px}.global-channel-hero-metrics small{color:rgba(255,255,255,.62)!important;font-size:10px}.global-channel-hero-metrics b{font-size:13px;overflow-wrap:anywhere}
.global-channel-card-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.global-channel-card{--channel-accent:#178359;display:flex;flex-direction:column;gap:7px;padding:16px 17px;border:1px solid #dce7e3;background:#fff;color:var(--text);box-shadow:0 2px 7px rgba(32,67,54,.035)}.global-channel-card.tone-blue{--channel-accent:#2877c7}.global-channel-card.tone-amber{--channel-accent:#c77b18}.global-channel-card.tone-violet{--channel-accent:#7b61c8}.global-channel-card .global-channel-card-heading>span,.global-channel-card .global-channel-card-heading>em{color:var(--channel-accent)}.global-channel-card>small{color:var(--muted);font-size:10px}.global-channel-card>strong{margin-top:2px;color:#19352b;font-size:23px;line-height:1.12;letter-spacing:-.02em;overflow-wrap:anywhere}.global-channel-card-finance{display:flex;justify-content:space-between;gap:10px;margin-top:3px;color:#718078;font-size:10px}.global-channel-card-finance span:last-child{text-align:right}.global-channel-card-finance b{display:block;margin-top:2px;color:#43584f;font-size:11px}
.global-channel-card-primary-label{margin-top:-3px;color:#7b8a84;font-size:9px}.global-channel-card-sources{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:3px;color:#718078;font-size:9px}.global-channel-card-sources>span:last-child{text-align:right}.global-channel-card-sources b,.global-channel-card-sources small{display:block}.global-channel-card-sources b{margin-top:2px;color:#43584f;font-size:11px}.global-channel-card-sources small{margin-top:1px;color:#93a09b;font-size:8px}
.global-channel-progress{display:block;width:100%;height:5px;margin-top:auto;border-radius:999px;background:#e8efec;overflow:hidden}.global-channel-progress i{display:block;height:100%;border-radius:inherit;background:var(--channel-accent,#5dc391)}.global-channel-progress.is-total{margin-top:16px;background:rgba(255,255,255,.17)}.global-channel-progress.is-total i{background:#80e2b5}.global-channel-rate{display:flex;justify-content:space-between;margin-top:2px;color:#687a72;font-size:10px}.global-channel-rate b{color:var(--channel-accent)}.global-channel-hero>.global-channel-rate{color:rgba(255,255,255,.7)}
.global-channel-overview-panel>footer{display:flex;align-items:center;gap:18px;flex-wrap:wrap;padding:0 18px 15px;color:#718078;font-size:10px}.global-channel-overview-panel>footer span{display:flex;align-items:center;gap:6px}.global-channel-overview-panel>footer i{width:7px;height:7px;border-radius:50%}.global-channel-legend-sales{background:#23885f}.global-channel-legend-finance{background:#91a69d}
.global-overview-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0}
.global-overview-kpis .kpi{display:grid;gap:7px;align-content:start;min-height:108px;padding:16px 18px;border:1px solid var(--line);border-radius:12px;background:linear-gradient(145deg,#fff,#f1f8f5)}
.global-overview-kpis .kpi>span{color:var(--muted);font-size:13px}
.global-overview-kpis .kpi>strong{font-size:26px;line-height:1.15;color:var(--text);overflow-wrap:anywhere}
.global-overview-kpis .kpi>small{color:var(--muted);font-size:11px}
.global-overview-report-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(520px,.9fr);gap:16px;align-items:start;min-width:0}
.global-overview-side-tables{display:grid;gap:16px;min-width:0}
.global-overview-table-panel,.global-overview-business-panel,.global-overview-risk-panel{margin:0;min-width:0;overflow:hidden}
.global-overview-table-panel>header,.global-overview-business-panel>header,.global-overview-risk-panel>header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line)}
.global-overview-table-wrap{max-height:430px;overflow:auto;padding:0}
.global-overview-table-wrap table{width:100%;min-width:660px;margin:0;border-collapse:separate;border-spacing:0}
.global-overview-table-wrap th{position:sticky;top:0;z-index:1;background:#f7faf9}
.global-overview-table-wrap th,.global-overview-table-wrap td{padding:10px 12px;text-align:right;white-space:nowrap}
.global-overview-table-wrap th:first-child,.global-overview-table-wrap td:first-child{text-align:left}
.global-overview-table-wrap .empty{padding:28px 16px}
.global-overview-business-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.global-overview-business-card{display:grid;gap:7px;padding:16px;border:1px solid var(--line);border-radius:10px;background:#fbfdfc}
.global-overview-business-card span{color:var(--muted);font-size:12px}
.global-overview-business-card strong{font-size:20px;overflow-wrap:anywhere}
.global-overview-business-card.is-muted strong{color:var(--muted)}
.global-overview-risk-actions{display:flex;gap:6px;justify-content:flex-end}
.global-overview-pagination{position:sticky;bottom:0;margin:0;padding:10px 12px;background:#fff;border-top:1px solid var(--line)}
.global-overview-ranking-panel,.global-overview-store-panel{margin:0;min-width:0;overflow:hidden}
.global-overview-ranking-panel>header,.global-overview-store-panel>header{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line)}
.global-overview-ranking-panel header h3,.global-overview-ranking-panel header p,.global-overview-store-panel header h3,.global-overview-store-panel header p{margin:0}
.global-overview-ranking-panel header p,.global-overview-store-panel header p{margin-top:4px;color:var(--muted);font-size:12px;font-weight:400}
.global-overview-ranking-list,.global-overview-store-list{display:grid;gap:0;padding:0;max-height:360px;overflow:auto}
.global-overview-ranking-row,.global-overview-store-list>button{position:relative;display:grid;align-items:center;width:100%;min-width:0;border:0;border-bottom:1px solid var(--line);border-radius:0;background:#fff;color:var(--text);text-align:left;box-shadow:none}
.global-overview-ranking-row{grid-template-columns:34px minmax(0,1fr) auto;gap:10px;padding:12px 14px}
.global-overview-ranking-row:hover,.global-overview-store-list>button:hover{background:#f5faf8}
.global-overview-rank{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#eef3f1;color:var(--muted);font-size:12px;font-weight:700}
.global-overview-rank.top-1{background:#fff1bd;color:#8a6300}.global-overview-rank.top-2{background:#e9eef3;color:#51606d}.global-overview-rank.top-3{background:#f6dfcf;color:#945024}
.global-overview-rank-main,.global-overview-rank-amount,.global-overview-store-list>button>span{display:grid;gap:3px;min-width:0}
.global-overview-rank-main strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.global-overview-rank-main small,.global-overview-rank-amount small,.global-overview-store-list small{color:var(--muted);font-size:11px}
.global-overview-rank-main i{display:block;width:var(--rank-width);height:4px;margin-top:3px;border-radius:999px;background:linear-gradient(90deg,#16965d,#66be91)}
.global-overview-rank-amount{text-align:right;white-space:nowrap}.global-overview-rank-amount>strong{font-size:16px;color:#116f49}
.global-overview-store-list>button{grid-template-columns:minmax(0,1fr) auto;gap:12px;padding:12px 14px}
.global-overview-store-list>button>span:last-of-type{text-align:right}.global-overview-store-list>button>i{position:absolute;left:0;bottom:0;width:var(--store-width);height:3px;background:#3daa77}
.global-salesperson-finance-panel{margin:0;min-width:0}.global-salesperson-finance-panel .global-overview-table-wrap{max-height:calc(100vh - 245px)}
.global-salesperson-finance-panel table{min-width:1050px}.global-salesperson-finance-panel th,.global-salesperson-finance-panel td{padding:12px 14px}
.global-salesperson-finance-panel th:first-child,.global-salesperson-finance-panel td:first-child{min-width:180px}.global-salesperson-finance-panel td:first-child{display:flex;align-items:center;gap:10px}
.global-salesperson-finance-panel td:nth-child(n+2):not(:last-child){text-align:right}.global-finance-received{color:#0b7a4b;font-weight:700}.global-finance-unreceived{color:#bf2d2d;font-weight:700}
.global-collection-status{display:inline-flex;padding:3px 9px;border-radius:999px;font-size:12px;font-weight:700;white-space:nowrap}.global-collection-status.settled{background:#e3f5ec;color:#116f49}.global-collection-status.partial{background:#fff2ce;color:#8a6300}.global-collection-status.unpaid{background:#fde7e5;color:#a62b25}.global-collection-status.refund{background:#eee8ff;color:#6541a5}
.global-salesperson-finance-panel td:nth-child(8) small{display:block;margin-top:4px;color:#6541a5;white-space:nowrap}
.global-mail-summary{margin:18px 14px 14px;padding-top:16px;border-top:1px solid #dfe9e5}.global-mail-summary h4{margin:0 0 4px}.global-mail-summary .muted{margin:0 0 10px}.global-mail-summary table{min-width:900px}.global-mail-summary .global-mail-total td{background:#f0faf6}
#global-api-drill table{min-width:760px;width:100%}
@media(max-width:1280px){.global-overview-report-grid{grid-template-columns:1fr}.global-overview-side-tables{grid-template-columns:repeat(2,minmax(0,1fr))}.global-channel-dashboard{grid-template-columns:minmax(250px,.75fr) minmax(0,2fr)}}
@media(max-width:900px){.global-overview-kpis,.global-overview-business-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.global-overview-side-tables{grid-template-columns:1fr}.global-overview-header>header{align-items:flex-start;flex-direction:column}.global-overview-toolbar{justify-content:flex-start;width:100%}.global-channel-dashboard{grid-template-columns:1fr}.global-channel-hero-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:640px){.global-overview-kpis,.global-overview-business-grid,.global-channel-card-grid{grid-template-columns:1fr}.global-overview-toolbar>*{max-width:100%;box-sizing:border-box}.global-overview-toolbar label,.global-overview-toolbar input{width:100%}.global-overview-kpis .kpi>strong{font-size:22px}.global-channel-overview-panel>header{align-items:flex-start}.global-channel-dashboard{padding:12px}.global-channel-hero-metrics{grid-template-columns:1fr 1fr}.global-channel-overview-panel>footer{gap:8px 14px}}
/* Customer summaries: two compact pages on desktop, one readable page on narrow screens. */
.b2b-summary-modal{display:flex;flex-direction:column;gap:10px;width:min(1720px,calc(100vw - 32px));height:min(860px,calc(100dvh - 32px));padding:16px;font-size:13px;line-height:1.35}
.b2b-summary-modal>header{flex:none;margin:0;padding:0 0 12px;border-bottom:1px solid #e2e8f0;gap:16px}
.b2b-summary-modal h3{font-size:20px;margin:0 0 4px}
.b2b-summary-modal>header span{font-size:13px;color:#64748b}
.b2b-summary-modal>.admin-flash{flex:none;margin:0;font-size:12px;line-height:1.5;max-height:72px;overflow:auto}
.b2b-summary-modal .b2b-summary-viewport{flex:1;min-height:0;overflow:hidden}
.b2b-summary-modal .b2b-summary-pages{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;height:100%;animation:none}
.b2b-summary-modal .b2b-summary-pane{height:100%;overflow:auto;padding:0;border:1px solid #e2e8f0;border-radius:8px}
.b2b-summary-modal .b2b-summary-pane-title{display:block;position:sticky;top:0;z-index:4;margin:0;padding:6px 10px;border-bottom:1px solid #e2e8f0;background:#fff;color:#64748b;font-size:12px;font-weight:800}
.b2b-summary-modal .b2b-debt-summary-table{width:100%;min-width:0;table-layout:fixed;font-size:12px;line-height:1.3}
.b2b-summary-modal .b2b-monthly-summary-table{min-width:620px}
.b2b-summary-modal .b2b-debt-summary-table th,.b2b-summary-modal .b2b-debt-summary-table td{padding:7px 9px;vertical-align:middle;font-size:12px;white-space:normal;overflow-wrap:anywhere}
.b2b-summary-modal .b2b-debt-summary-table th{position:sticky;top:0;z-index:2;background:#f3f7f6;font-size:13px;white-space:normal}
.b2b-summary-modal .b2b-debt-summary-table th:first-child,.b2b-summary-modal .b2b-debt-summary-table td:first-child{width:auto;text-align:left}
.b2b-summary-modal .b2b-debt-summary-table th:not(:first-child),.b2b-summary-modal .b2b-debt-summary-table td:not(:first-child){width:112px;text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.b2b-summary-modal .b2b-debt-summary-table tr.b2b-summary-overdue td{background:#fff1f0;color:#b42318;font-weight:700}
.b2b-summary-modal .b2b-debt-summary-table tr.b2b-summary-overdue td:first-child{box-shadow:inset 4px 0 0 #d92d20}
.b2b-summary-modal .b2b-debt-summary-table tr.b2b-summary-overdue .link-button,.b2b-summary-modal .b2b-debt-summary-table tr.b2b-summary-overdue strong{color:#b42318;font-weight:800}
.b2b-summary-modal .b2b-monthly-summary-table th:nth-child(2),.b2b-summary-modal .b2b-monthly-summary-table td:nth-child(2){width:90px;text-align:center}
.b2b-summary-modal .b2b-monthly-summary-table th:nth-child(3),.b2b-summary-modal .b2b-monthly-summary-table td:nth-child(3){width:70px;text-align:center}
.b2b-summary-modal .b2b-monthly-summary-table th:last-child,.b2b-summary-modal .b2b-monthly-summary-table td:last-child{width:100px;text-align:center}
.b2b-summary-modal button{font-size:13px;line-height:1.4;min-height:30px;padding:5px 10px;max-width:100%;margin:0}
.b2b-summary-modal .link-button{border:0;background:transparent;box-shadow:none;padding:3px 0;min-width:0}
.b2b-summary-modal .b2b-list-pagination{flex:none;margin:0;gap:14px;font-size:13px}
.b2b-summary-view-switch{display:flex;flex:none;align-items:center;gap:6px;padding:4px;border:1px solid #dbe7e2;border-radius:9px;background:#f4f8f6;align-self:flex-start}
.b2b-summary-view-switch button{min-width:150px;border-color:transparent;background:transparent;color:#52645e;font-weight:700}
.b2b-summary-view-switch button.active{background:#159447;color:#fff;border-color:#159447;box-shadow:0 1px 3px rgba(15,118,69,.18)}
.b2b-summary-view-switch-with-filters{max-width:100%;overflow-x:auto}
.b2b-summary-filter-bar{display:flex;align-items:center;justify-content:flex-start;flex:none;gap:7px;margin-left:4px;padding:0 0 0 9px;border:0;border-left:1px solid #d5e2dc;background:transparent}
.b2b-summary-filter-bar label{display:flex;align-items:center;gap:5px;color:#52645e;font-size:12px;font-weight:700;white-space:nowrap}
.b2b-summary-filter-bar select{min-width:128px;height:30px;border:1px solid #cbd8d2;border-radius:6px;background:#fff;padding:3px 25px 3px 8px;color:#17241f;font-size:12px}
.b2b-summary-filter-bar>span{display:none}
.b2b-summary-breadcrumb{display:flex;flex:none;align-items:center;gap:12px;min-height:34px;color:#64748b}
.b2b-summary-breadcrumb button{color:#147d50;border-color:#b8d9ca;background:#f3faf7}
.b2b-summary-amount-link strong{color:#087443;font-size:14px;text-decoration:underline;text-underline-offset:3px}
.b2b-summary-modal .b2b-month-overview-table th:first-child,.b2b-summary-modal .b2b-month-overview-table td:first-child{width:150px}
.b2b-summary-modal .b2b-month-overview-table th:not(:first-child),.b2b-summary-modal .b2b-month-overview-table td:not(:first-child){width:auto}
.b2b-summary-modal .b2b-month-customer-table th:last-child,.b2b-summary-modal .b2b-month-customer-table td:last-child{width:180px}
.finance-summary-customer{display:flex;align-items:flex-start;gap:10px;text-align:left}
.finance-summary-customer>span{min-width:0;overflow-wrap:anywhere}
.finance-summary-customer .finance-account-entry{flex:0 0 auto;color:#16746e;background:#eff8f6;border:1px solid #cde5df;border-radius:5px;font-size:11px;padding:3px 6px}
.finance-account-search{display:flex;align-items:end;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.finance-account-workspace table{width:100%;table-layout:fixed}
.finance-account-workspace td{overflow-wrap:anywhere;padding:12px}
.account-exception-table td:last-child{width:190px}.account-exception-binding-dialog .admin-flash{margin-bottom:14px}.account-map-candidates{display:grid;gap:8px}.account-map-candidate{display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:12px;text-align:left;padding:12px!important}.account-map-candidate small{color:#64748b;overflow-wrap:anywhere}.account-map-candidate strong{overflow-wrap:anywhere}
#finance-customer-account{font-size:14px;line-height:1.5}
#finance-customer-account h3{font-size:20px}
#finance-customer-account button{font-size:13px;padding:7px 12px}
#finance-customer-account dl{display:grid;grid-template-columns:minmax(120px,1fr) minmax(120px,2fr);max-width:640px;margin:16px 0}
#finance-customer-account dt,#finance-customer-account dd{padding:10px;margin:0;border-bottom:1px solid #e2e8f0}
#finance-customer-account dd{text-align:right;font-variant-numeric:tabular-nums;font-weight:600}
.b2b-receivable-amount-detail .receivable-tax-rate select{width:72px;min-width:72px;max-width:100%;padding:3px 6px;font-size:13px}
/* 月结、现金、次结汇总共用 21 寸桌面密度：每页 15 条铺满双栏。 */
@media(min-width:1000px){
  .b2b-summary-modal{width:min(1560px,calc(100vw - 64px));height:min(780px,calc(100dvh - 48px));padding:10px;gap:5px}
  .b2b-summary-modal>header{padding-bottom:7px;gap:10px}
  .b2b-summary-modal h3{font-size:18px;margin-bottom:2px}
  .b2b-summary-modal>header span{font-size:12px}
  .b2b-summary-view-switch{padding:2px;gap:3px}
  .b2b-summary-view-switch button{min-width:132px;min-height:25px;padding:2px 8px;font-size:11px}
  .b2b-summary-breadcrumb{min-height:27px;gap:8px;font-size:11px}
  .b2b-summary-breadcrumb button{min-height:25px;padding:2px 7px}
  .b2b-summary-modal>.admin-flash{padding:6px 9px;max-height:42px;font-size:10px;line-height:1.25}
  .b2b-summary-modal .b2b-summary-pages{gap:8px}
  .b2b-summary-modal .b2b-summary-pane{display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}
  .b2b-summary-modal .b2b-summary-pane-title{padding:4px 9px;font-size:11px}
  .b2b-summary-modal .b2b-debt-summary-table{font-size:13px;line-height:1.25}
  /* The pane title's rendered height varies with browser zoom and font metrics.
     Let grid allocate its real height, then fit the table into the exact remainder. */
  .b2b-summary-modal .b2b-summary-pane>.b2b-monthly-summary-table,
  .b2b-summary-modal .b2b-summary-pane>.b2b-customer-summary-table,
  .b2b-summary-modal .b2b-summary-pane>.b2b-month-customer-table{height:100%;min-height:0}
  .b2b-summary-modal .b2b-summary-pane>.b2b-handler-summary-table{height:100%;min-height:0}
  .b2b-summary-modal .b2b-debt-summary-table th,
  .b2b-summary-modal .b2b-debt-summary-table td{padding:4px 8px;height:35px;font-size:13px;line-height:1.2}
  .b2b-summary-modal .b2b-debt-summary-table th{font-size:13px}
  .b2b-summary-modal button{min-height:27px;padding:3px 8px;font-size:12px}
  .b2b-summary-modal .link-button{min-height:0;padding:0;font-size:13px;line-height:1.15}
  .b2b-summary-modal .b2b-summary-amount-link strong{font-size:14px}
  .b2b-summary-modal .finance-summary-customer{align-items:center;gap:7px;line-height:1.2}
  .b2b-summary-modal .finance-summary-customer>span{font-size:14px;font-weight:600}
  .b2b-summary-modal .finance-summary-customer .finance-account-entry{min-height:23px;padding:1px 5px;font-size:10px;line-height:1}
  .b2b-summary-modal .b2b-list-pagination{min-height:30px;margin:0;gap:10px;font-size:12px}
  .b2b-summary-modal .b2b-list-pagination button{min-height:25px}
}
@media(max-width:999px){.b2b-summary-modal{width:calc(100vw - 16px);height:calc(100dvh - 24px);padding:12px}.b2b-summary-modal h3{font-size:18px}.b2b-summary-modal .b2b-summary-pages{display:block}.b2b-summary-modal .b2b-summary-pane:nth-child(n+2){display:none}.b2b-summary-modal .b2b-summary-pane-title{display:none}.b2b-summary-modal .b2b-debt-summary-table{min-width:540px;font-size:13px}.b2b-summary-modal .b2b-debt-summary-table th,.b2b-summary-modal .b2b-debt-summary-table td{padding:9px;font-size:13px}.b2b-summary-modal .b2b-list-pagination{gap:6px;flex-wrap:wrap}.b2b-summary-view-switch{width:100%;box-sizing:border-box;overflow-x:auto}.b2b-summary-view-switch-with-filters{flex-wrap:wrap;overflow:visible}.b2b-summary-view-switch button{flex:1;min-width:120px}.b2b-summary-filter-bar{width:100%;align-items:stretch;justify-content:flex-start;flex-wrap:wrap;margin-left:0;padding:7px 0 0;border-left:0;border-top:1px solid #d5e2dc}.b2b-summary-filter-bar label{flex:1;min-width:140px}.b2b-summary-filter-bar select{width:100%;min-width:0}.b2b-summary-breadcrumb{align-items:flex-start;flex-direction:column;gap:4px}}

.finance-history-import{display:grid;gap:12px;margin-top:12px}.finance-history-upload{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px;border:1px solid #dce7e2;border-radius:10px;background:#f8fbfa}.finance-history-upload h4{margin:0 0 4px;font-size:17px}.finance-history-upload p{margin:0}.finance-history-stats{display:grid;grid-template-columns:repeat(5,minmax(110px,1fr));gap:8px}.finance-history-stats button,.finance-history-stats>div{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 11px;border:1px solid #dce7e2;border-radius:8px;background:#fff;color:#31443d}.finance-history-stats button.active{border-color:#159447;background:#eaf7ef;color:#086b31}.finance-history-sheet-note{display:flex;gap:6px;overflow:auto;padding-bottom:3px}.finance-history-sheet-note span{flex:0 0 auto;padding:4px 8px;border-radius:12px;background:#edf6f1;font-size:12px}.finance-history-sheet-note span.excluded{background:#fff1e6;color:#a94d00}.finance-history-table{max-height:58vh;overflow:auto}.finance-history-table table{min-width:980px}.finance-history-table td small{display:block;color:#77877f;margin-top:2px}.finance-history-table tr.history-review_required,.finance-history-table tr.history-content_changed,.finance-history-table tr.history-failed{background:#fff3f1}.finance-history-table tr.history-excluded,.finance-history-table tr.history-duplicate{background:#f4f5f5;color:#77827e}.finance-history-table .warning{color:#a96b00;font-weight:600}@media(max-width:900px){.finance-history-upload{align-items:flex-start;flex-direction:column}.finance-history-upload .table-actions{width:100%;flex-wrap:wrap}.finance-history-upload input{max-width:100%}.finance-history-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* W3 navigation stage 1: one registry-driven, permission-aware left rail. */
body{display:grid!important;grid-template-columns:268px minmax(0,1fr)!important;padding-top:0!important;min-height:100vh}
.w3-left-navigation{position:sticky!important;inset:auto!important;top:0!important;z-index:80;display:flex!important;flex-direction:column;gap:0;width:268px;min-height:100vh;height:100vh;padding:14px 12px 12px;overflow:hidden;border:0;border-right:1px solid #dce5e1;background:#fff;box-shadow:4px 0 18px rgba(20,45,36,.05)}
.w3-left-navigation .brand{flex:none;min-height:62px;margin:0 2px 12px;padding:6px 7px 14px;border:0;border-bottom:1px solid #e5ebe8}
.w3-left-navigation .brand-mark{width:42px;height:42px;border-radius:11px}.w3-left-navigation .brand-mark img{width:40px;height:40px}
.w3-left-navigation .brand strong{font-size:15px}.w3-left-navigation .brand span{display:block;font-size:11px}
.w3-left-navigation #nav{display:block;flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:0 2px 12px;scrollbar-width:thin}
.w3-left-navigation .nav-menu{display:block;margin:2px 0}
.w3-left-navigation .nav-btn{display:grid;grid-template-columns:34px minmax(0,1fr) 18px;gap:9px;width:100%;min-height:54px;padding:8px 9px;border:1px solid transparent;border-radius:9px;background:transparent;color:#35443f;text-align:left}
.w3-left-navigation .nav-btn:hover{background:#f4f8f6;filter:none}.w3-left-navigation .nav-btn.active{border-color:#cfe4da;background:#edf8f2;color:#075f35}
.w3-left-navigation .nav-btn.active::before{top:9px;bottom:9px;left:-2px;width:4px;background:#14954b}
.w3-left-navigation .nav-icon{width:34px;height:34px;border-radius:9px;background:#edf2ef;color:#52635c;font-size:13px}
.w3-left-navigation .nav-btn.active .nav-icon{background:#d9f0e2;color:#08753c}
.w3-left-navigation .nav-copy strong{font-size:14px}.w3-left-navigation .nav-copy small{font-size:10px;color:#7b8983}
.w3-left-navigation .nav-caret{color:#82918a;font-size:16px;text-align:center;transition:transform .16s ease}.w3-left-navigation .nav-menu.open .nav-caret{transform:rotate(180deg)}
.w3-left-navigation .nav-dropdown{position:static;width:auto;max-height:none;margin:2px 0 7px 43px;padding:2px 0 4px;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}
.w3-left-navigation .nav-dropdown[hidden]{display:none}
.nav-feature-section{display:grid;gap:2px;margin:0 0 8px}.nav-feature-section h3{margin:7px 9px 3px;color:#8a9691;font-size:10px;font-weight:800;letter-spacing:.06em}
.w3-left-navigation .nav-subitem{display:block;min-height:34px;padding:7px 10px;border-radius:7px;color:#4b5a54;font-size:13px;line-height:1.35}
.w3-left-navigation .nav-subitem:hover,.w3-left-navigation .nav-subitem:focus-visible{background:#f0f6f3;outline:none}.w3-left-navigation .nav-subitem.active{background:#e3f3e9;color:#076c38;font-weight:800}
.w3-left-navigation .nav-subitem small{display:block;margin-top:2px;color:#7b8983;font-size:10px;font-weight:400}.nav-empty{padding:8px;color:#8a9691;font-size:12px}
.w3-left-navigation .user-box{flex:none;margin:10px 0 0;padding:9px;border-color:#dfe7e3;background:#f7faf8}.w3-left-navigation .user-box span{font-weight:700;overflow:hidden;text-overflow:ellipsis}.w3-left-navigation .user-box button{flex:1 1 auto;min-height:30px}
.main{width:auto;max-width:none;min-width:0;padding:0 22px 28px!important}.workspace-tabs{margin-left:-22px!important;margin-right:-22px!important;padding-left:22px!important;padding-right:22px!important}
.nav-toggle{display:none;position:fixed;z-index:95;top:10px;left:10px;width:42px;height:42px;padding:0;border-radius:10px;box-shadow:0 4px 16px rgba(0,0,0,.15);font-size:20px}
@media(max-width:900px){
  body{display:block!important;padding-top:0!important}
  .w3-left-navigation{position:fixed!important;left:0!important;top:0!important;bottom:0!important;width:min(286px,86vw);transform:translateX(-105%);transition:transform .2s ease;box-shadow:12px 0 32px rgba(15,23,42,.2)}
  body.nav-mobile-open .w3-left-navigation{transform:translateX(0)}
  body.nav-mobile-open::after{position:fixed;z-index:70;inset:0;background:rgba(15,23,42,.34);content:""}
  .nav-toggle{display:grid;place-items:center}
  .main{padding:56px 12px 20px!important}
  .workspace-tabs{margin:-56px -12px 12px 44px!important;padding:7px 8px!important;min-height:52px}
}

.erp-friendly-status {
  gap: 10px;
  padding: 16px;
  border-color: #b8d9cf;
  background: #f8fffc;
}

.erp-friendly-status.processing,
.erp-friendly-status.action-needed {
  border-color: #f2c879;
  background: #fffaf0;
}

.erp-friendly-status.danger {
  border-color: #f0a6a6;
  background: #fff7f7;
}

.erp-friendly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.erp-friendly-head > div {
  display: grid;
  gap: 2px;
}

.erp-friendly-head > div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.erp-friendly-head strong {
  color: #153a31;
  font-size: 18px;
}

.erp-friendly-head b {
  color: #08765f;
  font-size: 22px;
}

.erp-friendly-status.processing .erp-friendly-head b,
.erp-friendly-status.action-needed .erp-friendly-head b {
  color: #b45f06;
}

.erp-friendly-status.danger .erp-friendly-head b {
  color: #b91c1c;
}

.erp-friendly-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfeae6;
}

.erp-friendly-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #15966f;
  transition: width 240ms ease;
}

.erp-friendly-status.processing .erp-friendly-progress span,
.erp-friendly-status.action-needed .erp-friendly-progress span {
  background: #e49a25;
}

.erp-friendly-status.danger .erp-friendly-progress span {
  background: #dc2626;
}

.erp-friendly-step {
  color: #49675f;
  font-size: 13px;
  font-weight: 800;
}

.erp-friendly-intervention {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 7px;
  color: #075f49;
  background: #e5f8f0;
}

.erp-friendly-intervention > span {
  font-size: 13px;
  font-weight: 800;
}

.erp-friendly-intervention > strong {
  font-size: 15px;
}

.erp-friendly-intervention.confirm {
  color: #854d0e;
  background: #fff1cf;
}

.erp-friendly-intervention.required {
  color: #991b1b;
  background: #feeaea;
}

.erp-friendly-message {
  margin: 0;
  color: #243d36;
  line-height: 1.55;
}

.erp-friendly-guidance {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 7px;
  color: #754006;
  background: #fff1cf;
}

.erp-friendly-status.success .erp-friendly-guidance {
  color: #075f49;
  background: #e5f8f0;
}

.erp-friendly-status.danger .erp-friendly-guidance {
  color: #991b1b;
  background: #feeaea;
}

.erp-friendly-guidance strong {
  flex: 0 0 auto;
  white-space: nowrap;
}

.erp-friendly-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.erp-friendly-stage {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid #dce5e2;
  border-radius: 7px;
  background: #fff;
}

.erp-friendly-stage > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  color: #687a74;
  background: #edf1ef;
  font-size: 12px;
  font-weight: 900;
}

.erp-friendly-stage > div {
  display: grid;
  min-width: 0;
}

.erp-friendly-stage strong,
.erp-friendly-stage small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-friendly-stage.done > span {
  color: #fff;
  background: #15966f;
}

.erp-friendly-stage.active > span {
  color: #fff;
  background: #e49a25;
}

.erp-friendly-stage.failed > span {
  color: #fff;
  background: #dc2626;
}

.erp-friendly-reconciliation {
  padding: 8px 10px;
  border-left: 3px solid #15966f;
  color: #31564c;
  background: #eef9f5;
  font-weight: 800;
}

.erp-friendly-reconciliation.danger {
  border-color: #dc2626;
  color: #991b1b;
  background: #fff0f0;
}

.erp-friendly-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: #506760;
  font-size: 13px;
}

.erp-friendly-technical {
  padding-top: 3px;
  color: var(--muted);
}

.erp-friendly-actions {
  margin-top: 2px;
}

.erp-friendly-technical summary {
  width: max-content;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.erp-friendly-technical[open] {
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 6px;
  background: #f2f5f4;
}

@media (max-width: 760px) {
  .erp-friendly-stages {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
  .erp-friendly-guidance {
    display: grid;
  }
}

/* W3 navigation stage 1 v3: registry-driven top bar matching the established W3 UI. */
body{display:block!important;min-height:100vh;padding-top:52px!important;background:#eef2f4}
.w3-registry-top-navigation{position:fixed!important;inset:0 0 auto!important;z-index:80;display:flex!important;align-items:stretch;width:100%;min-height:72px;height:72px;padding:0!important;overflow:visible!important;border:0!important;background:#1f9f45!important;color:#fff;box-shadow:0 2px 8px rgba(15,55,30,.22)}
.w3-registry-top-navigation .brand{display:flex;flex:0 0 auto;align-items:center;min-height:72px;margin:0;padding:8px 22px 8px 10px;border:0;border-right:1px solid rgba(255,255,255,.24);background:#209d45}
.w3-registry-top-navigation .brand-mark{width:48px;height:48px;border:0;border-radius:9px}.w3-registry-top-navigation .brand-mark img{width:48px;height:48px}
.w3-registry-top-navigation .brand strong{color:#fff;font-size:19px;font-weight:900;white-space:nowrap}.w3-registry-top-navigation .brand span{display:none}
.w3-registry-top-navigation #nav{display:flex;flex:1 1 auto;align-items:stretch;min-width:0;padding:0;overflow:visible}
.w3-registry-top-navigation .nav-menu{position:relative;display:flex;flex:0 0 auto;margin:0}
.w3-registry-top-navigation .nav-btn{display:flex;grid-template-columns:none;gap:0;align-items:center;justify-content:center;width:auto;min-width:96px;height:72px;min-height:72px;padding:0 17px;border:0;border-radius:0;background:transparent;color:#fff;text-align:center}
.w3-registry-top-navigation .nav-btn:hover{background:rgba(0,85,31,.2)}.w3-registry-top-navigation .nav-btn.active{border:0;background:#16823a;color:#fff}
.w3-registry-top-navigation .nav-btn.active::before{inset:auto 15px 0;width:auto;height:4px;border-radius:0;background:#fff}
.w3-registry-top-navigation .nav-icon,.w3-registry-top-navigation .nav-copy small,.w3-registry-top-navigation .nav-caret{display:none}
.w3-registry-top-navigation .nav-copy{display:block}.w3-registry-top-navigation .nav-copy strong{color:#fff;font-size:17px;font-weight:900;line-height:1;white-space:nowrap}
.w3-registry-top-navigation .nav-dropdown{position:absolute;top:72px;left:0;width:260px;max-height:calc(100vh - 92px);margin:0;padding:8px;overflow:auto;border:1px solid #d9e4df;border-top:0;border-radius:0 0 9px 9px;background:#fff;box-shadow:0 14px 32px rgba(20,45,36,.2)}
.w3-registry-top-navigation .nav-dropdown[hidden]{display:none}.w3-registry-top-navigation .nav-feature-section{gap:1px;margin-bottom:6px}.w3-registry-top-navigation .nav-feature-section h3{margin:7px 9px 4px;color:#85918c;font-size:10px}
.w3-registry-top-navigation .nav-subitem{min-height:38px;padding:8px 10px;border-radius:6px;color:#34463e;font-size:13px}.w3-registry-top-navigation .nav-subitem:hover,.w3-registry-top-navigation .nav-subitem:focus-visible{background:#edf7f1}.w3-registry-top-navigation .nav-subitem.active{background:#dcf1e4;color:#087238}
.w3-registry-top-navigation .user-box{display:flex;flex:0 0 auto;align-items:center;gap:5px;margin:0;padding:0 10px;border:0;border-radius:0;background:#1b913f;color:#fff}.w3-registry-top-navigation .user-box span{flex:0 1 auto;max-width:120px;color:#fff;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.w3-registry-top-navigation .user-box button{flex:0 0 auto;min-height:30px;padding:5px 8px;border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.12);color:#fff}
.main{width:100%;max-width:none;padding:0 24px 28px!important}.workspace-tabs{top:0!important;margin:0 -24px 16px!important;padding:0 24px!important;min-height:58px;border-bottom:1px solid #d8e0e4;background:#e9eef1}
.w3-registry-top-navigation + .main .group-tabs{display:none!important}
.nav-toggle{display:none!important}
@media(max-width:1500px){.w3-registry-top-navigation .nav-btn{min-width:80px;padding:0 11px}.w3-registry-top-navigation .nav-copy strong{font-size:15px}.w3-registry-top-navigation .brand{padding-right:14px}.w3-registry-top-navigation .brand strong{font-size:17px}.w3-registry-top-navigation .user-box span{display:none}}
@media(max-width:1120px){body{padding-top:92px!important}.sidebar.top-navigation.w3-registry-top-navigation{display:grid!important;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"brand user" "nav nav";height:92px!important;min-height:92px!important;align-content:start}.sidebar.top-navigation.w3-registry-top-navigation .brand{grid-area:brand;height:52px;min-height:52px}.sidebar.top-navigation.w3-registry-top-navigation .user-box{grid-area:user;height:52px;margin-left:auto}.sidebar.top-navigation.w3-registry-top-navigation #nav{grid-area:nav;order:3;width:100%;height:40px;overflow-x:auto;overflow-y:visible;background:#1f9f45}.sidebar.top-navigation.w3-registry-top-navigation .nav-btn{height:40px;min-height:40px}.sidebar.top-navigation.w3-registry-top-navigation .nav-dropdown{position:fixed;top:92px;left:8px;right:8px;width:auto}.main{padding:0 12px 20px!important}.workspace-tabs{margin:0 -12px 12px!important;padding:0 12px!important}}

/* Stage 1 v6: preserve the production W3 visual contract; only the registry groups change. */
body{display:block!important;min-height:100vh;padding-top:0!important;background:#eef1f4}
.sidebar.top-navigation.w3-registry-top-navigation{
  position:fixed!important;inset:0 0 auto!important;z-index:80;display:flex!important;align-items:center;
  width:100%;min-height:52px!important;height:52px!important;padding:0 14px!important;gap:10px!important;
  overflow:visible!important;border:0!important;border-bottom:1px solid #177f36!important;
  color:#fff;background:#249f45!important;box-shadow:0 1px 4px rgba(20,85,42,.22)
}
.sidebar.top-navigation.w3-registry-top-navigation .brand{
  display:flex;flex:0 0 auto;align-items:center;min-height:36px;height:36px;margin:0;
  padding:0 14px 0 0;border:0;border-right:1px solid rgba(255,255,255,.3);background:transparent
}
.sidebar.top-navigation.w3-registry-top-navigation .brand-mark{width:34px;height:34px;border-radius:6px;background:#fff}
.sidebar.top-navigation.w3-registry-top-navigation .brand-mark img{width:32px;height:32px;border-radius:6px}
.sidebar.top-navigation.w3-registry-top-navigation .brand strong{color:#fff;font-size:14px;font-weight:700;white-space:nowrap}
.sidebar.top-navigation.w3-registry-top-navigation #nav{display:flex;flex:1 1 auto;align-items:stretch;height:100%;min-width:0;padding:0;gap:0;overflow:visible}
.sidebar.top-navigation.w3-registry-top-navigation .nav-menu{position:relative;display:flex;flex:0 0 auto;align-items:stretch;height:100%;margin:0}
.sidebar.top-navigation.w3-registry-top-navigation .nav-btn{
  display:flex;align-items:center;justify-content:center;width:auto;min-width:0;height:100%;min-height:0;
  padding:0 13px;border:0;border-radius:0;color:#fff;background:transparent;font-size:14px;font-weight:600;text-align:center
}
.sidebar.top-navigation.w3-registry-top-navigation .nav-btn:hover,
.sidebar.top-navigation.w3-registry-top-navigation .nav-btn:focus-visible,
.sidebar.top-navigation.w3-registry-top-navigation .nav-btn.active{color:#fff;background:#177f36;filter:none}
.sidebar.top-navigation.w3-registry-top-navigation .nav-btn.active::before{inset:auto 10px 0;width:auto;height:3px;border-radius:0;background:#fff}
.sidebar.top-navigation.w3-registry-top-navigation .nav-icon,
.sidebar.top-navigation.w3-registry-top-navigation .nav-copy small,
.sidebar.top-navigation.w3-registry-top-navigation .nav-caret{display:none}
.sidebar.top-navigation.w3-registry-top-navigation .nav-copy strong{color:#fff;font-size:14px;font-weight:600;line-height:1;white-space:nowrap}
.sidebar.top-navigation.w3-registry-top-navigation .nav-dropdown{
  position:absolute;top:52px;left:0;width:176px;max-height:calc(100vh - 64px);margin:0;padding:4px 0;overflow:auto;
  border:1px solid #cfd7df;border-radius:2px;background:#fafafa;box-shadow:3px 3px 7px rgba(70,80,90,.28)
}
.sidebar.top-navigation.w3-registry-top-navigation .nav-dropdown[hidden]{display:none}
.sidebar.top-navigation.w3-registry-top-navigation .nav-feature-section{display:grid;gap:0;margin:0}
.sidebar.top-navigation.w3-registry-top-navigation .nav-feature-section h3{margin:6px 14px 2px;color:#7a8794;font-size:10px;font-weight:600;letter-spacing:.04em}
.sidebar.top-navigation.w3-registry-top-navigation .nav-subitem{
  display:block;min-height:34px;padding:8px 14px;border-radius:0;color:#273444;background:#fafafa;font-size:13px;font-weight:500
}
.sidebar.top-navigation.w3-registry-top-navigation .nav-subitem:hover,
.sidebar.top-navigation.w3-registry-top-navigation .nav-subitem:focus-visible{color:#fff;background:#249f45;outline:0}
.sidebar.top-navigation.w3-registry-top-navigation .nav-subitem.active{color:#fff;background:#177f36}
.sidebar.top-navigation.w3-registry-top-navigation .nav-subitem small{display:none}
.sidebar.top-navigation.w3-registry-top-navigation .user-box{display:flex;flex:0 0 auto;align-items:center;height:100%;gap:5px;margin:0;padding:0;border:0;background:transparent;color:#fff}
.sidebar.top-navigation.w3-registry-top-navigation .user-box span{flex:0 0 auto;max-width:120px;color:#fff;font-size:12px}
.sidebar.top-navigation.w3-registry-top-navigation .user-box button{flex:0 0 auto;min-height:26px;padding:3px 8px;border:1px solid rgba(255,255,255,.28);border-radius:2px;color:#fff;background:rgba(255,255,255,.12);font-size:12px}
.sidebar.top-navigation.w3-registry-top-navigation + .main{width:100%;max-width:none;margin:0;padding:52px 0 0!important;background:#eef1f4}
.sidebar.top-navigation.w3-registry-top-navigation + .main .workspace-tabs{top:52px!important;min-height:38px;margin:0!important;padding:0 14px!important;border-bottom:1px solid #d8e0e5;background:#eef2f4}
.sidebar.top-navigation.w3-registry-top-navigation + .main .group-tabs{display:none!important}
.nav-toggle{display:none!important}
@media(max-width:1120px){
  .sidebar.top-navigation.w3-registry-top-navigation{display:flex!important;flex-wrap:wrap;align-content:flex-start;height:88px!important;min-height:88px!important;padding-top:4px!important}
  .sidebar.top-navigation.w3-registry-top-navigation #nav{order:3;flex-basis:100%;height:36px;overflow-x:auto;overflow-y:hidden}
  .sidebar.top-navigation.w3-registry-top-navigation .nav-btn{height:36px;min-height:36px}
  .sidebar.top-navigation.w3-registry-top-navigation .nav-dropdown{position:fixed;top:88px;left:8px;right:8px;width:auto}
  .sidebar.top-navigation.w3-registry-top-navigation + .main{padding-top:88px!important}
  .sidebar.top-navigation.w3-registry-top-navigation + .main .workspace-tabs{top:88px!important}
}

.product-mapping-page{display:grid;gap:12px}.product-mapping-toolbar{align-items:end}.product-mapping-toolbar>label{display:grid;gap:5px;min-width:240px}.product-mapping-filters{display:grid;grid-template-columns:minmax(150px,.7fr) repeat(3,minmax(170px,1fr)) auto auto;gap:8px;align-items:center}.mapping-scope-note{margin:0;padding:9px 12px;border-radius:7px;background:#eef8f3;color:#32654e}.mapping-import-card{border:1px solid #d7e5de;border-radius:8px;background:#fff}.mapping-import-card>header,.mapping-bind-panel>header{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;padding:12px 14px}.mapping-import-card h3,.mapping-bind-panel h3{margin:0 0 3px}.mapping-import-card p,.mapping-bind-panel p{margin:0;color:var(--muted)}.mapping-import-body{border-top:1px solid #e3ebe7}.mapping-import-stats{display:grid;grid-template-columns:repeat(8,minmax(90px,1fr));gap:7px;padding:0 16px 12px}.mapping-import-stats>div{padding:8px 9px;border:1px solid #dce7e2;border-radius:7px;background:#fbfdfc}.mapping-import-stats span{display:block;color:var(--muted);font-size:12px}.mapping-import-stats strong{color:var(--accent);font-size:19px}.product-mapping-table-wrap{overflow:auto}.product-mapping-table{min-width:1050px}.product-mapping-table td strong,.product-mapping-table td small{display:block}.mapping-status-conflict,.mapping-status-need_review{background:#fff6f2}.mapping-status-disabled{color:var(--muted);background:#f6f7f7}.mapping-bind-panel{border:1px solid #83c7a6;border-radius:8px;background:#fbfffd}.mapping-change-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;padding:0 14px 12px}.mapping-change-summary>div{display:grid;gap:3px;padding:10px;border:1px solid #dbe8e1;border-radius:7px;background:#fff}.mapping-change-summary span,.mapping-change-summary small{color:var(--muted)}.mapping-bind-search{display:flex;gap:8px;padding:0 14px 10px}.mapping-bind-search input{flex:1}.mapping-product-candidates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;max-height:240px;overflow:auto;padding:0 14px 10px}.mapping-product-candidates>label{display:flex;gap:9px;align-items:flex-start;padding:9px;border:1px solid #dce6e1;border-radius:7px;background:#fff;cursor:pointer}.mapping-product-candidates>label.selected{border-color:var(--accent);background:#eef8f3}.mapping-product-candidates label span,.mapping-product-candidates label small{display:block}.mapping-product-candidates label small{margin-top:3px;color:var(--muted)}.mapping-bind-reason{display:grid;gap:5px;padding:0 14px 10px}.mapping-bind-panel>footer{display:flex;justify-content:flex-end;padding:0 14px 14px}@media(max-width:1100px){.product-mapping-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.mapping-import-stats{grid-template-columns:repeat(4,1fr)}}@media(max-width:700px){.product-mapping-filters,.mapping-change-summary,.mapping-product-candidates{grid-template-columns:1fr}.product-mapping-toolbar>label{min-width:0;width:100%}.mapping-bind-search{flex-direction:column}.mapping-import-stats{grid-template-columns:repeat(2,1fr)}}

/* W3 sales performance v9: compact filters and clearer report hierarchy. */
.w3-sales-performance{border:0;background:transparent;box-shadow:none}.w3-sales-performance .panel-body{overflow:visible}.w3-performance-header{align-items:center!important;padding:12px 18px!important;background:#fff!important;border:1px solid #dbe4e0!important;border-radius:8px 8px 0 0}.w3-performance-header h2{margin:0 0 2px;font-size:21px}.w3-performance-header p{margin:0;color:#65756f;font-size:12px}.w3-performance-range{display:grid;grid-template-columns:auto auto;gap:1px 9px;align-items:baseline;text-align:right}.w3-performance-range span,.w3-performance-range small{color:#70817a;font-size:11px}.w3-performance-range small{grid-column:1/-1}.w3-performance-range strong{font-size:13px}.w3-performance-filterbar{display:grid;grid-template-columns:100px repeat(3,minmax(130px,1fr)) 120px auto;gap:8px;align-items:end;padding:9px 12px;border:1px solid #dbe4e0;border-top:0;background:#f6f9f7}.w3-performance-filterbar:has(.custom-date:not([hidden])){grid-template-columns:100px 142px 142px repeat(3,minmax(115px,1fr)) 115px auto}.w3-performance-filterbar label{display:grid;gap:3px;min-width:0;color:#5c6d66;font-size:11px;font-weight:700}.w3-performance-filterbar .custom-date[hidden]{display:none}.w3-performance-filterbar input,.w3-performance-filterbar select{box-sizing:border-box;width:100%;height:32px;min-width:0;padding:4px 8px;border:1px solid #cbd6d1;border-radius:5px;background:#fff;color:#1d2c26;font-size:13px}.w3-performance-filterbar input:focus,.w3-performance-filterbar select:focus{border-color:#159447;box-shadow:0 0 0 2px rgba(21,148,71,.12);outline:0}.w3-performance-search{height:32px;min-height:32px;padding:4px 18px;border-color:#168b43;background:#168b43;color:#fff;font-weight:800}.w3-performance-search:hover{background:#0f7537}.w3-performance-content{display:grid;gap:10px;padding:10px 0}.w3-performance-state{display:grid;place-items:center;min-height:150px;border:1px solid #dbe4e0;border-radius:8px;background:#fff;color:#64756e}.w3-performance-state.error{color:#ad2525;background:#fff8f8}.w3-performance-metrics{display:grid;grid-template-columns:repeat(6,minmax(110px,1fr));overflow:hidden;border:1px solid #dbe4e0;border-radius:8px;background:#fff}.w3-performance-metrics article{min-width:0;padding:9px 12px;border-left:1px solid #e3e9e6;border-top:3px solid #9eaaa5}.w3-performance-metrics article:first-child{border-left:0}.w3-performance-metrics article.primary{border-top-color:#159447;background:#f3fbf6}.w3-performance-metrics article.orders{border-top-color:#4688c8}.w3-performance-metrics article.warning{border-top-color:#d18a20;background:#fffaf1}.w3-performance-metrics span{display:block;color:#697a73;font-size:11px}.w3-performance-metrics strong{display:block;margin-top:3px;overflow:hidden;color:#18392d;font-size:18px;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}.w3-performance-section{overflow:hidden;border:1px solid #dbe4e0;border-radius:8px;background:#fff}.w3-performance-section-title{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 12px;border-bottom:1px solid #e1e8e5}.w3-performance-section-title h3,.w3-performance-section-title p{margin:0}.w3-performance-section-title h3{font-size:15px}.w3-performance-section-title p,.w3-performance-section-title>span{margin-top:2px;color:#708079;font-size:11px}.w3-performance-section-title button{min-height:28px;padding:3px 9px}.w3-performance-table{max-height:calc(100dvh - 385px);overflow:auto}.w3-performance-table table{width:100%;min-width:850px;border-collapse:separate;border-spacing:0}.w3-performance-table th{position:sticky;top:0;z-index:2;padding:7px 10px;background:#f5f8f6;color:#53655e;font-size:11px;text-align:left;white-space:nowrap}.w3-performance-table td{padding:8px 10px;border-top:1px solid #e7ece9;color:#293a34;font-size:13px}.w3-performance-table tbody tr[data-w3-performance-employee]{cursor:pointer}.w3-performance-table tbody tr[data-w3-performance-employee]:hover,.w3-performance-table tbody tr[data-w3-performance-employee]:focus{background:#edf8f1;outline:0}.w3-performance-table .money{font-variant-numeric:tabular-nums;font-weight:700}.w3-performance-person{min-height:28px;padding:3px 9px;border:1px solid #a8d5b8;border-radius:5px;background:#f2fbf5;color:#087336;font-weight:800}.w3-performance-delivery{display:inline-flex;padding:3px 7px;border-radius:999px;background:#edf5f1;color:#35604e;font-size:11px}.w3-performance-empty{height:120px;text-align:center;color:#718079!important}.w3-performance-orders .w3-performance-table{max-height:360px}
@media(max-width:1280px){.w3-performance-filterbar,.w3-performance-filterbar:has(.custom-date:not([hidden])){grid-template-columns:repeat(4,minmax(120px,1fr))}.w3-performance-search{width:100%}.w3-performance-metrics{grid-template-columns:repeat(3,1fr)}.w3-performance-metrics article:nth-child(4){border-left:0}}
@media(max-width:720px){.w3-performance-header{align-items:flex-start!important}.w3-performance-range{text-align:left}.w3-performance-filterbar,.w3-performance-filterbar:has(.custom-date:not([hidden])){grid-template-columns:repeat(2,minmax(0,1fr))}.w3-performance-filterbar label:not(.custom-date){grid-column:auto}.w3-performance-filterbar .scope,.w3-performance-filterbar .delivery,.w3-performance-search{grid-column:auto}.w3-performance-metrics{grid-template-columns:repeat(2,1fr)}.w3-performance-metrics article:nth-child(odd){border-left:0}.w3-performance-section-title{align-items:flex-start}.w3-performance-table{max-height:calc(100dvh - 430px)}}
:root .dispatch-date-top{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px;position:relative;overflow:visible;z-index:40}
.vehicle-attendance-panel{position:relative;overflow:visible;z-index:40}
.dispatch-date-top details,.vehicle-attendance-panel details{position:relative}
.dispatch-date-top details[open] .dispatch-calendar,.vehicle-attendance-panel details[open] .dispatch-calendar{top:100%;left:0;box-sizing:border-box;max-width:calc(100vw - 32px)}
@media(max-width:600px){.dispatch-date-top details,.vehicle-attendance-panel details{position:static}.dispatch-date-top details[open] .dispatch-calendar,.vehicle-attendance-panel details[open] .dispatch-calendar{left:8px}}
.dispatch-date-top details[open] .dispatch-calendar,.vehicle-attendance-panel details[open] .dispatch-calendar{position:absolute;z-index:30;background:white;width:300px;padding:8px;border:1px solid #cddbd2;box-shadow:0 4px 15px #0002}
.vehicle-attendance-panel{padding:10px}.vehicle-attendance-panel .daily-driver-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(310px,1fr));gap:6px}
.dispatch-date-top .dispatch-search-toggle{width:36px;min-width:36px;padding:4px;font-size:18px;line-height:1}
.dispatch-date-top .dispatch-inline-search{display:none;position:absolute;top:calc(100% + 4px);left:8px;z-index:35;min-width:min(440px,calc(100vw - 32px));padding:8px;border:1px solid #cddbd2;border-radius:7px;background:#fff;box-shadow:0 6px 18px #0002}
.dispatch-date-top .dispatch-inline-search.open{display:block}
.dispatch-date-top .dispatch-inline-search .search-wrap{display:flex;gap:6px}
.dispatch-date-top .dispatch-inline-search input{min-width:0;flex:1}
.vehicle-attendance-panel .daily-driver-card{display:grid;grid-template-columns:80px minmax(100px,1fr) auto;gap:6px;align-items:center}
.vehicle-attendance-actions{display:flex;gap:4px}.vehicle-attendance-actions button{padding:3px 6px;min-height:28px}

/* Compact partner editor: disclosure is presentation only; inputs stay in the form. */
#editor.partner-editor-dialog .partner-editor-common .partner-field{grid-column:span 2}
#editor.partner-editor-dialog .partner-editor-common .partner-field-formalName,
#editor.partner-editor-dialog .partner-editor-common .partner-field-address,
#editor.partner-editor-dialog .partner-editor-common .partner-field-note{grid-column:span 4}
#editor.partner-editor-dialog .partner-editor-common label{gap:3px;align-content:start}
#editor.partner-editor-dialog .partner-editor-common input,
#editor.partner-editor-dialog .partner-editor-common select{height:34px;min-height:34px}
#editor.partner-editor-dialog .partner-editor-common textarea{height:48px;min-height:48px}
#editor.partner-editor-dialog .partner-editor-fold{border:1px solid #dbe2e8;border-radius:6px;margin:6px 0;background:#fff}
#editor.partner-editor-dialog .partner-editor-fold>summary{padding:10px 12px;cursor:pointer;color:#315348;font-weight:600}
#editor.partner-editor-dialog .partner-editor-fold>summary span{float:right;font-size:12px;color:#7c8a84;font-weight:400}
#editor.partner-editor-dialog .partner-editor-fold[open]>summary{border-bottom:1px solid #e7eeea;background:#f4f8f6}
#editor.partner-editor-dialog .partner-editor-fold-body{padding:12px}
#editor.partner-editor-dialog .partner-address-help{grid-column:1/-1;margin:0 0 10px;padding:8px 10px;border-radius:6px;background:#fff8df;color:#624b11}
#editor.partner-editor-dialog .partner-address-preview{margin-top:10px;padding:8px 10px;border-radius:6px;background:#edf6f1;color:#315348;overflow-wrap:anywhere}
#editor.partner-editor-dialog .partner-address-preview.is-error{background:#fff0ef;color:#b42318}
#editor.partner-editor-dialog [data-partner-alias-tools]:empty{display:none}
#editor.partner-editor-dialog [data-partner-alias-tools]{margin-bottom:10px}
@media(max-width:700px){
 #editor.partner-editor-dialog .partner-editor-common .partner-field{grid-column:1/-1}
 #editor.partner-editor-dialog .partner-editor-fold>summary span{display:none}
}
.purchase-batch-editor { grid-column: 1 / -1 !important; width: 100%; }
.purchase-page-flat { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.purchase-page-heading { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.purchase-page-flat #purchase-results { max-height:none; overflow:visible; padding:0; }
.purchase-page-flat #purchase-results > .table-wrap { max-height:none; overflow-y:visible; }
.inventory-page-flat,
.sales-page-flat,
.settlements-page-flat { border:0; border-radius:0; box-shadow:none; background:transparent; overflow:visible; }
.inventory-page-flat #inventory-results,
.sales-page-flat > .panel-body { min-height:0; max-height:none; padding:0; overflow-x:auto !important; overflow-y:visible !important; scrollbar-gutter:auto; }
.inventory-page-flat #inventory-results > .table-wrap,
.sales-page-flat > .panel-body > .table-wrap { min-height:0; max-height:none; overflow-y:visible; }

/* 保税仓业务单统一采用库存页的全宽扁平列表。每页只有一个表头，
   字段与操作仍由各模块原有列配置决定。 */
.bonded-order-list-page {
  width: 100%;
  margin: 0;
  overflow: visible;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.bonded-order-list-page > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 7px 12px;
  border-bottom: 1px solid #cbd8d3;
  background: #fff;
}
.bonded-order-list-page > header h3 { margin: 0; }
.bonded-order-list-body {
  width: 100%;
  min-height: 0;
  max-height: none !important;
  padding: 0 !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  scrollbar-gutter: auto;
}
.bonded-order-list-body > .table-summary { margin: 0; padding: 8px 12px; }
.bonded-order-list-body > .table-wrap {
  min-height: 0;
  max-height: none !important;
  overflow: visible !important;
}
.bonded-order-list-page table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  background: transparent;
}
.bonded-order-list-page thead th {
  position: sticky;
  z-index: 8;
  top: 0;
  padding: 9px 10px;
  border-bottom: 1px solid #cbd8d3;
  background: #f5f8f7;
  color: #39534a;
  white-space: nowrap;
}
.bonded-order-list-page tbody tr {
  border-bottom: 1px solid #d5e0dc;
  background: #edf4f7;
}
.bonded-order-list-page tbody tr:nth-child(even) { background: #f5f9fa; }
.bonded-order-list-page tbody td { padding: 9px 10px; }
.bonded-order-list-page > .bonded-order-pagination { margin: 10px 12px 12px; }
.bonded-order-footer {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border-top: 1px solid #cbd8d3;
  background: #fff;
}
.bonded-order-footer > .bonded-order-pagination {
  margin: 0;
}
.purchase-missing-erp { display:inline-block; padding:5px 8px; border:1px solid #f0b452; border-radius:4px; background:#fff2cf; color:#924300; font-weight:700; }
.purchase-correction-dialog { width:min(720px,94vw); max-height:92dvh; padding:0; border:1px solid #c9d8d2; border-radius:10px; }
.purchase-correction-dialog form { display:flex; flex-direction:column; max-height:90dvh; }
.purchase-correction-dialog header,.purchase-correction-dialog footer { flex:none; padding:12px 16px; background:#f7faf8; }
.purchase-correction-dialog header h3 { margin:0 0 8px; }
.purchase-correction-dialog header { display:block; }
.purchase-correction-dialog header p { margin:0; font-size:13px; }
.purchase-correction-body { overflow:auto; min-height:0; padding:12px 16px; }
.purchase-correction-body dl { display:grid; grid-template-columns:130px 1fr; gap:8px; margin:0 0 14px; }
.purchase-correction-body dd { margin:0; overflow-wrap:anywhere; }
.purchase-correction-inputs { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.purchase-correction-dialog label { display:grid; gap:5px; margin-bottom:9px; }
.purchase-correction-allocation { grid-template-columns:1fr 130px; align-items:center; }
.purchase-correction-dialog footer { display:flex; justify-content:flex-end; gap:8px; }
.purchase-correction-dialog [data-correction-error] { color:#b91c1c; }
@media(max-width:500px){.purchase-correction-inputs{grid-template-columns:1fr}.purchase-correction-body dl{grid-template-columns:1fr}.purchase-correction-dialog footer{flex-wrap:wrap}}
.purchase-document-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 6px 0; overflow-wrap: anywhere; }
.purchase-document-row button { padding: 4px 9px; font-size: 12px; }
.purchase-batch-section { border: 1px solid #d5e4df; border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.purchase-batch-section h3 { margin: 0 0 12px; }
.purchase-batch-grid, .purchase-weight-entry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#editor #fields .purchase-batch-grid > label { grid-column: var(--purchase-field-span, auto) !important; grid-row: auto !important; min-width: 0; }
.purchase-batch-grid > .full { grid-column: 1 / -1; }
.purchase-batch-preview { background: #edf7f2; padding: 12px; border-radius: 6px; line-height: 1.8; }
.purchase-batch-section pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.purchase-outbound-scroll { max-width:100%; overflow-x:auto; margin-top:8px; }
.purchase-outbound-scroll table { width:100%; min-width:640px; border-collapse:collapse; }
.purchase-outbound-scroll th,.purchase-outbound-scroll td { border:1px solid #d5e4df; padding:7px 9px; text-align:left; vertical-align:top; }
.purchase-outbound-scroll th { background:#eef6f2; }
.purchase-weight-entry { padding: 10px 0; border-bottom: 1px solid #d5e4df; }
@media (max-width: 640px) { .purchase-batch-grid, .purchase-weight-entry { grid-template-columns: 1fr; } }

/* Purchase v2 only: compact full-width batch editor, without changing other dialogs. */
/* Quick master form: do not stretch grid rows to fill the dialog height. */
#inbound-quick-master-dialog[open] { width: min(920px, calc(100vw - 28px)); height: fit-content; max-height: calc(100dvh - 28px); }
#inbound-quick-master-dialog > form { display:flex; flex-direction:column; height:auto; max-height:calc(100dvh - 32px); }
#inbound-quick-master-dialog .fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-content:start; align-items:start; gap:12px 16px; padding:16px; flex:0 1 auto; }
#inbound-quick-master-dialog .fields label { display:flex; flex-direction:column; gap:6px; min-width:0; font-size:14px; }
#inbound-quick-master-dialog .fields input, #inbound-quick-master-dialog .fields select { width:100%; height:38px!important; min-height:38px!important; max-height:38px; padding:7px 10px; box-sizing:border-box; }
#inbound-quick-master-dialog .fields textarea { width:100%; height:72px!important; min-height:72px!important; box-sizing:border-box; }
#inbound-quick-master-dialog .quick-master-address { grid-column:span 2; }
#inbound-quick-master-dialog header, #inbound-quick-master-dialog footer { padding:12px 16px; }
.partner-editor-dialog [data-partner-section][hidden] { display:none!important; }
@media(max-width:650px){#inbound-quick-master-dialog .fields{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:420px){#inbound-quick-master-dialog .fields{grid-template-columns:minmax(0,1fr);}#inbound-quick-master-dialog .quick-master-address{grid-column:auto;}}
#editor.purchase-legacy-dialog { width:min(94vw,1120px)!important; max-width:94vw!important; max-height:94dvh!important; }
#editor.purchase-legacy-dialog #editor-form { display:flex; flex-direction:column; max-height:calc(94dvh - 4px); min-width:0; overflow:hidden; }
#editor.purchase-legacy-dialog #editor-form > header,
#editor.purchase-legacy-dialog #editor-form > footer { flex:0 0 auto; padding:10px 14px; }
#editor.purchase-legacy-dialog #fields { display:grid!important; grid-template-columns:repeat(4,minmax(0,1fr))!important; gap:10px 12px; min-height:0; min-width:0; overflow:auto; padding:12px 14px; }
#editor.purchase-legacy-dialog #fields > label { grid-column:auto!important; grid-row:auto!important; min-width:0; width:auto; font-size:13px; }
#editor.purchase-legacy-dialog #fields > .inbound-wide-name { grid-column:span 2!important; }
#editor.purchase-legacy-dialog #fields > .full { grid-column:1 / -1!important; }
#editor.purchase-legacy-dialog #fields input,
#editor.purchase-legacy-dialog #fields select,
#editor.purchase-legacy-dialog #fields textarea { width:100%; min-width:0; max-width:100%; box-sizing:border-box; font-size:14px; }
#editor.purchase-legacy-dialog #fields input,
#editor.purchase-legacy-dialog #fields select { height:36px; min-height:36px; padding:6px 8px; }
#editor.purchase-legacy-dialog .ref-search-quick-add { min-width:0; }
@media(max-width:760px) { #editor.purchase-legacy-dialog #fields { grid-template-columns:repeat(2,minmax(0,1fr))!important; } }
@media(max-width:480px) { #editor.purchase-legacy-dialog #fields { grid-template-columns:minmax(0,1fr)!important; } #editor.purchase-legacy-dialog #fields > label { grid-column:1 / -1!important; } }
#editor.purchase-v2-dialog { width: min(94vw, 1120px) !important; max-width: 94vw !important; max-height: 94vh !important; }
#editor.purchase-v2-dialog #editor-form { display: flex; flex-direction: column; height: min(900px, calc(94dvh - 4px)) !important; max-height: calc(94dvh - 4px) !important; min-height: 0; overflow: hidden; }
#editor.purchase-v2-dialog #editor-form > header, #editor.purchase-v2-dialog #editor-form > footer { flex: 0 0 auto; padding: 10px 14px; }
#editor.purchase-v2-dialog #fields { display: block !important; padding: 0 !important; }
#editor.purchase-v2-dialog .purchase-batch-section { padding: 10px 12px; margin-bottom: 9px; }
#editor.purchase-v2-dialog .purchase-batch-section h3 { margin: 0 0 8px; font-size: 15px; }
#editor.purchase-v2-dialog .purchase-batch-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px; align-items:start; }
#editor.purchase-v2-dialog [data-purchase-field="supplierId"],
#editor.purchase-v2-dialog [data-purchase-field="warehouseId"],
#editor.purchase-v2-dialog [data-purchase-field="warehouseProductName"],
#editor.purchase-v2-dialog [data-purchase-field="productId"] { --purchase-field-span:span 2; }
#editor.purchase-v2-dialog .purchase-batch-grid > label:not([data-purchase-field="supplierId"]):not([data-purchase-field="warehouseId"]):not([data-purchase-field="warehouseProductName"]):not([data-purchase-field="productId"]) { width:100%; max-width:180px; }
#editor.purchase-v2-dialog .purchase-batch-editor label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
#editor.purchase-v2-dialog .purchase-batch-editor input,
#editor.purchase-v2-dialog .purchase-batch-editor select { min-height: 34px !important; height: 34px !important; padding: 5px 8px !important; font-size: 14px !important; width: 100%; box-sizing: border-box; }
#editor.purchase-v2-dialog .purchase-batch-editor textarea { min-height: 58px; padding: 6px 8px; font-size: 14px; }
#editor.purchase-v2-dialog .purchase-batch-editor [hidden] { display: none !important; }
#editor.purchase-v2-dialog .purchase-batch-preview { padding: 7px 10px; font-size: 13px; line-height: 1.55; }
#editor.purchase-v2-dialog .purchase-batch-editor p { margin: 6px 0; font-size: 13px; }
#editor.purchase-v2-dialog .purchase-lot-allocation { display: grid; grid-template-columns: minmax(130px, 180px) minmax(100px, 140px) auto; gap: 10px; align-items: end; justify-content:start; margin-bottom: 7px; }
#editor.purchase-v2-dialog [data-purchase-lot-allocations] { max-width: 900px; }
#editor.purchase-v2-dialog [data-purchase-allocation-summary] { display: inline-block; margin-left: 14px; font-size: 13px; color: #12663d; }
#editor.purchase-v2-dialog .allocation-invalid { color: #b45309; }
#editor.purchase-v2-dialog .purchase-weight-entry { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; }
@media (max-width: 1050px) {
  #editor.purchase-v2-dialog .purchase-batch-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #editor.purchase-v2-dialog .purchase-weight-entry { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  #editor.purchase-v2-dialog .purchase-batch-grid, #editor.purchase-v2-dialog .purchase-weight-entry { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 480px) {
  #editor.purchase-v2-dialog .purchase-batch-grid, #editor.purchase-v2-dialog .purchase-weight-entry { grid-template-columns: minmax(0,1fr); }
  #editor.purchase-v2-dialog .purchase-batch-grid > label { --purchase-field-span:auto; max-width:100%!important; }
  #editor.purchase-v2-dialog .purchase-lot-allocation { grid-template-columns: minmax(0,1fr) 88px; gap: 7px; }
  #editor.purchase-v2-dialog [data-purchase-allocation-summary] { margin: 7px 0; }
}

/* Inventory 2026-10-13: compact product cards; detail headers belong to expanded products only. */
.inventory-page-flat > header,
.inventory-page-flat .inventory-table thead th {
  position: static !important;
  top: auto !important;
}
.inventory-page-flat #inventory-results {
  overflow: visible !important;
}
.inventory-products-list {
  display: block;
  width: 100%;
  min-width: 0;
  background: transparent;
}
.inventory-products-header,
.inventory-product-card .inventory-product-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) minmax(72px, .48fr) minmax(105px, .65fr) minmax(118px, .7fr) minmax(112px, .68fr) minmax(125px, .75fr) minmax(120px, .72fr) minmax(135px, .82fr) minmax(95px, .58fr) 92px;
  gap: 0;
  align-items: center;
  min-width: 1450px;
}
.inventory-products-header {
  position: sticky !important;
  z-index: 8;
  top: 0 !important;
  padding: 0;
  border-bottom: 1px solid #cbd8d3;
  background: #f5f8f7;
  color: #39534a;
  font-weight: 700;
  white-space: nowrap;
}
.inventory-products-header > span {
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid #d5e0dc;
}
.panel.inventory-page-flat {
  overflow: visible !important;
}
/* The inventory module scrolls at the document root. Keeping BODY as a second
   scroll container prevents position:sticky from following the visible root. */
html:has(.inventory-page-flat) {
  overflow-y: auto !important;
}
body:has(.inventory-page-flat) {
  overflow-y: visible !important;
}
.inventory-products-body {
  min-width: 1450px;
}
.inventory-product-card {
  min-width: 0;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid #d5e0dc;
  border-radius: 0;
  background: #edf4f7;
}
.inventory-product-card .inventory-product-summary {
  padding: 0;
  background: inherit;
  min-height: 46px;
}
.inventory-product-card:nth-child(even) { background: #f5f9fa; }
.inventory-product-card .inventory-product-summary > * {
  align-self: stretch;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border-right: 1px solid #d5e0dc;
}
.inventory-product-card .inventory-product-toggle {
  grid-column: auto;
  grid-row: auto;
  align-self: center;
  justify-self: center;
  min-width: 78px;
  width: auto;
  margin: 5px 7px;
  padding: 6px 10px;
  white-space: nowrap;
}
.inventory-product-card .inventory-product-identity,
.inventory-product-card .inventory-summary-metric {
  min-width: 0;
}
.inventory-product-card .inventory-product-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}
.inventory-product-card .inventory-summary-metric b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}
.inventory-product-card .inventory-lot-table-wrap {
  width: 100%;
  overflow: visible;
  border-top: 1px solid #d5e0dc;
  background: #fff;
}
.inventory-product-card .inventory-table {
  width: 100% !important;
  min-width: 100%;
}
.inventory-product-card .inventory-lot-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px 16px;
  gap: 10px 20px;
}
.inventory-product-card .inventory-lot-row td {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  white-space: normal;
}
.inventory-product-card .inventory-lot-value { min-width: 0; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.inventory-product-card .inventory-lot-row td::before {
  content: attr(data-label) "：";
  color: #6d7d77;
  font-size: 12px;
  white-space: nowrap;
}
@media (max-width: 1400px) {
  .inventory-products-list { overflow-x: auto; }
}
@media (max-width: 900px) {
  .inventory-product-card .inventory-lot-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Independent bonded reservation workspace; no global table/dialog overrides. */
.br-page {padding:8px 4px;width:100%;box-sizing:border-box;}
.br-page .toolbar {display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.br-page [data-br-search] {display:flex;gap:8px;flex:1;max-width:740px;}
.br-page [data-br-search] input {flex:1;min-width:180px;}
.br-list-heading {display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px;padding:7px 12px;background:#fff;border-bottom:1px solid #cbd8d3;}
.br-list-heading h3 {margin:0;font-size:16px;}
.br-list-summary {margin:0;padding:8px 12px;background:#fff;color:#5a6b64;font-size:12px;}
.br-list-summary strong {padding:4px 8px;border-radius:5px;background:#e9f4ef;color:#245c44;}
.br-list-shell {min-height:0;max-height:none;overflow-x:auto;overflow-y:visible;background:transparent;border:0;border-radius:0;}
.br-list-table {width:100%;min-width:1260px;border-collapse:collapse;background:transparent;}
.br-list-table thead th {position:sticky;top:0;z-index:3;padding:9px 10px;text-align:left;background:#f5f8f7;border-bottom:1px solid #cbd8d3;color:#39534a;white-space:nowrap;}
.br-list-table tbody tr {border-bottom:1px solid #d5e0dc;background:#edf4f7;}
.br-list-table tbody tr:nth-child(even) {background:#f5f9fa;}
.br-list-table tbody td {padding:9px 10px;border-bottom:1px solid #d5e0dc;vertical-align:middle;background:transparent;}
.br-list-table tbody tr:hover td {background:#e2f0ed;}
.br-list-table th:nth-child(1){width:110px}.br-list-table th:nth-child(2){width:125px}.br-list-table th:nth-child(3){width:130px}.br-list-table th:nth-child(4){width:140px}.br-list-table th:nth-child(5){width:240px}.br-list-table th:nth-child(6){width:110px}.br-list-table th:nth-child(7){width:110px}.br-list-table th:nth-child(8){width:115px}.br-list-table th:nth-child(9){width:110px}.br-list-table th:last-child{width:90px;}
.br-list-row td > strong,.br-list-row td > small,.br-list-row td > em {display:block;}
.br-list-row td > small {margin-top:4px;color:#6b7d74;font-weight:400;}.br-list-row td > em {margin-top:4px;color:#a85400;font-style:normal;font-size:12px;}
.br-product-summary strong,.br-product-summary small,.br-product-summary em {display:block;}
.br-product-summary small {margin-top:4px;color:#6b7d74;font-weight:400;}.br-product-summary em {margin-top:4px;color:#a85400;font-style:normal;font-size:12px;}
.br-kind {display:inline-flex;margin-right:6px;padding:2px 7px;border-radius:999px;background:#e8f3ed;color:#176943;font-size:12px;}
.br-number {white-space:nowrap;text-align:right;}.br-amount {color:#c84a00;font-weight:700;}
.br-appointment {display:inline-flex;padding:4px 10px;border-radius:999px;background:#fff1d8;color:#925500;white-space:nowrap;}.br-appointment.is-done {background:#e4f4ec;color:#16714a;}
.br-list-row.br-overdue td {background:#fff9ec;}.br-list-row.br-overdue:hover td {background:#fff4d9;}
.br-card {background:white;border:1px solid #dce6e2;border-radius:8px;margin:12px 0;overflow:hidden;}
.br-card > header {display:flex;justify-content:space-between;gap:12px;padding:12px 16px;background:#f5faf7;}
.br-card h3,.br-card h4 {margin:0 0 6px;}
.br-card > footer {display:flex;gap:8px;flex-wrap:wrap;padding:12px 16px;border-top:1px solid #e6eeea;}
.br-overdue {border:2px solid #e69a26;}
.br-warning {color:#8b4c00;background:#fff2d8;padding:10px 16px;margin:0;}
.br-states {display:flex;gap:8px;flex-wrap:wrap;padding:12px 16px;}
.br-state {padding:5px 12px;background:#edf5f1;border:1px solid #d4e4db;border-radius:6px;}
.br-state small {display:block;color:#62796f;font-size:12px;}
.br-group {padding:8px 16px;}.br-group h4 {font-size:14px;}
.br-table-scroll {overflow-x:auto;}.br-group table {width:100%;min-width:620px;}
.br-group td small {display:block;color:#697b73;margin-top:4px;}
.br-pager {display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;font-size:12px;}
.br-pager button {min-height:30px;padding:4px 9px;}
.br-list-footer {display:flex;justify-content:flex-end;padding:8px 12px;background:#fff;border-top:1px solid #d5e0dc;}
.br-history {background:#eef1f4;color:#566477;padding:3px 8px;border-radius:4px;}
.br-document-preview {display:block;width:100%;height:min(74dvh,900px);border:1px solid #d4e3db;background:#e8ecea;}
.br-document-actions {display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;}
.br-reservation-kind {margin-bottom:12px;padding:10px 12px;background:#f5faf7;border-radius:6px;}
.br-dialog {width:min(1360px,96vw);max-height:94dvh;padding:0;border:1px solid #c9dad1;border-radius:10px;}
.br-dialog > form {display:flex;flex-direction:column;max-height:92dvh;margin:0;}
.br-dialog header,.br-dialog footer {flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;background:#f4f9f6;}
.br-dialog header h3 {margin:0;}.br-dialog footer {justify-content:flex-end;}
.br-dialog-body {overflow-y:auto;min-height:0;padding:14px 18px;}
.br-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 14px;}
.br-grid label,.br-dialog-body > label {display:flex;flex-direction:column;gap:5px;font-size:13px;color:#526a60;}
.br-span2 {grid-column:span 2;}
.br-dialog input,.br-dialog select,.br-dialog textarea {width:100%;min-width:0;min-height:35px;box-sizing:border-box;}
.br-dialog textarea {min-height:62px;}.br-dialog fieldset {border:1px solid #d4e3db;border-radius:7px;padding:12px;margin:0 0 12px;}
.br-dialog legend {font-weight:bold;padding:0 6px;}.br-header-fields {margin-top:16px;}
.br-dialog [hidden] {display:none!important;}
.br-dialog [data-br-lot-help] {display:block;margin-top:8px;color:#697f74;}
.br-dialog [data-br-form-error],.br-page [data-br-error] {color:#b42318;white-space:pre-wrap;}
.br-detail-actions {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:10px 0;background:#fff;border-bottom:1px solid #dce6e2;}
.br-action-section {min-width:0;padding:9px 10px;border:1px solid #dce6e2;border-radius:6px;background:#f8fbf9;}
.br-action-section > strong {display:block;margin-bottom:8px;color:#264b3b;}
.br-action-section > div {display:flex;gap:6px;flex-wrap:wrap;}
.br-action-section button {min-height:32px;padding:5px 9px;}
.br-action-section .br-gjp-inline {display:flex;align-items:center;gap:6px;flex-wrap:nowrap;}
.br-gjp-inline input {min-width:0;flex:1;height:34px;}
.br-gjp-inline button {flex:none;}
.br-legacy-notice {grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0;padding:10px 12px;border:1px solid #e7d7ab;border-radius:6px;background:#fff9e9;color:#674e13;}
.br-legacy-notice button {flex:none;}
.br-detail-summary {display:flex;gap:18px;flex-wrap:wrap;padding:12px 16px;background:#f7faf8;}
.br-detail-overview {display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:1px;padding:1px;background:#dce6e2;border-radius:7px;overflow:hidden;margin:12px 0;}
.br-detail-overview > span {display:flex;flex-direction:column;gap:4px;min-height:58px;padding:10px 12px;background:#f7faf8;}
.br-detail-overview small {color:#697b73;}.br-detail-overview strong {color:#173e30;}.br-detail-overview .is-wide {grid-column:span 2;}
.br-top-fields {display:grid;grid-template-columns:minmax(145px,.75fr) minmax(145px,.78fr) minmax(220px,1.2fr) minmax(180px,1fr) minmax(210px,1.1fr);gap:9px 12px;align-items:end;}
.br-top-fields [data-own-field],.br-top-fields [data-retained-field],.br-top-fields [data-storage-deadline] {grid-column:auto;}
.br-storage-date-control{display:flex;min-width:0;}
.br-storage-date-control input{border-radius:5px 0 0 5px;cursor:pointer!important;}
.br-storage-date-control button{flex:none;min-width:38px;border-radius:0 5px 5px 0;background:#e5f3ee;color:#087f75;}
.br-storage-picker{position:fixed;z-index:40;width:min(260px,calc(100vw - 16px));padding:10px;background:#fff;border:1px solid #b8d2c3;border-radius:9px;box-shadow:0 10px 28px #173b2a33;}
.br-storage-picker-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;}
.br-dialog .br-storage-picker-head button{width:34px;font-size:20px;background:#e9f4ee;color:#176045;}
.br-dialog .br-storage-picker>button{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:5px;text-align:left;background:#f7fbf9;color:#173e30;}
.br-dialog .br-storage-picker>button:hover{background:#e7f5ed;border-color:#11945b;}
.br-storage-picker small{color:#526f60;font-size:12px;}
.br-search-select {display:block;position:relative;min-width:0;}
.br-search-select input[type="search"] {padding-right:28px;background:#fff;}
.br-line-grid {display:grid;grid-template-columns:minmax(190px,1.15fr) minmax(330px,2.15fr) minmax(80px,.48fr) minmax(150px,.8fr) minmax(125px,.68fr) minmax(82px,.42fr);gap:9px 12px;align-items:end;}
.br-line-grid label {display:flex;flex-direction:column;gap:5px;font-size:13px;color:#526a60;min-width:0;}
.br-lot-info {display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr);gap:8px;margin-top:9px;}
.br-lot-info span {display:flex;flex-direction:column;gap:3px;min-width:0;padding:7px 10px;border:1px solid #d8e8df;border-radius:6px;background:#f7fbf9;}
.br-lot-info small {color:#6a8074;font-size:11px;}
.br-lot-info strong {color:#264c39;font-size:13px;overflow-wrap:anywhere;}
.br-lot-info .br-lot-empty {display:block;grid-column:1/-1;color:#697f74;}
.br-line-actions {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px;}
.br-line-actions [data-br-lot-help] {margin-top:0;}
.br-unit-field select {max-width:90px;}
.br-dialog input[readonly] {background:#eef2f0;color:#52645b;cursor:not-allowed;}
.br-dialog input:disabled,.br-dialog select:disabled {background:#e8ecea;color:#8a9690;cursor:not-allowed;}

/* New purchase inbound: explicit master-data search and selection. */
#editor.purchase-v2-dialog .purchase-master-search{position:relative;min-width:0;flex:1;}
#editor.purchase-v2-dialog .purchase-master-results{position:absolute;top:calc(100% + 3px);left:0;right:0;z-index:20;max-height:260px;overflow-y:auto;background:#fff;border:1px solid #9dbcae;border-radius:6px;box-shadow:0 8px 20px #153b2a26;}
#editor.purchase-v2-dialog .purchase-master-results[hidden]{display:none!important;}
#editor.purchase-v2-dialog .purchase-master-results button{display:block;width:100%;padding:8px 10px;text-align:left;color:#183e30;background:#fff;border:0;border-bottom:1px solid #e7eeea;cursor:pointer;white-space:normal;}
#editor.purchase-v2-dialog .purchase-master-results button:hover,#editor.purchase-v2-dialog .purchase-master-results button.is-active{background:#e7f5ed;}
#editor.purchase-v2-dialog .purchase-master-results strong,#editor.purchase-v2-dialog .purchase-master-results small{display:block;overflow-wrap:anywhere;}
#editor.purchase-v2-dialog .purchase-master-results small{margin-top:2px;color:#60786b;font-size:11px;}
#editor.purchase-v2-dialog .purchase-master-result-note{padding:9px 10px;color:#6d7d73;font-size:12px;}
@media(max-width:1120px){.br-top-fields{grid-template-columns:repeat(3,minmax(0,1fr))}.br-line-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.br-lot-field{grid-column:span 2}.br-detail-overview{grid-template-columns:repeat(3,minmax(150px,1fr))}}
@media(max-width:760px){.br-grid,.br-top-fields,.br-line-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.br-card>header{flex-direction:column}.br-dialog{width:96vw}.br-dialog-body{padding:10px}.br-dialog header,.br-dialog footer{padding:10px}.br-lot-field{grid-column:span 2}.br-line-actions{align-items:flex-start}.br-detail-actions{grid-template-columns:1fr}.br-legacy-notice{flex-wrap:wrap}.br-detail-overview{grid-template-columns:repeat(2,minmax(140px,1fr))}}
@media(max-width:760px){.br-lot-info{grid-template-columns:repeat(2,minmax(0,1fr))}.br-lot-info span:first-child{grid-column:1/-1}}
@media(max-width:480px){.br-grid,.br-top-fields,.br-line-grid,.br-detail-overview{grid-template-columns:1fr}.br-span2,.br-lot-field,.br-detail-overview .is-wide{grid-column:auto}.br-state{flex:1;min-width:100px}.br-pager{justify-content:center}.br-list-heading{align-items:flex-start;flex-direction:column}.br-dialog footer{flex-wrap:wrap}.br-line-actions{flex-direction:column}.br-line-actions button{align-self:flex-end}}
@media(max-width:480px){.br-lot-info{grid-template-columns:1fr}.br-lot-info span:first-child{grid-column:auto}}

/* Management category sidebar and single-row partner controls. */
.management-category-layout{display:grid;grid-template-columns:230px minmax(0,1fr);gap:14px;align-items:start}
.management-category-sidebar{background:#fff;border:1px solid #d6e3dc;border-radius:12px;padding:10px;max-height:calc(100vh - 170px);overflow:auto;position:sticky;top:12px}
.management-category-content{min-width:0}
.management-category-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:9px}
.management-category-heading button,.management-category-edit{border:0;background:#e8f4ee;color:#08734d;border-radius:6px;cursor:pointer}
.management-category-node{display:flex;align-items:center;gap:3px}.management-category-node.inactive{opacity:.55}
.management-category-node.depth-1{padding-left:12px}.management-category-node.depth-2{padding-left:24px}
.management-category-choice{display:flex;align-items:center;justify-content:space-between;gap:5px;text-align:left;flex:1;width:100%;border:0;background:transparent;padding:7px 6px;color:#245344;border-radius:6px;cursor:pointer}
.management-category-choice.active{background:#d8f0e5;font-weight:700;color:#075c3d}.management-category-choice small{font-size:11px;color:#667e73}
.management-category-edit{padding:4px 6px}
.management-category-bulk{display:flex;gap:5px;align-items:center}.management-category-bulk select{max-width:180px;height:36px}
.partner-master-toolbar{display:flex!important;align-items:center;gap:7px;flex-wrap:nowrap;overflow-x:auto}.partner-master-toolbar button,.partner-master-toolbar select{white-space:nowrap}.partner-master-toolbar>input{flex:1 1 210px!important;min-width:180px!important;width:auto!important}.partner-master-toolbar .master-data-pagination{display:flex;align-items:center;gap:4px;margin:0;flex-shrink:0}.partner-master-toolbar .master-data-pagination span{white-space:nowrap}
.management-category-form{display:grid;gap:12px;min-width:min(430px,85vw);padding:20px}.management-category-form label{display:grid;gap:4px}.management-category-form .management-category-active{display:flex}.management-category-form .actions{display:flex;justify-content:flex-end;gap:8px}
@media(max-width:760px){.management-category-layout{display:block}.management-category-sidebar{position:static;max-height:200px;margin-bottom:8px}.partner-master-toolbar{flex-wrap:wrap;overflow:visible}.partner-master-toolbar .master-data-pagination{width:100%;flex-wrap:wrap}}
.partner-master-toolbar{min-width:0;align-items:center!important}
.partner-master-toolbar>input{flex:1 1 240px!important;min-width:180px!important;max-width:340px!important;height:36px!important}
.partner-master-toolbar>select{flex:0 0 112px!important;width:112px!important;min-width:112px!important;max-width:112px!important;height:36px}
.partner-master-toolbar>button{flex:0 0 auto;height:36px;padding:6px 10px;font-size:13px;line-height:20px}
.partner-master-toolbar .master-data-pagination{padding:0!important;min-width:0}
.partner-master-toolbar .master-data-pagination label{white-space:nowrap}
.partner-master-toolbar .master-data-pagination select{min-width:70px;width:70px;height:36px}
.partner-master-toolbar .master-data-pagination button{padding:6px 9px;height:36px}
.partner-master-toolbar .management-category-bulk{flex:0 0 auto}
.partner-master-toolbar .management-category-bulk select{max-width:112px;width:112px;height:36px}
.partner-master-toolbar .management-category-bulk button{height:36px;padding:6px 9px;white-space:nowrap}
.management-category-form .actions [data-management-category-delete]{margin-right:auto}
.product-management-table th,.product-management-table td{overflow-wrap:anywhere}
.product-management-table th:first-child,.product-management-table td:first-child{width:42px}
.product-management-table th:nth-child(2),.product-management-table td:nth-child(2){width:105px}
.product-management-table th:nth-child(3),.product-management-table td:nth-child(3){width:235px}
.product-management-table .product-unit-relation-heading,.product-management-table .product-unit-relation-cell{width:165px;max-width:165px}
.product-management-table .product-unit-relation-cell span{white-space:normal!important;margin-right:0!important}
.product-management-table .product-actions-heading,.product-management-table .product-actions-cell{width:125px;max-width:125px}
.management-category-node .management-category-choice{min-width:0}
.management-category-node .management-category-choice span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.management-category-node .management-category-choice small{flex-shrink:0;white-space:nowrap}
.management-category-node .management-category-edit,.management-category-node .management-category-delete{flex:0 0 25px;width:25px;height:28px;padding:2px;text-align:center;line-height:22px}
.management-category-delete{border:1px solid #e5b5af;background:#fff2ef;color:#b83b35;border-radius:6px;cursor:pointer}
.management-category-delete:disabled{background:#f3f5f4;border-color:#e2e7e4;color:#a8b4ae;cursor:not-allowed}
.partner-role-sidebar{display:grid;gap:2px;padding-bottom:10px;margin-bottom:10px;border-bottom:1px solid #dce7e0}
.partner-role-sidebar>strong{padding:3px 6px 5px;color:#244f40}
.partner-role-sidebar .management-category-choice{width:100%;min-height:34px}
.management-category-picker{border:1px solid #d2e2d8;border-radius:12px;padding:0;min-width:min(460px,92vw);max-width:92vw}
.management-category-picker form{padding:20px;display:grid;gap:12px}
.management-category-picker h2{margin:0;font-size:20px}
.management-category-picker-options{display:grid;gap:4px;max-height:55vh;overflow:auto}
.management-category-picker-options label{display:flex;align-items:center;gap:9px;padding:9px;border:1px solid #e1eae4;border-radius:7px;cursor:pointer}
.management-category-picker-options label:has(input:checked){background:#e1f3e9;border-color:#0c8b5b;font-weight:700}
.management-category-picker .actions{display:flex;justify-content:flex-end;gap:8px}

/* Bank receipts: customer recognition is separate from settlement. */
.finance-bank-receipts-ledger td.bank-customer-unbound{background:#fff3dd!important;box-shadow:inset 3px 0 0 #c66a08;color:#8a3900}
.bank-customer-unbound-badge{display:inline-flex;align-items:center;padding:4px 11px;border:1px solid #d99227;border-radius:999px;background:#ffe1a3;color:#793300;font-weight:750;line-height:1.4;white-space:nowrap}
