:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --line: #d9e0ea;
  --text: #172033;
  --muted: #667085;
  --primary: #1f4e79;
  --primary-dark: #173a5a;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
button, input, select {
  font: inherit;
}
button {
  border: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 13px;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); }
button.secondary {
  background: #eef2f7;
  color: var(--text);
}
button.internal {
  background: #facc15;
  color: #422006;
}
button.internal:hover {
  background: #eab308;
}
button.danger {
  background: var(--danger);
}
button.link-button {
  background: transparent;
  color: var(--primary);
  padding: 0;
  border-radius: 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link-button:hover {
  background: transparent;
  color: var(--primary-dark);
}
input, select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  min-width: 140px;
  max-width: 100%;
}
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.error { color: var(--danger); min-height: 18px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-panel {
  width: min(380px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: 8px;
  display: grid;
  gap: 14px;
}
.login-panel h1 {
  margin: 0 0 4px;
  font-size: 24px;
}
.login-panel label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 190px 1fr;
  width: 100%;
  max-width: 100vw;
}
.sidebar {
  background: #162536;
  color: #fff;
  padding: 16px 12px;
  min-width: 0;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  margin: 4px 8px 18px;
}
.nav {
  width: 100%;
  text-align: left;
  background: transparent;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 14px;
}
.nav.active, .nav:hover {
  background: #24425f;
}
.nav-group-title { margin: 16px 8px 8px; color: #9fb3c8; font-size: 12px; }
.stock-nav { padding-left: 18px; font-size: 14px; }
.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  max-width: 100vw;
}
.topbar {
  height: 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}
#userBadge {
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}
.view {
  display: none;
  padding: 18px;
  min-width: 0;
  max-width: 100%;
}
.view.active { display: block; }
.dashboard-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 14px;
  max-width: 1480px;
}
.operational-risk-panel {
  max-width: 1480px;
  margin-top: 14px;
}
.dashboard-tax-panel {
  max-width: 1480px;
  margin-top: 14px;
}
.dashboard-tax-table-wrap {
  max-height: 260px;
}
.dashboard-tax-table {
  min-width: 980px;
}
.dashboard-tax-table th:first-child,
.dashboard-tax-table td:first-child {
  width: 90px;
}
.dashboard-tax-table .current-period-row td {
  background: #eef5fb;
  font-weight: 700;
}
.risk-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.dashboard-risk-table-wrap { max-height: 250px; }
.dashboard-summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.dashboard-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.dashboard-summary-head strong {
  font-size: 17px;
}
.dashboard-summary-head span {
  color: var(--muted);
  font-size: 12px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.kpi {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 92px;
  display: grid;
  align-content: center;
}
.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.kpi strong {
  font-size: 24px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-wide,
.kpi-profit {
  background: #eef5fb;
  border-color: #c9d9e8;
}
.kpi-profit strong {
  color: var(--primary);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(520px, 1.2fr);
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}
.dashboard-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
  max-width: 100%;
}
.account-detail-view {
  padding: 0;
  height: calc(100vh - 58px);
}
.account-detail-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f6f7f9;
}
.contract-summary-view {
  background: #f5f7fa;
}
.panel-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.sub-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 2px 0 8px;
}
.category-stack {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 340px);
  overflow: auto;
  padding-right: 2px;
}
.category-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  background: #f7f9fc;
}
.category-title span {
  color: var(--muted);
  font-size: 12px;
}
.mini-table-wrap {
  max-height: 260px;
  overflow: auto;
}
.compact-table {
  width: 100%;
  min-width: 0;
  font-size: 13px;
}
.compact-table th,
.compact-table td {
  height: 30px;
  padding: 6px 8px;
}
.compact-table th {
  top: 0;
}
.sales-stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.sales-stat-stack {
  display: grid;
  gap: 14px;
  width: 100%;
}
.weight-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.weight-alert {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #f5c2c7;
  border-radius: 8px;
  color: #842029;
  background: #fff5f5;
  font-size: 13px;
  line-height: 1.5;
}
.weight-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.weight-project-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.weight-project-head {
  margin-bottom: 10px;
}
.weight-project-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.weight-project-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.weight-mini-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.weight-mini-kpi {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
}
.weight-mini-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.weight-mini-kpi strong {
  display: block;
  color: var(--text);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.sales-stats-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.annual-sales-card {
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7f9fc;
  text-align: right;
}
.annual-sales-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.annual-sales-card strong {
  display: block;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}
.annual-sales-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.stock-detail-panel {
  max-width: 1180px;
}
.report-panel {
  width: 100%;
  max-width: none;
}
.stock-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.stock-detail-head p {
  margin: 4px 0 0;
}
.stock-detail-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.stock-detail-summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f7f9fc;
  color: var(--muted);
}
.stock-detail-summary strong {
  color: var(--text);
  margin-left: 4px;
}
.stock-search-row {
  margin-bottom: 12px;
}
.stock-search-row label {
  display: block;
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.stock-search-row input {
  width: 100%;
  margin-top: 6px;
}
.detail-search-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: -2px 0 12px;
  flex-wrap: wrap;
}
.detail-search-row label {
  display: block;
  width: min(520px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.detail-search-row input {
  width: 100%;
  margin-top: 6px;
}
.detail-export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 0 0 12px;
}
.detail-export-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  min-width: 160px;
}
.stock-table-wrap {
  max-height: calc(100vh - 205px);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.detail-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.detail-summary strong {
  color: var(--text);
  margin-left: 4px;
}
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: auto;
  max-height: calc(100vh - 132px);
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
.wechat-layout {
  display: grid;
  gap: 14px;
}
.wechat-panel {
  max-width: 1280px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.wechat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wechat-raw-input {
  width: 100%;
  min-height: 180px;
  line-height: 1.55;
}
.wechat-warning {
  margin-top: 10px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 13px;
}
.wechat-upload-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px dashed #b7c5d8;
  border-radius: 6px;
  background: #f8fafc;
  padding: 22px 16px;
  margin-top: 12px;
  min-height: 116px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.wechat-upload-box:hover,
.wechat-upload-box.dragging {
  border-color: var(--primary);
  background: #eef6ff;
}
.wechat-upload-box.disabled {
  cursor: not-allowed;
  opacity: 0.62;
  background: #f3f5f8;
}
.wechat-upload-box input {
  display: none;
}
.wechat-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}
.wechat-upload-copy {
  display: grid;
  gap: 5px;
}
.wechat-upload-copy strong {
  color: var(--text);
  font-size: 15px;
}
.wechat-upload-copy span {
  color: var(--muted);
  font-size: 13px;
}
.wechat-attachment-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  min-height: 24px;
}
.wechat-attachment-list a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}
.wechat-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}
.wechat-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.wechat-form-grid input,
.wechat-form-grid textarea {
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-weight: 400;
}
.wechat-form-grid textarea {
  min-height: 88px;
}
.wechat-form-grid .wide {
  grid-column: span 2;
}
.wechat-history-panel .table-wrap,
.wechat-record-wrap {
  max-height: 300px;
}
table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
}
th, td {
  border: 1px solid var(--line);
  padding: 7px 8px;
  white-space: nowrap;
  height: 34px;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f8;
  font-weight: 700;
  text-align: left;
}
th[data-sort-table] {
  cursor: pointer;
  user-select: none;
}
th[data-loan-sort] {
  cursor: pointer;
  user-select: none;
}
th[data-sort-table]::after {
  content: "↕";
  color: #8a98aa;
  font-size: 11px;
  margin-left: 6px;
}
th[data-loan-sort]::after {
  content: "↕";
  color: #8a98aa;
  font-size: 11px;
  margin-left: 6px;
}
th.sort-active::after {
  color: var(--primary);
  content: "↓";
}
th.sort-active[data-sort-direction="asc"]::after {
  content: "↑";
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
td.merge-cell {
  vertical-align: middle;
  background: #fbfcfe;
}
tr.editable-row {
  cursor: pointer;
}
tr.editable-row:hover td {
  background: #f8fbff;
}
tr.clickable-row {
  cursor: pointer;
}
tr.clickable-row:hover td {
  background: #f8fbff;
}
tr.active-row td {
  background: #eaf2fb;
  font-weight: 700;
}
td.actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
}
td.actions button {
  min-width: 66px;
  height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sales-details-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}
.sales-details-tabs button {
  background: #eef3f9;
  color: var(--text);
  font-weight: 700;
}
.sales-details-tabs button.active {
  background: var(--primary);
  color: #fff;
}
.sales-details-panel {
  display: none;
}
.sales-details-panel.active {
  display: block;
}
.sales-details-panel .sales-subtable-title {
  margin-top: 0;
}

#salesDetailsTable,
#solidTireSalesDetailsTable,
#inboundDetailsTable,
#customersTable,
#usersTable,
#productPickerTable {
  table-layout: fixed;
  width: 100%;
}

#salesDetailsTable,
#solidTireSalesDetailsTable {
  min-width: 1498px;
}
#salesDetailsTable th,
#salesDetailsTable td,
#solidTireSalesDetailsTable th,
#solidTireSalesDetailsTable td,
#inboundDetailsTable th,
#inboundDetailsTable td,
#customersTable th,
#customersTable td,
#usersTable th,
#usersTable td,
#productPickerTable th,
#productPickerTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}
#salesDetailsTable th:nth-child(1), #salesDetailsTable td:nth-child(1), #solidTireSalesDetailsTable th:nth-child(1), #solidTireSalesDetailsTable td:nth-child(1) { width: 120px; }
#salesDetailsTable th:nth-child(2), #salesDetailsTable td:nth-child(2), #solidTireSalesDetailsTable th:nth-child(2), #solidTireSalesDetailsTable td:nth-child(2) { width: 82px; }
#salesDetailsTable th:nth-child(3), #salesDetailsTable td:nth-child(3), #solidTireSalesDetailsTable th:nth-child(3), #solidTireSalesDetailsTable td:nth-child(3) { width: 86px; }
#salesDetailsTable th:nth-child(4), #salesDetailsTable td:nth-child(4), #solidTireSalesDetailsTable th:nth-child(4), #solidTireSalesDetailsTable td:nth-child(4) { width: 82px; }
#salesDetailsTable th:nth-child(5), #salesDetailsTable td:nth-child(5), #solidTireSalesDetailsTable th:nth-child(5), #solidTireSalesDetailsTable td:nth-child(5) { width: 156px; }
#salesDetailsTable th:nth-child(6), #salesDetailsTable td:nth-child(6), #solidTireSalesDetailsTable th:nth-child(6), #solidTireSalesDetailsTable td:nth-child(6) { width: 44px; }
#salesDetailsTable th:nth-child(7), #salesDetailsTable td:nth-child(7), #solidTireSalesDetailsTable th:nth-child(7), #solidTireSalesDetailsTable td:nth-child(7) { width: 44px; }
#salesDetailsTable th:nth-child(8), #salesDetailsTable td:nth-child(8),
#salesDetailsTable th:nth-child(9), #salesDetailsTable td:nth-child(9),
#salesDetailsTable th:nth-child(10), #salesDetailsTable td:nth-child(10),
#solidTireSalesDetailsTable th:nth-child(8), #solidTireSalesDetailsTable td:nth-child(8),
#solidTireSalesDetailsTable th:nth-child(9), #solidTireSalesDetailsTable td:nth-child(9),
#solidTireSalesDetailsTable th:nth-child(10), #solidTireSalesDetailsTable td:nth-child(10) { width: 62px; }
#salesDetailsTable th:nth-child(11), #salesDetailsTable td:nth-child(11),
#salesDetailsTable th:nth-child(12), #salesDetailsTable td:nth-child(12),
#salesDetailsTable th:nth-child(13), #salesDetailsTable td:nth-child(13),
#salesDetailsTable th:nth-child(14), #salesDetailsTable td:nth-child(14),
#solidTireSalesDetailsTable th:nth-child(11), #solidTireSalesDetailsTable td:nth-child(11),
#solidTireSalesDetailsTable th:nth-child(12), #solidTireSalesDetailsTable td:nth-child(12),
#solidTireSalesDetailsTable th:nth-child(13), #solidTireSalesDetailsTable td:nth-child(13),
#solidTireSalesDetailsTable th:nth-child(14), #solidTireSalesDetailsTable td:nth-child(14) { width: 76px; }
#salesDetailsTable th:nth-child(15), #salesDetailsTable td:nth-child(15), #solidTireSalesDetailsTable th:nth-child(15), #solidTireSalesDetailsTable td:nth-child(15) { width: 62px; }
#salesDetailsTable th:nth-child(16), #salesDetailsTable td:nth-child(16), #solidTireSalesDetailsTable th:nth-child(16), #solidTireSalesDetailsTable td:nth-child(16) { width: 198px; }
#salesDetailsTable th:nth-child(17), #salesDetailsTable td:nth-child(17), #solidTireSalesDetailsTable th:nth-child(17), #solidTireSalesDetailsTable td:nth-child(17) { width: 250px; }

#inboundDetailsTable {
  min-width: 1180px;
}
#inboundDetailsTable th:nth-child(1), #inboundDetailsTable td:nth-child(1) { width: 120px; }
#inboundDetailsTable th:nth-child(2), #inboundDetailsTable td:nth-child(2) { width: 82px; }
#inboundDetailsTable th:nth-child(3), #inboundDetailsTable td:nth-child(3) { width: 82px; }
#inboundDetailsTable th:nth-child(4), #inboundDetailsTable td:nth-child(4) { width: 88px; }
#inboundDetailsTable th:nth-child(5), #inboundDetailsTable td:nth-child(5) { width: 92px; }
#inboundDetailsTable th:nth-child(6), #inboundDetailsTable td:nth-child(6) { width: 92px; }
#inboundDetailsTable th:nth-child(7), #inboundDetailsTable td:nth-child(7) { width: 180px; }
#inboundDetailsTable th:nth-child(8), #inboundDetailsTable td:nth-child(8) { width: 58px; }
#inboundDetailsTable th:nth-child(9), #inboundDetailsTable td:nth-child(9),
#inboundDetailsTable th:nth-child(10), #inboundDetailsTable td:nth-child(10),
#inboundDetailsTable th:nth-child(11), #inboundDetailsTable td:nth-child(11) { width: 78px; }
#inboundDetailsTable th:nth-child(12), #inboundDetailsTable td:nth-child(12) { width: 150px; }
#inboundDetailsTable th:nth-child(13), #inboundDetailsTable td:nth-child(13) { width: 130px; }

#customersTable {
  min-width: 900px;
}
#customersTable th:nth-child(1), #customersTable td:nth-child(1) { width: 110px; }
#customersTable th:nth-child(2), #customersTable td:nth-child(2) { width: 190px; }
#customersTable th:nth-child(3), #customersTable td:nth-child(3) { width: 100px; }
#customersTable th:nth-child(4), #customersTable td:nth-child(4) { width: 130px; }
#customersTable th:nth-child(5), #customersTable td:nth-child(5) { width: 230px; }
#customersTable th:nth-child(6), #customersTable td:nth-child(6) { width: 160px; }
#customersTable th:nth-child(7), #customersTable td:nth-child(7) { width: 130px; }
.sales-actions-cell {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
  min-width: 260px;
  text-align: center;
}

#salesDetailsTable th:last-child,
#solidTireSalesDetailsTable th:last-child,
#inboundDetailsTable th:last-child,
#productsTable th:last-child,
#customersTable th:last-child,
#usersTable th:last-child,
.material-detail-table th:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  box-shadow: -1px 0 0 var(--line);
}
.sales-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100%;
  width: 100%;
}
.sales-actions button {
  min-width: 66px;
  height: 28px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sales-subtable-title { margin-top: 24px; }
.compact-toolbar { min-height: 0; padding-top: 0; }

.invoice-manual-payment-btn {
  min-width: 52px;
  height: 28px;
  padding: 0 10px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(760px, calc(100vw - 32px));
}
dialog::backdrop { background: rgb(0 0 0 / 0.28); }
.picker-dialog {
  width: min(1080px, calc(100vw - 32px));
}
.detail-dialog {
  width: min(1280px, calc(100vw - 32px));
}
.sales-order-preview-dialog {
  width: min(1320px, calc(100vw - 32px));
}
.detail-dialog form {
  padding: 18px;
}
.detail-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-dialog-head h2 {
  margin: 0;
  font-size: 18px;
}
.detail-dialog-table {
  max-height: min(620px, calc(100vh - 180px));
}
.detail-dialog-table table {
  min-width: 1040px;
}
.sales-order-preview-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sales-order-preview-meta div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}
.sales-order-preview-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.sales-order-preview-summary {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-weight: 700;
}
.sales-order-preview-summary span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #f8fafc;
}
.picker-dialog form {
  padding: 18px;
}
.picker-head {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
.picker-head h2 {
  margin: 0;
  font-size: 18px;
}
.picker-head input {
  width: 100%;
}
.picker-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.picker-tools input {
  flex: 1;
  min-width: 180px;
}
.picker-tools button {
  white-space: nowrap;
}
.picker-table-wrap {
  max-height: min(560px, calc(100vh - 220px));
}
.picker-table-wrap table {
  table-layout: fixed;
  width: 100%;
  min-width: 980px;
}
#productPickerTable th,
#productPickerTable td {
  padding: 5px 7px;
}
#productPickerTable th:nth-child(1),
#productPickerTable td:nth-child(1) { width: 42px; }
#productPickerTable th:nth-child(2),
#productPickerTable td:nth-child(2) { width: 95px; }
#productPickerTable th:nth-child(3),
#productPickerTable td:nth-child(3) { width: 105px; }
#productPickerTable th:nth-child(4),
#productPickerTable td:nth-child(4) {
  width: 300px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}
#productPickerTable th:nth-child(5),
#productPickerTable td:nth-child(5) { width: 70px; }
#productPickerTable th:nth-child(6),
#productPickerTable td:nth-child(6) { width: 52px; }
#productPickerTable th:nth-child(7),
#productPickerTable td:nth-child(7),
#productPickerTable th:nth-child(8),
#productPickerTable td:nth-child(8),
#productPickerTable th:nth-child(9),
#productPickerTable td:nth-child(9) { width: 78px; }
#productPickerTable tbody tr {
  height: auto;
}
.pick-col {
  width: 46px;
  text-align: center;
}
.pick-col input,
#productPickerTable td:first-child input {
  min-width: 0;
}
#productPickerCount {
  margin-right: auto;
  align-self: center;
}
#editForm {
  padding: 18px;
}
#editForm h2 {
  margin: 0 0 14px;
  font-size: 18px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.fields input, .fields select {
  width: 100%;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.order-form {
  display: grid;
  gap: 12px;
}
.order-head {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.order-head label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.order-head input,
.order-head select {
  width: 100%;
}
.order-total {
  margin-left: auto;
  color: var(--text);
}
.order-table-wrap {
  max-height: calc(100vh - 230px);
}

.material-layout {
  width: 100%;
}
.material-panel {
  padding: 14px;
  width: 100%;
}
.material-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.material-head p {
  margin: 4px 0 0;
}
.material-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.material-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
}
.material-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.material-kpis strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}
.loan-panel {
  width: 100%;
  padding: 14px;
}
.anna-living-panel {
  width: 100%;
  padding: 14px;
}
.repayment-record-panel {
  width: 100%;
  padding: 14px;
}
.personal-finance-hub {
  width: 100%;
  padding: 14px;
}
.personal-finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.personal-finance-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7f9fc;
}
.personal-finance-summary-link {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.personal-finance-summary-link:hover,
.personal-finance-summary-link:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
  outline: none;
  transform: translateY(-1px);
}
.personal-finance-summary-link:hover strong,
.personal-finance-summary-link:focus-visible strong {
  color: var(--primary);
}
.personal-finance-summary span,
.personal-finance-summary small {
  display: block;
  color: var(--muted);
}
.personal-finance-summary span {
  font-size: 12px;
  margin-bottom: 6px;
}
.personal-finance-summary strong {
  display: block;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.personal-finance-summary small {
  margin-top: 4px;
  font-size: 12px;
}
.personal-finance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.personal-finance-tabs button {
  background: #eef3f9;
  color: var(--text);
}
.personal-finance-tabs button.active {
  background: var(--primary);
  color: #fff;
}
.personal-finance-tab-panel {
  display: none;
}
.personal-finance-tab-panel.active {
  display: block;
}
.personal-finance-tab-panel.account-detail-view {
  height: calc(100vh - 360px);
  min-height: 620px;
}
.personal-finance-tab-panel .anna-living-panel,
.personal-finance-tab-panel .repayment-record-panel {
  padding: 0;
}
.asset-inventory-panel {
  padding: 0;
}
.asset-inventory-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  padding: 20px 22px;
  border-radius: 10px;
  background: #10243e;
  color: #fff;
}
.asset-inventory-eyebrow {
  color: #b9c7d8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.asset-inventory-hero h3 {
  margin: 0;
  font-size: 28px;
}
.asset-inventory-hero p {
  max-width: 720px;
  margin: 8px 0 0;
  color: #d6e0ec;
  line-height: 1.6;
}
.asset-inventory-total {
  min-width: 260px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  text-align: right;
}
.asset-inventory-total span,
.asset-inventory-total small {
  display: block;
  color: #c5d1df;
}
.asset-inventory-total strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}
.asset-inventory-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.asset-inventory-kpis div,
.asset-inventory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.asset-inventory-kpis div {
  padding: 12px 14px;
}
.asset-inventory-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.asset-inventory-kpis strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.asset-inventory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 12px;
  margin-top: 12px;
}
.asset-inventory-grid.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.asset-inventory-card {
  padding: 14px;
  min-width: 0;
}
.asset-inventory-table {
  min-width: 640px;
}
.asset-inventory-table tfoot th {
  background: #eef5fb;
  font-weight: 700;
}
.asset-inventory-stack {
  display: grid;
  gap: 10px;
}
.asset-inventory-stack div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f9fc;
}
.asset-inventory-stack span,
.asset-inventory-list span {
  color: var(--muted);
  line-height: 1.55;
}
.asset-inventory-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.asset-inventory-list li {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.asset-inventory-list li:last-child {
  border-bottom: 0;
}
.repayment-record-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
  max-width: 620px;
}
.repayment-record-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
}
.repayment-record-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.repayment-record-kpis strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}
.anna-living-form {
  display: grid;
  grid-template-columns: 150px 180px 150px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin: 12px 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}
.anna-living-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.anna-living-form input,
.anna-living-form select {
  width: 100%;
  min-width: 0;
}
.anna-living-form button {
  height: 36px;
}
.anna-living-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.anna-living-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
}
.anna-living-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.anna-living-kpis strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}
.anna-living-grid {
  display: grid;
  grid-template-columns: minmax(430px, 0.8fr) minmax(680px, 1.6fr);
  gap: 12px;
  align-items: start;
}
.anna-monthly-wrap,
.anna-detail-wrap {
  max-height: min(50vh, 520px);
}
#annaMonthlyTable { min-width: 540px; }
#annaEntriesTable { min-width: 780px; }
.negative-amount { color: #b42318; }
.loan-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.loan-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
}
.loan-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.loan-kpis strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}
.loan-table-wrap {
  max-height: min(48vh, 520px);
}
.loan-repayment-wrap {
  max-height: min(30vh, 320px);
}
.loan-history-title {
  margin-top: 18px;
}
#loansTable {
  min-width: 1300px;
}
#loanRepaymentsTable {
  min-width: 900px;
}
#loansTable td:nth-child(2),
#loansTable td:nth-child(3),
#loansTable td:nth-child(11),
#loanRepaymentsTable td:nth-child(2),
#loanRepaymentsTable td:nth-child(3),
#loanRepaymentsTable td:nth-child(6) {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.rubber-recipe-strip,
.rubber-mixing-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.rubber-recipe-strip div,
.rubber-mixing-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f9fc;
}
.rubber-recipe-strip span,
.rubber-mixing-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.rubber-recipe-strip strong,
.rubber-mixing-kpis strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.rubber-mixing-form {
  display: grid;
  grid-template-columns: 150px 130px 150px minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.rubber-mixing-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.rubber-mixing-form input {
  width: 100%;
}
.rubber-grid {
  display: grid;
  grid-template-columns: minmax(720px, 1.35fr) minmax(420px, 0.65fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}
.rubber-material-wrap,
.rubber-supplier-wrap {
  max-height: min(48vh, 520px);
}
.rubber-record-wrap {
  max-height: min(34vh, 360px);
}
.rubber-material-table {
  min-width: 1280px;
}
.rubber-supplier-wrap table {
  min-width: 650px;
}
.rubber-record-wrap table {
  min-width: 860px;
}
.material-toolbar input {
  width: min(360px, 40vw);
}
.material-today-section {
  margin-top: 12px;
}
.material-today-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.inline-field input {
  width: 160px;
}
.material-today-wrap {
  max-height: 220px;
}
.material-daily-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 12px;
  align-items: start;
}
.material-daily-card {
  min-width: 0;
}
.material-daily-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.material-daily-card .sub-title {
  margin: 0;
}
.material-daily-total {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.material-daily-total strong {
  color: var(--text);
}
.material-today-table {
  table-layout: fixed;
  width: 100%;
}
.material-today-table th,
.material-today-table td {
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-today-table th:nth-child(1),
.material-today-table td:nth-child(1) { width: 120px; }
.material-today-table th:nth-child(4),
.material-today-table td:nth-child(4),
.material-today-table th:nth-child(5),
.material-today-table td:nth-child(5),
.material-today-table th:nth-child(6),
.material-today-table td:nth-child(6) { width: 120px; }
.material-payment-table th:nth-child(1),
.material-payment-table td:nth-child(1) { width: 120px; }
.material-payment-table th:nth-child(4),
.material-payment-table td:nth-child(4) { width: 130px; }
.material-month-section,
.material-reconcile-section {
  margin-top: 12px;
}
.material-month-section .sub-title,
.material-reconcile-section .sub-title {
  margin: 0 0 6px;
}
.material-month-wrap {
  max-height: 300px;
}
.material-month-payment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.material-month-payment-head .sub-title {
  margin: 0;
}
.material-month-payment-wrap {
  max-height: 240px;
}
.material-month-table {
  table-layout: fixed;
  width: 100%;
  min-width: 720px;
}
.material-month-payment-table {
  table-layout: fixed;
  width: 100%;
  min-width: 820px;
}
.material-month-purchase-table {
  table-layout: fixed;
  width: 100%;
  min-width: 900px;
}
.material-month-table th,
.material-month-table td,
.material-month-payment-table th,
.material-month-payment-table td,
.material-month-purchase-table th,
.material-month-purchase-table td {
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-month-table th:first-child,
.material-month-table td:first-child { width: 120px; }
.material-month-table th:nth-child(5),
.material-month-table td:nth-child(5),
.material-month-table th:nth-child(6),
.material-month-table td:nth-child(6) { width: 90px; }
.material-month-payment-table th:nth-child(1),
.material-month-payment-table td:nth-child(1),
.material-month-payment-table th:nth-child(6),
.material-month-payment-table td:nth-child(6) { width: 110px; }
.material-month-payment-table th:nth-child(3),
.material-month-payment-table td:nth-child(3) { width: 76px; }
.material-month-payment-table th:nth-child(4),
.material-month-payment-table td:nth-child(4) { width: auto; }
.material-month-payment-table th:nth-child(5),
.material-month-payment-table td:nth-child(5) { width: 130px; }
.material-month-purchase-table th:nth-child(1),
.material-month-purchase-table td:nth-child(1),
.material-month-purchase-table th:nth-child(7),
.material-month-purchase-table td:nth-child(7) { width: 110px; }
.material-month-purchase-table th:nth-child(4),
.material-month-purchase-table td:nth-child(4),
.material-month-purchase-table th:nth-child(5),
.material-month-purchase-table td:nth-child(5),
.material-month-purchase-table th:nth-child(6),
.material-month-purchase-table td:nth-child(6) { width: 118px; }
.material-supplier-month-wrap {
  max-height: 230px;
}
.material-month-detail-section {
  margin-top: 12px;
}
.material-reconcile-wrap {
  max-height: 280px;
}
.material-reconcile-table {
  table-layout: fixed;
  width: 100%;
  min-width: 920px;
}
.material-reconcile-table th,
.material-reconcile-table td {
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-reconcile-table th:nth-child(1),
.material-reconcile-table td:nth-child(1) { width: 170px; }
.material-reconcile-table th:nth-child(8),
.material-reconcile-table td:nth-child(8) { width: 92px; }
.material-reconcile-table th:nth-child(7),
.material-reconcile-table td:nth-child(7) { width: 70px; }
.warning-row td {
  background: #fff7ed;
}
.material-grid {
  display: grid;
  grid-template-columns: minmax(390px, 0.72fr) minmax(840px, 1.9fr);
  gap: 12px;
  align-items: start;
}
.material-summary-wrap,
.material-detail-wrap {
  max-height: calc(100vh - 330px);
}
.material-summary-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.material-summary-table th:nth-child(1),
.material-summary-table td:nth-child(1) { width: 105px; }
.material-summary-table th:nth-child(2),
.material-summary-table td:nth-child(2),
.material-summary-table th:nth-child(3),
.material-summary-table td:nth-child(3),
.material-summary-table th:nth-child(4),
.material-summary-table td:nth-child(4) { width: 92px; }
.material-summary-table th:nth-child(5),
.material-summary-table td:nth-child(5) { width: 58px; }
.material-summary-table td.actions {
  position: static;
  z-index: auto;
  min-width: 0;
  width: 58px;
  padding: 3px 4px;
  box-shadow: none;
  background: inherit;
}
.material-summary-table .material-summary-payment-btn {
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1;
}
.material-detail-table {
  table-layout: fixed;
  width: 100%;
  min-width: 848px;
}
.material-detail-table th,
.material-detail-table td {
  padding: 5px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.material-detail-table th:nth-child(1),
.material-detail-table td:nth-child(1) { width: 82px; }
.material-detail-table th:nth-child(2),
.material-detail-table td:nth-child(2) { width: 82px; }
.material-detail-table th:nth-child(3),
.material-detail-table td:nth-child(3) { width: 48px; }
.material-detail-table th:nth-child(4),
.material-detail-table td:nth-child(4) { width: 112px; }
.material-detail-table th:nth-child(5),
.material-detail-table td:nth-child(5),
.material-detail-table th:nth-child(6),
.material-detail-table td:nth-child(6) { width: 72px; }
.material-detail-table th:nth-child(7),
.material-detail-table td:nth-child(7),
.material-detail-table th:nth-child(8),
.material-detail-table td:nth-child(8),
.material-detail-table th:nth-child(9),
.material-detail-table td:nth-child(9) { width: 88px; }
.material-detail-table th:nth-child(10),
.material-detail-table td:nth-child(10) { width: 112px; }
.material-detail-table td.actions {
  min-width: 0;
  gap: 5px;
}
.material-detail-table td.actions button {
  min-width: 48px;
  padding: 0 8px;
}
.customer-sales-grid {
  grid-template-columns: minmax(620px, 0.95fr) minmax(840px, 1.75fr);
}
.customer-payment-form {
  display: grid;
  grid-template-columns: 180px minmax(240px, 1fr) 180px auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.customer-payment-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.customer-payment-form input {
  width: 100%;
  min-width: 0;
  font-weight: 400;
  color: var(--text);
}
.customer-payment-sync {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 12px;
  padding: 9px 10px;
  border: 1px solid #d7e3ef;
  border-radius: 7px;
  background: #f4f8fc;
}
.customer-payment-sync strong { display: block; font-size: 13px; }
.customer-payment-sync span { color: var(--muted); font-size: 12px; }
.account-payment-import {
  margin: -2px 0 14px;
  padding: 10px;
  border: 1px solid #c7dced;
  border-radius: 7px;
  background: #fbfdff;
}
.account-payment-import-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.account-payment-import-wrap { max-height: 210px; }
.account-payment-import-table { min-width: 640px; }
.account-payment-import-table th:nth-child(1) { width: 110px; }
.account-payment-import-table th:nth-child(3) { width: 120px; }
.account-payment-import-table th:nth-child(4) { width: 76px; }
.account-payment-import-table th:nth-child(5) { width: 90px; }
.account-payment-status-pending { color: var(--blue); font-weight: 700; }
.account-payment-status-existing { color: var(--muted); }
.account-payment-status-synced { color: var(--success); }
.customer-sales-summary-table th:nth-child(1),
.customer-sales-summary-table td:nth-child(1) { width: 180px; }
.customer-sales-summary-table th:nth-child(2),
.customer-sales-summary-table td:nth-child(2),
.customer-sales-summary-table th:nth-child(3),
.customer-sales-summary-table td:nth-child(3),
.customer-sales-summary-table th:nth-child(5),
.customer-sales-summary-table td:nth-child(5),
.customer-sales-summary-table th:nth-child(6),
.customer-sales-summary-table td:nth-child(6) { width: 94px; }
.customer-sales-summary-table th:nth-child(4),
.customer-sales-summary-table td:nth-child(4) { width: 72px; }
.customer-sales-detail-table {
  min-width: 840px;
}
.customer-sales-detail-table th:nth-child(1),
.customer-sales-detail-table td:nth-child(1) { width: 74px; }
.customer-sales-detail-table th:nth-child(2),
.customer-sales-detail-table td:nth-child(2) { width: 106px; }
.customer-sales-detail-table th:nth-child(3),
.customer-sales-detail-table td:nth-child(3) { width: 86px; }
.customer-sales-detail-table th:nth-child(4),
.customer-sales-detail-table td:nth-child(4) { width: 94px; }
.customer-sales-detail-table th:nth-child(5),
.customer-sales-detail-table td:nth-child(5) { width: 140px; }
.customer-sales-detail-table th:nth-child(6),
.customer-sales-detail-table td:nth-child(6) { width: 54px; }
.customer-sales-detail-table th:nth-child(7),
.customer-sales-detail-table td:nth-child(7) { width: 42px; }
.customer-sales-detail-table th:nth-child(8),
.customer-sales-detail-table td:nth-child(8) { width: 56px; }
.customer-sales-detail-table th:nth-child(9),
.customer-sales-detail-table td:nth-child(9),
.customer-sales-detail-table th:nth-child(10),
.customer-sales-detail-table td:nth-child(10) { width: 80px; }
.customer-payment-details-title { margin-top: 14px; }
.customer-payment-detail-wrap { max-height: 220px; }
.customer-payment-detail-table { min-width: 260px; }
.customer-payment-detail-table th:first-child,
.customer-payment-detail-table td:first-child { width: 120px; }
.customer-payment-detail-table th:last-child,
.customer-payment-detail-table td:last-child { width: 120px; }

.invoice-ledger-panel {
  padding: 16px 16px 18px;
}
.invoice-ledger-panel .material-head {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 8px;
}
.invoice-ledger-panel .panel-title {
  margin-bottom: 5px;
}
.invoice-summary-groups {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(260px, 0.75fr) minmax(320px, 0.95fr);
  gap: 14px;
  margin: 12px 0 16px;
}
.invoice-summary-groups > section {
  border: 1px solid #d7e2ee;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 12px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.summary-group-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 8px;
}
.invoice-summary-groups .invoice-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.invoice-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}
.invoice-kpis > div {
  border: 1px solid var(--line);
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  min-height: 74px;
  padding: 10px 12px;
  background: #f8fafc;
}
.invoice-kpis .kpi-group-invoice { border-left-color: #2563eb; }
.invoice-kpis .kpi-group-payment { border-left-color: #059669; }
.invoice-kpis .kpi-group-tax { border-left-color: #d97706; }
.invoice-kpis .kpi-emphasis { background: #fff7ed; }
.invoice-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.invoice-kpis strong {
  font-size: 20px;
  line-height: 1.15;
}
.invoice-import-result {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.invoice-import-result > div {
  border: 1px solid #c7dced;
  border-radius: 7px;
  background: #f8fbff;
  padding: 8px 10px;
}
.invoice-import-result span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.invoice-import-result strong {
  font-size: 16px;
}
.action-menu {
  position: relative;
}
.action-menu > summary {
  list-style: none;
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: #eef3f8;
  color: var(--text);
  font-weight: 700;
  user-select: none;
}
.action-menu > summary::-webkit-details-marker {
  display: none;
}
.action-menu[open] > summary {
  background: #dbeafe;
}
.action-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: grid;
  gap: 6px;
  min-width: 170px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}
.action-menu > div button {
  width: 100%;
  justify-content: flex-start;
  background: #f3f6f9;
  color: var(--text);
}
.invoice-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(300px, 480px) 1fr;
  gap: 12px;
  align-items: end;
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #d7e2ee;
  border-radius: 10px;
  background: #f8fbff;
}
.invoice-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.invoice-toolbar select,
.invoice-toolbar input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}
.invoice-input-summary-panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}
.invoice-input-summary-panel > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
}
.invoice-input-summary-panel > summary::-webkit-details-marker {
  display: none;
}
.invoice-input-summary-panel > summary small {
  color: var(--muted);
  font-weight: 700;
}
.invoice-input-summary-panel[open] > summary {
  border-bottom: 1px solid var(--line);
  background: #f1f6fb;
}
.invoice-input-summary-wrap {
  max-height: 220px;
  margin: 0;
}
.invoice-input-summary-table {
  table-layout: fixed;
  width: 100%;
  min-width: 620px;
}
.invoice-input-summary-table th:first-child,
.invoice-input-summary-table td:first-child { width: 44%; }
.invoice-input-summary-table th:not(:first-child),
.invoice-input-summary-table td:not(:first-child) { width: 18.5%; }
.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.salary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.salary-controls {
  display: grid;
  grid-template-columns: 220px minmax(260px, 420px);
  gap: 12px;
  margin: 12px 0;
}
.salary-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}
.salary-controls input,
.salary-controls select {
  width: 100%;
}
.salary-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}
.salary-kpis div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}
.salary-kpis span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.salary-kpis strong {
  font-size: 22px;
  color: var(--text);
}
.salary-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(0, 1.7fr);
  gap: 14px;
  align-items: start;
}
.salary-panel-section {
  min-width: 0;
}
.salary-monthly-wrap {
  max-height: 520px;
  overflow: auto;
}
.salary-detail-wrap {
  max-height: 560px;
  overflow: auto;
}
.salary-detail-table {
  min-width: 1180px;
}
.salary-month-row {
  cursor: pointer;
}
.salary-month-row.active td {
  background: #e8f1fb;
  font-weight: 700;
}
.invoice-file-status {
  margin: 6px 0 10px;
}
.invoice-unmatched-panel {
  margin: -4px 0 16px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  overflow: hidden;
}
.invoice-unmatched-panel > button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 0;
  padding: 10px 12px;
  background: transparent;
  color: #991b1b;
  font-weight: 800;
  text-align: left;
}
.invoice-unmatched-panel > button strong {
  color: #b42318;
}
.invoice-unmatched-wrap {
  max-height: 220px;
  margin: 0;
  border-top: 1px solid #fecaca;
}
.inline-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.invoice-ledger-grid {
  display: grid;
  grid-template-columns: minmax(500px, 0.98fr) 12px minmax(620px, 1.22fr);
  gap: 12px;
  align-items: start;
}
.invoice-reconciliation-panel,
.invoice-detail-panel {
  min-width: 0;
  border: 1px solid #d7e2ee;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.split-resizer {
  align-self: stretch;
  width: 10px;
  min-height: 260px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
  position: relative;
}
.split-resizer::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: #d8e2ec;
}
.split-resizer:hover::before,
.split-resizer:focus-visible::before,
body.resizing-invoice-ledger .split-resizer::before {
  background: var(--blue);
}
body.resizing-invoice-ledger {
  cursor: col-resize;
  user-select: none;
}
.invoice-reconciliation-wrap { max-height: min(620px, calc(100vh - 360px)); }
.invoice-details-wrap { max-height: min(500px, calc(100vh - 390px)); }
.invoice-reconciliation-table,
.invoice-details-table { table-layout: fixed; width: 100%; }
.invoice-reconciliation-table { min-width: 620px; }
.invoice-reconciliation-table th:first-child,
.invoice-reconciliation-table td:first-child { width: 250px; }
.invoice-reconciliation-table th:not(:first-child),
.invoice-reconciliation-table td:not(:first-child) { width: 88px; }
.invoice-reconciliation-table th:last-child,
.invoice-reconciliation-table td:last-child { width: 90px; }
.invoice-details-table { min-width: 1000px; }
.invoice-details-table th,
.invoice-details-table td { overflow: hidden; text-overflow: ellipsis; }
.invoice-details-table th:nth-child(1), .invoice-details-table td:nth-child(1) { width: 52px; }
.invoice-details-table th:nth-child(2), .invoice-details-table td:nth-child(2) { width: 82px; }
.invoice-details-table th:nth-child(3), .invoice-details-table td:nth-child(3) { width: 148px; }
.invoice-details-table th:nth-child(4), .invoice-details-table td:nth-child(4),
.invoice-details-table th:nth-child(5), .invoice-details-table td:nth-child(5) { width: 168px; }
.invoice-details-table th:nth-child(6), .invoice-details-table td:nth-child(6),
.invoice-details-table th:nth-child(7), .invoice-details-table td:nth-child(7),
.invoice-details-table th:nth-child(8), .invoice-details-table td:nth-child(8),
.invoice-details-table th:nth-child(9), .invoice-details-table td:nth-child(9),
.invoice-details-table th:nth-child(10), .invoice-details-table td:nth-child(10) { width: 92px; }
.invoice-payment-row td {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}
.invoice-payment-row td:first-child {
  color: var(--blue);
  font-weight: 700;
}
.invoice-detail-split {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
}
.invoice-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.invoice-detail-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}
.invoice-detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.invoice-detail-summary strong {
  font-size: 16px;
}
.invoice-detail-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7e2ee;
  border-radius: 10px;
  background: #fbfdff;
}
.invoice-detail-block .table-wrap {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.mini-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #d7e2ee;
  background: #eef5fb;
}
.invoice-simple-table {
  min-width: 220px;
  table-layout: fixed;
  width: 100%;
  font-size: 12px;
}
.invoice-simple-table th,
.invoice-simple-table td {
  padding: 7px 8px;
  white-space: nowrap;
}
.invoice-simple-table th:first-child,
.invoice-simple-table td:first-child { width: 86px; }
.invoice-simple-table th:last-child,
.invoice-simple-table td:last-child { width: 92px; }
.invoice-simple-table th:nth-child(3),
.invoice-simple-table td:nth-child(3) {
  width: 74px;
  text-align: center;
}
.invoice-simple-table .summary-row td {
  background: #eef5fb;
  font-weight: 800;
}
.invoice-source-link {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}
.invoice-payment-unit {
  white-space: nowrap;
}
.invoice-match-panel { margin-top: 16px; }
.invoice-match-wrap,
.invoice-issue-wrap {
  max-height: 320px;
  overflow: auto;
}
.invoice-match-table { min-width: 1380px; }
.invoice-warning { color: #b42318; font-weight: 700; }
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-success {
  color: #047857;
  background: #d1fae5;
}
.status-partial {
  color: #92400e;
  background: #fef3c7;
}
.status-danger {
  color: #b42318;
  background: #fee2e2;
}
.status-warning {
  color: #9a3412;
  background: #ffedd5;
}
.status-neutral {
  color: #475569;
  background: #e2e8f0;
}

.entry-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.entry-table input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 4px 6px;
  background: transparent;
}
.entry-table input:focus {
  outline: 2px solid #9cc3e6;
  background: #fff;
}
.entry-table th,
.entry-table td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#salesEntryTable th:nth-child(1), #salesEntryTable td:nth-child(1) { width: 110px; }
#salesEntryTable th:nth-child(2), #salesEntryTable td:nth-child(2) { width: 105px; }
#salesEntryTable th:nth-child(3), #salesEntryTable td:nth-child(3) { width: 185px; }
#salesEntryTable th:nth-child(4), #salesEntryTable td:nth-child(4) { width: 68px; }
#salesEntryTable th:nth-child(5), #salesEntryTable td:nth-child(5) { width: 46px; }
#salesEntryTable th:nth-child(6), #salesEntryTable td:nth-child(6) { width: 60px; }
#salesEntryTable th:nth-child(7), #salesEntryTable td:nth-child(7),
#salesEntryTable th:nth-child(8), #salesEntryTable td:nth-child(8),
#salesEntryTable th:nth-child(9), #salesEntryTable td:nth-child(9) { width: 76px; }
#salesEntryTable th:nth-child(10), #salesEntryTable td:nth-child(10),
#salesEntryTable th:nth-child(11), #salesEntryTable td:nth-child(11) { width: 86px; }
#salesEntryTable th:nth-child(12), #salesEntryTable td:nth-child(12) { width: 76px; }
#salesEntryTable th:nth-child(13), #salesEntryTable td:nth-child(13) { width: 66px; }

#inboundEntryTable th:nth-child(1), #inboundEntryTable td:nth-child(1) { width: 110px; }
#inboundEntryTable th:nth-child(2), #inboundEntryTable td:nth-child(2) { width: 120px; }
#inboundEntryTable th:nth-child(3), #inboundEntryTable td:nth-child(3) { width: 220px; }
#inboundEntryTable th:nth-child(4), #inboundEntryTable td:nth-child(4) { width: 70px; }
#inboundEntryTable th:nth-child(5), #inboundEntryTable td:nth-child(5) { width: 50px; }
#inboundEntryTable th:nth-child(6), #inboundEntryTable td:nth-child(6) { width: 70px; }
#inboundEntryTable th:nth-child(7), #inboundEntryTable td:nth-child(7),
#inboundEntryTable th:nth-child(8), #inboundEntryTable td:nth-child(8) { width: 90px; }
#inboundEntryTable th:nth-child(9), #inboundEntryTable td:nth-child(9) { width: 90px; }
#inboundEntryTable th:nth-child(10), #inboundEntryTable td:nth-child(10) { width: 70px; }

#productsTable {
  table-layout: fixed;
  width: 100%;
  min-width: 1420px;
}
#productsTable th,
#productsTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}
#productsTable th:nth-child(1), #productsTable td:nth-child(1) { width: 105px; }
#productsTable th:nth-child(2), #productsTable td:nth-child(2) { width: 110px; }
#productsTable th:nth-child(3), #productsTable td:nth-child(3) { width: 230px; }
#productsTable th:nth-child(4), #productsTable td:nth-child(4) { width: 70px; }
#productsTable th:nth-child(5), #productsTable td:nth-child(5) { width: 48px; }
#productsTable th:nth-child(6), #productsTable td:nth-child(6),
#productsTable th:nth-child(7), #productsTable td:nth-child(7),
#productsTable th:nth-child(8), #productsTable td:nth-child(8),
#productsTable th:nth-child(9), #productsTable td:nth-child(9) { width: 78px; }
#productsTable th:nth-child(10), #productsTable td:nth-child(10) { width: 95px; }
#productsTable th:nth-child(11), #productsTable td:nth-child(11) { width: 105px; }
#productsTable th:nth-child(12), #productsTable td:nth-child(12),
#productsTable th:nth-child(13), #productsTable td:nth-child(13) { width: 72px; }
#productsTable th:nth-child(14), #productsTable td:nth-child(14) { width: 130px; }

.freight-panel {
  max-width: 1480px;
}
.freight-model-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #b8d7c8;
  border-radius: 999px;
  background: #eef9f3;
  color: #176b45;
  font-size: 12px;
  font-weight: 800;
}
.freight-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
}
.freight-kpis > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: #f7f9fc;
}
.freight-kpis span,
.freight-result-range span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}
.freight-kpis strong {
  display: block;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}
.freight-predict-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
  gap: 14px;
  align-items: stretch;
}
.freight-predict-form,
.freight-result {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  min-width: 0;
}
.freight-predict-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  background: #fff;
}
.freight-predict-form .sub-title,
.freight-predict-form .freight-check,
.freight-predict-form button,
.freight-predict-form p {
  grid-column: 1 / -1;
}
.freight-predict-form label,
.freight-record-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.freight-predict-form input,
.freight-predict-form select,
.freight-record-form input,
.freight-record-form select {
  width: 100%;
}
.freight-predict-form .freight-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.freight-check input {
  width: auto;
  min-width: 0;
}
.freight-result {
  background: linear-gradient(145deg, #eef5fb, #f8fbfd);
  border-color: #bdd2e4;
  display: grid;
  align-content: center;
  gap: 14px;
}
.freight-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.freight-result-head > div > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.freight-result-head > div > strong {
  display: block;
  color: var(--primary);
  font-size: clamp(30px, 4vw, 46px);
  font-variant-numeric: tabular-nums;
}
.freight-confidence {
  padding: 6px 10px;
  border-radius: 999px;
  background: #dff3e8;
  color: #176b45;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.freight-confidence.low {
  background: #fff1d6;
  color: #9a6700;
}
.freight-result-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.freight-result-range > div {
  border: 1px solid #cfdeeb;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
}
.freight-result-range strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.freight-method {
  margin: 0;
  color: #34516e;
  font-size: 13px;
  font-weight: 700;
}
.freight-warnings {
  display: grid;
  gap: 5px;
  color: #8a5b00;
  font-size: 12px;
}
.freight-warnings p {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid #f2d28b;
  border-radius: 6px;
  background: #fffaf0;
}
.freight-reference-section,
.freight-history-section {
  margin-top: 16px;
}
.freight-reference-wrap {
  max-height: 260px;
}
.freight-reference-wrap table {
  min-width: 850px;
}
.freight-add-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.freight-add-panel summary {
  padding: 12px 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.freight-record-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 0 14px 12px;
}
.freight-record-form button {
  min-height: 36px;
}
#freightRecordStatus {
  margin: 0;
  padding: 0 14px 12px;
}
.freight-history-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.freight-history-head p {
  margin: 3px 0 0;
}
.freight-history-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.freight-history-wrap {
  max-height: min(48vh, 520px);
}
.freight-history-table {
  min-width: 960px;
}
.freight-history-table .source-inquiry {
  color: #9a6700;
  font-weight: 800;
}
.freight-history-table .special-note {
  color: #8a4b0f;
}

@media (max-width: 1180px) {
  .dashboard-overview,
  .dashboard-grid,
  .sales-stat-grid,
  .material-grid,
  .material-daily-grid,
  .weight-project-grid,
  .customer-sales-grid {
    grid-template-columns: 1fr;
  }
  .freight-predict-grid {
    grid-template-columns: 1fr;
  }
  .freight-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .freight-record-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .invoice-ledger-grid { grid-template-columns: 1fr !important; }
  .split-resizer { display: none; }
  .invoice-summary-groups { grid-template-columns: 1fr; }
  .invoice-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-import-result { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .invoice-toolbar { grid-template-columns: 1fr; }
  .risk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .material-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .anna-living-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .personal-finance-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asset-inventory-hero {
    flex-direction: column;
  }
  .asset-inventory-total {
    min-width: 0;
    text-align: left;
  }
  .asset-inventory-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asset-inventory-grid,
  .asset-inventory-grid.three-column {
    grid-template-columns: 1fr;
  }
  .repayment-record-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .anna-living-grid {
    grid-template-columns: 1fr;
  }
  .anna-living-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .anna-living-form button {
    grid-column: 1 / -1;
  }
  .loan-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-payment-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .customer-payment-form button {
    grid-column: 1 / -1;
  }
  .material-summary-wrap,
  .material-detail-wrap {
    max-height: min(420px, calc(100vh - 280px));
  }
  .customer-sales-summary-table,
  .material-summary-table {
    min-width: 520px;
  }
}

@media (max-width: 1520px) {
  .customer-sales-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-sales-summary-table {
    min-width: 620px;
  }
}

@media (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
  }
  body {
    overflow-x: hidden;
  }
  .app {
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 10px 8px;
    scrollbar-width: thin;
  }
  .nav-group-title { display: none; }
  .brand { display: none; }
  .nav {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    margin-bottom: 0;
    padding: 8px 10px;
    font-size: 14px;
  }
  .stock-nav { padding-left: 10px; }
  .freight-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .freight-predict-form,
  .freight-record-form,
  .freight-result-range {
    grid-template-columns: 1fr;
  }
  .freight-predict-form label,
  .freight-record-form label,
  .freight-record-form button {
    grid-column: 1 / -1;
  }
  .freight-history-head {
    align-items: stretch;
    flex-direction: column;
  }
  .freight-history-filters {
    justify-content: stretch;
  }
  .freight-history-filters input,
  .freight-history-filters select {
    width: 100%;
  }
  .workspace {
    min-width: 0;
    max-width: 100vw;
  }
  .topbar {
    height: auto;
    min-height: 52px;
    padding: 10px 12px;
    gap: 8px;
    align-items: flex-start;
  }
  .topbar > div {
    min-width: 0;
  }
  #viewTitle {
    display: block;
    font-size: 16px;
  }
  #userBadge {
    display: block;
    margin: 4px 0 0;
    font-size: 12px;
  }
  #logoutBtn {
    flex: 0 0 auto;
  }
  .view {
    padding: 10px;
    overflow: hidden;
  }
  .dashboard-overview,
  .dashboard-grid,
  .sales-stat-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .dashboard-summary-card,
  .dashboard-panel {
    padding: 10px;
  }
  .dashboard-summary-head,
  .sales-stats-head,
  .stock-detail-head,
  .material-head {
    display: block;
  }
  .annual-sales-card {
    min-width: 0;
    margin-top: 10px;
    text-align: left;
  }
  .annual-sales-card strong {
    font-size: 22px;
  }
  .kpis,
  .risk-kpis,
  .material-kpis,
  .anna-living-kpis,
  .repayment-record-kpis,
  .loan-kpis,
  .weight-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .kpi {
    min-height: 78px;
    padding: 10px;
  }
  .kpi strong {
    font-size: 20px;
    overflow-wrap: anywhere;
  }
  .toolbar {
    align-items: stretch;
    gap: 8px;
  }
  .toolbar button,
  .toolbar input,
  .toolbar select {
    min-width: 0;
  }
  .toolbar button {
    flex: 1 1 auto;
  }
  .toolbar input,
  .toolbar select {
    flex: 1 1 180px;
    width: 100%;
  }
  .order-total,
  .detail-summary {
    flex: 1 0 100%;
    margin-left: 0;
  }
  .detail-summary span {
    flex: 1 1 150px;
  }
  .table-wrap,
  .stock-table-wrap,
  .order-table-wrap {
    max-height: min(68dvh, calc(100dvh - 210px));
  }
  .table-wrap {
    width: 100%;
  }
  th, td {
    height: 32px;
  }
  td.actions,
  .sales-actions-cell {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #fff;
    box-shadow: -1px 0 0 var(--line);
  }
  th:last-child {
    position: sticky;
    right: 0;
    z-index: 3;
    box-shadow: -1px 0 0 var(--line);
  }
  td.actions,
  .sales-actions,
  .sales-actions-cell {
    gap: 5px;
  }
  td.actions button,
  .sales-actions button {
    min-width: 54px;
    padding: 0 8px;
  }
  .category-stack {
    max-height: none;
  }
  .stock-detail-summary {
    justify-content: flex-start;
    margin-top: 10px;
  }
  .stock-detail-summary span {
    flex: 1 1 150px;
  }
  .fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .order-head {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
    gap: 8px;
  }
  .order-head label,
  .fields label,
  .login-panel label {
    min-width: 0;
  }
  .order-head input,
  .order-head select,
  .fields input,
  .fields select,
  .login-panel input {
    min-width: 0;
    width: 100%;
  }
  .material-toolbar input,
  .material-toolbar select {
    width: 100%;
  }
  .material-panel {
    padding: 10px;
  }
  .material-grid,
  .material-daily-grid,
  .weight-project-grid,
  .customer-sales-grid,
  .salary-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .salary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .salary-controls {
    grid-template-columns: minmax(0, 1fr);
  }
  .material-summary-wrap,
  .material-detail-wrap {
    max-height: min(48dvh, 420px);
  }
  .picker-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .picker-tools {
    flex-wrap: wrap;
  }
  .picker-tools input {
    flex-basis: 100%;
    min-width: 0;
  }
  dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }
  .detail-dialog-table {
    max-height: calc(100dvh - 150px);
  }
  .detail-dialog-table table {
    min-width: 980px;
  }
  #editForm,
  .picker-dialog form,
  .detail-dialog form {
    padding: 12px;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
  .dialog-actions button {
    flex: 1 1 120px;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 8px;
  }
  .nav {
    padding: 7px 9px;
    font-size: 13px;
  }
  .topbar {
    padding: 8px 10px;
  }
  .view {
    padding: 8px;
  }
  .kpis,
  .invoice-summary-groups .invoice-kpis,
  .invoice-import-result,
  .invoice-detail-summary,
  .invoice-detail-split,
  .material-kpis,
  .personal-finance-summary,
  .asset-inventory-kpis,
  .asset-inventory-grid,
  .asset-inventory-grid.three-column,
  .anna-living-kpis,
  .repayment-record-kpis,
  .loan-kpis,
  .weight-kpis,
  .weight-mini-kpis,
  .salary-kpis,
  .salary-controls,
  .customer-payment-form,
  .anna-living-form,
  .order-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .customer-payment-form button {
    grid-column: auto;
  }
  .asset-inventory-hero {
    padding: 16px;
  }
  .asset-inventory-hero h3 {
    font-size: 24px;
  }
  .asset-inventory-total strong {
    font-size: 22px;
  }
  .toolbar button {
    flex-basis: calc(50% - 6px);
    padding: 8px 10px;
  }
  .order-total {
    line-height: 1.8;
  }
  .table-wrap,
  .stock-table-wrap,
  .order-table-wrap {
    max-height: min(64dvh, calc(100dvh - 230px));
  }
  .compact-table,
  table {
    font-size: 12px;
  }
  th, td {
    padding: 6px;
  }
  td.actions button,
  .sales-actions button {
    min-width: 50px;
    font-size: 12px;
  }
  .sales-actions-cell {
    min-width: 220px;
  }
  .login-panel {
    padding: 18px;
  }
}
