:root {
  --bg: #f5f7f8;
  --panel: #fff;
  --ink: #17212f;
  --muted: #667587;
  --line: #d9e1ea;
  --brand: #176b5d;
  --brand-soft: #e9f3f1;
  --blue: #2563a8;
  --warn: #b45309;
  --danger: #b42318;
  --radius: 8px;
}

.location-picker { display: grid; gap: 4px; color: var(--brand); font-size: 12px; font-weight: 700; }
.location-picker select { min-width: 165px; max-width: 240px; border: 2px solid var(--brand); border-radius: 8px; padding: 7px 10px; background: var(--brand-soft); color: var(--ink); }
.location-context { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 14px 16px; background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 8px; margin-bottom: 14px; }
.location-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.location-editor { border: 2px solid var(--brand); margin-bottom: 16px; }
.location-lines { display: grid; gap: 12px; }
.location-line { display: grid; grid-template-columns: minmax(160px, 1fr) 130px auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.location-line input, .location-line select, .location-editor input, .location-editor textarea { min-width: 0; max-width: 100%; }
.location-fixed { align-self: center; font-weight: 700; color: var(--brand); }
.location-stock-table small, .location-sale-stock small { display: block; margin-top: 5px; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 620px; }
.location-documents { display: grid; gap: 16px; }
.location-document { padding: 15px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }
.location-sale-stock { grid-column: 1 / -1; padding: 8px 12px; color: var(--brand); background: var(--brand-soft); border-radius: 6px; }
@media (max-width: 680px) {
  .location-picker { width: 100%; }
  .location-picker select { max-width: 100%; width: 100%; }
  .location-line { grid-template-columns: 1fr auto; }
  .location-line label:first-child { grid-column: 1 / -1; }
  .location-tabs .btn { flex: 1 0 40%; }
  .location-editor .panel-title { flex-wrap: wrap; }
  .location-context { flex-direction: column; }
  .location-stock-table { min-width: 640px; }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 18px 42px rgba(17, 24, 39, .08);
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  padding: 12px 18px;
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 15px;
}

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

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

.offline-mode-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #b42318;
  border-radius: 6px;
  background: #fff1f0;
  padding: 4px 9px;
  color: #8a1c13;
  font-size: 12px;
  font-weight: 800;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef3f6;
  padding: 2px;
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.segmented button.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(17, 24, 39, .08);
  font-weight: 750;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  max-width: 1360px;
  margin: 0 auto;
}

.side {
  position: sticky;
  top: 61px;
  height: calc(100vh - 61px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 14px 10px;
}

.side-title {
  margin: 8px 10px 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.nav button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.nav button.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 750;
}

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

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.grid > * {
  min-width: 0;
}

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

.management-layout {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 12px;
}

.management-layout > * {
  min-width: 0;
}

.entity-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.entity-table-scroll table {
  margin: 0;
}

.salesperson-summary-table {
  min-width: 940px;
}

.salesperson-category-metric {
  display: grid;
  min-width: 150px;
  gap: 3px;
}

.salesperson-category-metric strong {
  white-space: nowrap;
}

.salesperson-category-metric small {
  color: var(--muted);
  white-space: nowrap;
}

.user-access-layout {
  grid-template-columns: minmax(290px, 320px) minmax(0, 1fr);
}

.user-access-editor {
  min-width: 300px;
  gap: 6px;
}

.user-account-table {
  min-width: 740px;
}

.user-account-table th:nth-child(1) {
  width: 18%;
}

.user-account-table th:nth-child(2) {
  width: 17%;
}

.user-account-table th:nth-child(3) {
  width: 45%;
}

.user-account-table th:nth-child(4),
.user-account-table th:nth-child(5) {
  width: 10%;
}

.user-account-actions {
  margin: 0;
  flex-direction: column;
  align-items: stretch;
}

.special-price-audit-scroll {
  width: 100%;
  height: 240px;
  min-height: 150px;
  max-height: 60vh;
  overflow: auto;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.special-price-audit-scroll table {
  min-width: 1040px;
  margin: 0;
}

.special-price-audit-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.product-price-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  gap: 3px 12px;
  min-width: 280px;
  font-size: 12px;
  line-height: 1.35;
}

.product-price-list span {
  white-space: nowrap;
}

.contract-list-table table {
  min-width: 1040px;
}

.customer-list-table table {
  min-width: 820px;
}

.contract-list-table th:last-child,
.contract-list-table td:last-child {
  min-width: 230px;
}

.customer-list-table th:last-child,
.customer-list-table td:last-child {
  min-width: 96px;
}

.contract-list-table th:last-child,
.contract-list-table td:last-child,
.customer-list-table th:last-child,
.customer-list-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.contract-list-table th:last-child,
.customer-list-table th:last-child {
  z-index: 2;
  background: #fafbfd;
}

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

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

.panel,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel {
  padding: 14px;
}

.card {
  padding: 14px;
}

.customer-box {
  margin-bottom: 12px;
  background: #fbfdfc;
}

.contract-summary {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #bdd7cd;
  border-radius: var(--radius);
  background: #f3fbf7;
  color: var(--text);
  font-size: 13px;
}

.contract-summary strong {
  font-size: 14px;
}

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

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

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

.valuation-metrics,
.valuation-actions-panel,
.cost-warning-panel {
  margin-bottom: 12px;
}

.petty-cash-metrics {
  margin-bottom: 12px;
}

.petty-cash-closing {
  border-left: 4px solid var(--brand);
  background: #f3fbf7;
}

.valuation-actions-panel .form {
  margin-bottom: 12px;
}

.valuation-category-table {
  margin-top: 4px;
}

.valuation-snapshot-history {
  margin-top: 14px;
}

.valuation-snapshot-history > strong {
  display: block;
  margin-bottom: 8px;
}

.inbound-history-filters {
  margin-bottom: 14px;
}

.inbound-history-filter-actions {
  grid-column: 1 / -1;
  margin: 0;
}

.inbound-history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 2px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.inbound-summary-item {
  min-width: 0;
  padding: 12px 14px;
}

.inbound-summary-item + .inbound-summary-item {
  border-left: 1px solid var(--line);
}

.inbound-summary-item strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.inbound-history-table {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.inbound-history-table table {
  min-width: 1180px;
}

.inbound-history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.danger-text {
  color: var(--danger) !important;
}

.dashboard-total-metric {
  margin-bottom: 12px;
  padding: 18px 20px;
  border-left: 4px solid var(--brand);
}

.dashboard-total-metric strong {
  font-size: 34px;
}

.dashboard-payment-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 18px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dashboard-payment-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
}

.dashboard-payment-breakdown b {
  color: var(--muted);
  font-weight: 600;
}

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

.dashboard-date-actions {
  align-items: flex-end;
}

.dashboard-date-field {
  min-width: 154px;
  font-size: 12px;
}

.dashboard-date-field input {
  min-height: 38px;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  height: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.product-tool-tabs {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.bulk-selection-status {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: flex-end;
}

.compact-actions {
  margin: 0;
}

.bulk-product-table {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bulk-product-table table {
  min-width: 860px;
}

.bulk-product-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.bulk-check-column {
  width: 42px;
  text-align: center;
}

.bulk-product-check {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.btn,
.tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
}

.btn.primary,
.tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.btn.danger {
  border-color: #f2b8b5;
  color: var(--danger);
}

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

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

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

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

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

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

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

label.inline-check {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  align-self: end;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

label.inline-check input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.inline-field {
  min-width: 160px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

input[readonly] {
  background: #f3f6f8;
  color: var(--muted);
}

textarea {
  min-height: 74px;
  resize: vertical;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  background: #fafbfd;
  color: var(--muted);
}

tfoot th {
  border-top: 2px solid var(--line);
  background: var(--brand-soft);
  color: var(--ink);
  font-weight: 800;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.tag.warn {
  background: #fff7ed;
  color: var(--warn);
}

.tag.danger {
  background: #fff1f0;
  color: var(--danger);
}

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

.compact {
  margin: 4px 0 0;
  font-size: 12px;
}

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

.sale-line {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.sale-line.service-line {
  background: #fbfdfc;
  border-color: #b7d5ce;
}

.sale-line.custom-line {
  background: #fffdf7;
  border-color: #e4c56a;
}

.sale-live-line-amount { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-width: 0; padding: 9px 12px; border-radius: 8px; background: #f0f7f5; color: var(--primary); }
.sale-live-line-amount output { font-weight: 700; overflow-wrap: anywhere; }
.sale-live-summary { margin-top: 16px; min-width: 0; }
.sale-live-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.sale-live-group { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.sale-live-group span, .sale-live-group output { overflow-wrap: anywhere; }
.sale-live-group output { font-weight: 700; }
.sale-live-total { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; min-width: 0; padding: 16px; border: 1px solid #b7d5ce; border-radius: var(--radius); background: #e8f3f0; color: var(--primary); }
.sale-live-total > div { flex: 1 1 220px; min-width: 0; }
.sale-live-total small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; }
.sale-live-total > output { max-width: 100%; font-size: 28px; font-weight: 750; overflow-wrap: anywhere; }
@media (max-width: 700px) { .sale-live-groups { grid-template-columns: minmax(0, 1fr); } .sale-live-total > output { font-size: 24px; } }

.sale-product-picker { position: relative; grid-column: span 2; min-width: 0; }
.sale-product-picker > label { display: grid; gap: 6px; }
.sale-product-picker > small { display: block; margin-top: 6px; color: var(--muted); overflow-wrap: anywhere; }
.sale-product-results { position: absolute; z-index: 30; top: 66px; left: 0; width: 100%; max-height: 320px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 8px 24px #173f3320; }
.sale-product-results[hidden] { display: none; }
.sale-product-choice { display: grid; gap: 4px; width: 100%; padding: 10px; border: 0; border-radius: 6px; text-align: left; background: #fff; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.sale-product-choice:hover, .sale-product-choice.is-active { background: #e8f3f0; }
.sale-product-choice small { color: var(--muted); }
.sales-commission-basis { margin-top: 12px; padding: 12px; background: #f4f9f7; border: 1px solid var(--line); border-radius: 10px; }
.sales-commission-basis summary { cursor: pointer; color: var(--primary); font-weight: 600; }
@media (max-width: 760px) { .sale-product-picker { grid-column: 1 / -1; } }

.timber-conversion {
  grid-column: 1 / -1;
  padding: 10px 12px;
  background: var(--soft, #edf6f3);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.timber-editor {
  margin-bottom: 16px;
  border-color: #8fbeb0;
  scroll-margin-top: 20px;
}

.edge-suggestions {
  grid-column: 1 / -1;
}

.edge-suggestion-title {
  margin: 2px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.edge-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
  padding: 8px;
}

.edge-suggestion-item strong,
.edge-suggestion-item span,
.edge-suggestion-item small {
  display: block;
}

.edge-suggestion-item span,
.edge-suggestion-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  max-width: 420px;
  border: 1px solid #b7d5ce;
  border-radius: var(--radius);
  background: #fff;
  color: var(--brand);
  box-shadow: 0 12px 28px rgba(17, 24, 39, .12);
  padding: 10px 12px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(23, 33, 47, .48);
  padding: 20px;
}

.modal-card {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(17, 24, 39, .24);
  padding: 18px;
}

.modal-card .panel-title {
  align-items: flex-start;
}

.modal-card .panel-title p {
  max-width: 520px;
  margin: 5px 0 0;
}

.balance-payment-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.balance-payment-summary span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafb;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 12px;
}

.balance-payment-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
}

.balance-payment-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  padding: 10px 12px;
  color: var(--brand);
}

.form-error {
  margin: 0;
  border: 1px solid #f2b8b5;
  border-radius: var(--radius);
  background: #fff1f0;
  color: var(--danger);
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 700;
}

.modal-actions {
  justify-content: flex-end;
}

.mobile-switch {
  display: none;
}

.employee-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 2fr);
  gap: 14px;
  align-items: start;
}

.employee-list-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 110px);
  overflow: hidden;
}

.employee-search {
  width: 100%;
  margin-bottom: 10px;
}

.employee-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 215px);
  overflow-y: auto;
  padding-right: 3px;
}

.employee-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.employee-card > .tag {
  grid-column: 2;
  justify-self: start;
}

.employee-card:hover,
.employee-card.selected {
  border-color: var(--brand);
  background: #f0f8f6;
}

.employee-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.employee-card-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.employee-card-main strong,
.employee-card-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-card-main small {
  color: var(--muted);
}

.employee-editor-head {
  align-items: flex-start;
  gap: 12px;
}

.employee-editor-head > div:first-child {
  display: grid;
  gap: 3px;
}

.employee-editor-head small {
  color: var(--muted);
}

.employee-info-form {
  gap: 12px;
}

.employee-contract-actions { margin: 0; flex-wrap: wrap; }
.employee-contract-error { color: #9f2922; background: #fff1ef; border: 1px solid #edc6c0; padding: 12px; border-radius: 10px; white-space: pre-wrap; }
.employee-contract-extra { margin: 12px 0; }
.employee-contract-extra summary { cursor: pointer; color: var(--brand); margin-bottom: 12px; }
.employee-contract-bonuses { margin-top: 16px; }
.employee-document-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.employee-document-row small { display: block; color: var(--muted); margin-top: 4px; }
.employee-card[hidden] { display: none; }

.employee-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.employee-section-title {
  margin-bottom: 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.employee-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.cash-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.cash-control-card {
  border-top: 3px solid var(--brand);
}

.owner-withdrawal-card {
  border-top-color: #b7791f;
}

.debt-payment-history {
  margin-top: 5px;
  min-width: 165px;
}

.debt-payment-history summary {
  color: var(--brand);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.debt-payment-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 3px 7px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.debt-payment-row strong {
  text-align: right;
}

.debt-payment-row small {
  grid-column: 1 / -1;
}

.cash-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.cash-status-strip span {
  display: grid;
  gap: 4px;
  padding: 9px;
  border-radius: 10px;
  background: #f2f6f7;
  color: var(--muted);
  font-size: 11px;
}

.cash-status-strip strong {
  color: var(--ink);
  font-size: 14px;
}

.cash-collection-link {
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cash-collection-link small {
  color: var(--brand);
  text-decoration: underline;
}

.cash-collection-link:focus-visible,
.cash-collection-history summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

.cash-collection-modal {
  width: min(860px, 100%);
}

.cash-collection-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

.cash-collection-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.cash-collection-table td:first-child {
  white-space: nowrap;
}

.cash-collection-negative {
  color: var(--danger);
}

.cash-collection-history {
  margin-top: 16px;
}

.cash-collection-history summary {
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 860px) {
  .layout {
    display: block;
  }

  .side {
    display: none;
  }

  .main {
    padding-bottom: 80px;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .management-layout,
  .dashboard-detail-metrics,
  .form.two,
  .form.three,
  .form.four,
  .form.five,
  .sale-line {
    grid-template-columns: 1fr;
  }

  .employee-workspace,
  .cash-control-grid {
    grid-template-columns: 1fr;
  }

  .employee-list-panel {
    position: static;
    max-height: none;
  }

  .employee-list {
    max-height: 360px;
  }

  .employee-editor-head,
  .employee-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .cash-status-strip {
    grid-template-columns: 1fr;
  }

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

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

  .inbound-summary-item + .inbound-summary-item {
    border-left: 0;
  }

  .inbound-summary-item:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .inbound-summary-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal-backdrop {
    place-items: start center;
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .balance-payment-summary,
  .balance-payment-splits {
    grid-template-columns: 1fr;
  }

  .bulk-selection-status {
    justify-content: flex-start;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .mobile-switch {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: flex;
    overflow-x: auto;
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .mobile-switch button {
    flex: 0 0 86px;
    min-height: 56px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-switch button.active {
    color: var(--brand);
    font-weight: 800;
  }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .dashboard-detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.connection-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.connection-error { background: #fff4e6; color: #8a3900; border-color: #e7b97c; }
.financial-request-recovery:not(:empty) { padding: 12px; background: #fff4e6; border-radius: 10px; }
.financial-request-recovery .btn { margin-top: 8px; }
.mobile-menu-panel { display: none; }
.backup-fingerprint { overflow-wrap: anywhere; }

.payroll-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.payroll-workspace { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; min-width: 0; max-width: 100%; }
.payroll-workspace > *, .payroll-workspace form, .payroll-workspace .panel { min-width: 0; max-width: 100%; }
.payroll-workspace .panel { margin-bottom: 0; }
.payroll-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.payroll-month { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.payroll-month label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.payroll-month input { max-width: 180px; }
.payroll-month-rules { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; align-items: start; margin: 12px 0; }
.payroll-month-rules label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.payroll-month-rules input { width: 100%; min-width: 0; }
.payroll-normal-required { display: grid; gap: 7px; padding: 10px 12px; border-radius: 8px; background: #eff7f5; font-size: 12px; }
.payroll-normal-required strong { font-size: 23px; color: var(--brand); }
.payroll-normal-required small { color: var(--muted); }
.payroll-rule-settings, .payroll-optional-adjustments { margin: 14px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.payroll-rule-settings summary, .payroll-optional-adjustments summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.payroll-safety-note { padding: 10px 12px; border-left: 3px solid var(--brand); background: #eff7f5; font-size: 13px; line-height: 1.6; }
.payroll-warning { border-color: #e7b97c; background: #fff8ec; }
.payroll-source-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.payroll-source-cards > div { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.payroll-source-cards span, .payroll-source-cards small { color: var(--muted); font-size: 12px; }
.payroll-source-cards strong { font-size: 19px; }
.payroll-source-cards strong span { color: inherit; font-size: inherit; }
.payroll-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 10px; overscroll-behavior: contain; scroll-padding-inline-start: 180px; scroll-padding-inline-end: 24px; }
.payroll-team-table { width: 100%; min-width: 1040px; margin: 0; }
.payroll-team-table th { white-space: normal; background: #f3f7fb; vertical-align: middle; }
.payroll-team-table td { vertical-align: top; white-space: normal; padding: 14px 10px; }
.payroll-team-table td > small { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.payroll-team-table td:last-child > small { margin-top: 8px; max-width: 160px; }
.payroll-team-table input[type=number] { width: 104px; padding: 8px; }
.payroll-employee-cell { width: 218px; min-width: 190px; }
.payroll-employee-cell > .tag { margin: 4px 0 8px; display: inline-block; }
.payroll-employee-cell > button { display: block; margin-top: 10px; }
.payroll-include, .payroll-participation label, .payroll-confirm-check { display: flex; align-items: center; gap: 8px; }
.payroll-team-table input[type=checkbox], .payroll-confirm-check input[type=checkbox] { width: 17px; min-width: 17px; height: 17px; min-height: 17px; accent-color: var(--brand); }
.payroll-include { margin-bottom: 6px; align-items: flex-start; }
.payroll-include input { margin-top: 3px; }
.payroll-days { display: flex; align-items: center; gap: 5px; }
.payroll-days input[type=number] { width: 68px; }
.payroll-ordinary-days { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.payroll-ordinary-days + small { margin-top: 7px; }
.payroll-participation { display: grid; gap: 8px; min-width: 120px; }
.payroll-participation label { font-size: 12px; white-space: nowrap; }
.payroll-excluded { background: #f7f8fa; color: var(--muted); }
.payroll-row-errors { background: #fff8ec; padding-top: 0 !important; }
.payroll-row-errors p { margin: 6px 0; }
.payroll-ordinary-cell [data-payroll-ordinary-error]:empty { display: none; }
.payroll-detail-row > td { background: #f7faf9; padding: 16px; }
.payroll-detail-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.payroll-detail-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.payroll-detail-grid input[type=number], .payroll-detail-grid input { width: 100%; }
.payroll-detail-grid textarea { width: 100%; min-height: 72px; resize: vertical; }
.payroll-rest-entry-label { display: grid; gap: 7px; margin: 14px 0 8px; color: var(--muted); font-size: 12px; }
.payroll-rest-entry-label textarea { width: 100%; min-height: 86px; resize: vertical; font-family: ui-monospace, monospace; }
.payroll-rest-entry-label small { line-height: 1.6; }
.payroll-detail-heading { font-size: 14px; margin: 14px 0 10px; }
.payroll-legacy-adjustments { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12px; padding: 10px 12px; margin: 12px 0; background: #fff8ec; border-radius: 8px; }
.payroll-legacy-adjustments strong { flex-basis: 100%; }
.payroll-extra-work-row > td { background: #f4f8fc; padding: 12px 16px; }
.payroll-extra-work-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) minmax(200px,1.2fr); gap: 14px; align-items: start; }
.payroll-extra-work-grid label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.payroll-extra-work-grid input[type=number] { width: 100%; }
.payroll-extra-work-grid small { font-size: 11px; }
.payroll-attendance-row > td { background: #f4f9f8; padding: 12px 16px; border-bottom: 2px solid #dce9e6; }
.payroll-attendance-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) minmax(150px,1.2fr); gap: 14px; align-items: start; }
.payroll-attendance-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.payroll-attendance-grid label input[type=number] { width: 100%; }
.payroll-attendance-grid small { font-size: 11px; }
.payroll-attendance-total { display: grid; gap: 9px; border-left: 1px solid var(--line); padding: 5px 16px; font-size: 12px; }
.payroll-attendance-total strong { color: var(--brand); font-size: 17px; }
.payroll-attendance-rules { padding: 12px 16px; border: 1px solid #dce9e6; background: #f4f9f8; border-radius: 10px; margin: 14px 0; font-size: 13px; line-height: 1.7; }
.payroll-attendance-rules p { margin: 0 0 6px; }
.payroll-lateness-reason { grid-column: span 3; }
.payroll-note { grid-column: 1 / -1; }
.payroll-detail-totals { display: flex; gap: 12px 24px; flex-wrap: wrap; font-size: 12px; margin-top: 14px; }
.payroll-total-strip { display: flex; justify-content: flex-end; gap: 14px 24px; flex-wrap: wrap; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.payroll-total-strip strong { color: var(--brand); }
.payroll-save-actions { padding-top: 8px; }
.payroll-confirm-panel { border: 2px solid var(--brand); }
.payroll-confirm-panel > label:not(.payroll-confirm-check) { display: grid; max-width: 240px; gap: 6px; }
.payroll-confirm-check { margin: 16px 0; line-height: 1.6; }
.payroll-grid-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; margin: 16px 0 10px; }
.payroll-grid-toolbar p { max-width: 620px; font-size: 12px; line-height: 1.6; }
.payroll-grid-intro { margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.payroll-calculation-notes { font-size: 12px; line-height: 1.7; color: var(--muted); }
.payroll-calculation-notes summary { cursor: pointer; width: fit-content; }
.payroll-calculation-notes p { margin: 8px 0; }
.payroll-grid-table { border-collapse: separate; border-spacing: 0; table-layout: auto; font-size: 12px; }
.payroll-grid-table thead th { position: sticky; top: 0; z-index: 3; min-width: 104px; max-width: 150px; padding: 10px 8px; border-bottom: 2px solid #c9d9df; font-size: 12px; line-height: 1.5; background: #eaf2f6; }
.payroll-grid-table th small { display: block; margin-top: 4px; font-weight: 400; font-size: 10px; color: var(--muted); }
.payroll-grid-table .payroll-employee-cell { position: sticky; left: 0; z-index: 2; width: 164px; min-width: 164px; max-width: 164px; text-align: left; white-space: normal; box-shadow: 2px 0 0 #dce6eb; background: #fff; }
.payroll-grid-table thead .payroll-employee-cell { z-index: 4; background: #eaf2f6; }
.payroll-grid-table tbody th, .payroll-grid-table tbody td { padding: 10px 8px; vertical-align: middle; border-bottom: 1px solid #e2e9ed; }
.payroll-grid-table tbody tr:nth-child(even), .payroll-grid-table tbody tr:nth-child(even) .payroll-employee-cell { background: #f6f9fb; }
.payroll-grid-table tbody tr:focus-within, .payroll-grid-table tbody tr:focus-within .payroll-employee-cell { background: #eaf5f1; }
.payroll-grid-table tbody .payroll-excluded, .payroll-grid-table tbody .payroll-excluded .payroll-employee-cell { background: #f0f1f3; }
.payroll-grid-table input[type=number] { width: 88px; min-width: 88px; height: 36px; padding: 7px 6px; font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.payroll-grid-table input[readonly] { background: transparent; border-color: transparent; color: #52616a; }
.payroll-grid-table input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.payroll-grid-table input, .payroll-grid-table button { scroll-margin-inline-start: 180px; scroll-margin-inline-end: 24px; }
.payroll-grid-table input[type=checkbox] { width: 16px; min-width: 16px; height: 16px; min-height: 16px; margin: 0; }
.payroll-grid-table .payroll-flag-cell { width: 66px; min-width: 66px; max-width: 78px; text-align: center; }
.payroll-flag-toggle { display: grid; place-items: center; min-height: 36px; padding: 6px 10px; cursor: pointer; }
.payroll-grid-table .payroll-include { align-items: center; gap: 6px; margin: 0 0 4px; }
.payroll-grid-table .payroll-include strong { overflow-wrap: anywhere; font-weight: 650; }
.payroll-grid-table td > small, .payroll-grid-table th > small { margin: 4px 0 0; line-height: 1.4; font-size: 10px; font-weight: 400; }
.payroll-grid-table .payroll-bonus-cell { background: #fff2b8; }
.payroll-bonus-cell label { display: block; }
.payroll-grid-table .payroll-money-cell { min-width: 112px; text-align: right; font-variant-numeric: tabular-nums; }
.payroll-grid-table .payroll-bonus-result { background: #eef8f3; color: #126555; }
.payroll-grid-table .payroll-other-deduction { background: #fff3ef; }
.payroll-grid-table .payroll-deduction-reason { min-width: 210px; max-width: 260px; }
.payroll-grid-table .payroll-deduction-reason label { margin: 0; font-size: 0; }
.payroll-grid-table .payroll-deduction-reason input { width: 210px; font-size: 12px; }
.payroll-grid-table .payroll-actual-cell { min-width: 124px; text-align: center; font-variant-numeric: tabular-nums; }
.payroll-grid-table .payroll-grid-note input { min-width: 150px; width: 150px; height: 36px; padding: 7px; }
.payroll-grid-table.payroll-entry-view .payroll-col-salary { display: none; }
.payroll-grid-table.payroll-salary-view .payroll-col-entry { display: none; }
.payroll-supplement { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf9; scroll-margin-top: 16px; }
.payroll-supplement > summary { font-size: 13px; font-weight: 600; cursor: pointer; }
.payroll-supplement-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.payroll-supplement-picker label { display: grid; gap: 6px; min-width: 180px; font-size: 12px; }
.payroll-supplement-picker p { flex: 1; min-width: 200px; font-size: 12px; line-height: 1.6; }
.payroll-local-status { margin: 6px 0; color: #8b5b17; font-size: 12px; }
.payroll-local-status:empty { display: none; }
.payroll-local-recovery { padding: 12px 16px; margin: 12px 0; border: 1px solid #e7b97c; border-radius: 8px; font-size: 13px; }
.payroll-local-recovery summary { margin-top: 10px; cursor: pointer; }
.payroll-local-recovery td { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 300px; }
.payroll-review-notices { display: grid; gap: 8px; margin: 10px 0; }
.payroll-review-notices:empty { display: none; }
.payroll-review-errors, .payroll-review-warnings { border: 1px solid; border-radius: 8px; font-size: 12px; }
.payroll-review-errors { border-color: #e2a39e; background: #fff5f4; color: #9f3027; }
.payroll-review-warnings { border-color: #e7c68e; background: #fff9ed; color: #805b21; }
.payroll-review-notices summary { padding: 9px 12px; cursor: pointer; line-height: 1.6; }
.payroll-review-notices summary strong { margin-right: 12px; }
.payroll-review-notices summary span { font-size: 11px; }
.payroll-review-content { padding: 0 14px 12px; color: var(--text); line-height: 1.65; }
.payroll-review-content h3 { margin: 8px 0; font-size: 12px; }
.payroll-review-content ul, .payroll-employee-review ul { margin: 8px 0; padding-left: 20px; }
.payroll-review-content li, .payroll-employee-review li { margin: 5px 0; overflow-wrap: anywhere; }
.payroll-employee-review { border: 1px solid #e2a39e; border-radius: 8px; background: #fff5f4; color: #9f3027; padding: 10px 14px; margin-top: 12px; font-size: 12px; line-height: 1.6; }
.payroll-employee-review h3 { font-size: 13px; margin: 0; }
.payroll-grid-table .payroll-employee-cell > .payroll-review-badge { display: inline-block; margin-top: 5px; border: 1px solid #dcaaa4; border-radius: 5px; background: #fff1ef; color: #a3332a; padding: 3px 7px; line-height: 1.4; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.payroll-inline-review { margin-top: 4px; font-size: 10px; color: #a3332a; }
.payroll-inline-review summary { cursor: pointer; white-space: nowrap; }
.payroll-inline-review .form-error { display: block; margin-top: 5px; font-size: 11px; }
.payroll-source-changed { padding: 9px 12px; border: 1px solid #e7b97c; border-radius: 8px; font-size: 12px; line-height: 1.6; }
@media (max-width: 700px) {
  .payroll-grid-table .payroll-employee-cell { width: 132px; min-width: 132px; max-width: 132px; }
  .payroll-table-scroll { max-height: 65vh; scroll-padding-inline-start: 148px; }
  .payroll-grid-table input, .payroll-grid-table button { scroll-margin-inline-start: 148px; }
  .payroll-grid-table thead th { font-size: 12px; }
  .payroll-supplement .payroll-detail-grid { grid-template-columns: minmax(0,1fr); }
  .payroll-supplement .payroll-lateness-reason { grid-column: auto; }
  .payroll-save-actions { position: sticky; bottom: 66px; z-index: 5; background: #fff; padding: 10px 0; box-shadow: 0 -4px 10px #233a4610; }
}

.private-settlement-workspace { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; min-width: 0; max-width: 100%; }
.private-settlement-workspace > *, .private-settlement-workspace .panel, .private-settlement-workspace form, .private-document { min-width: 0; max-width: 100%; }
.private-settlement-workspace .panel, .private-settlement-workspace .page-head { margin: 0; }
.private-settlement-workspace .page-head p { max-width: 900px; line-height: 1.7; }
.private-settlement-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.private-settlement-metrics > div { display: grid; gap: 8px; padding: 18px; border: 1px solid var(--line); background: #fff; border-radius: 12px; }
.private-settlement-metrics span { color: var(--muted); font-size: 12px; }
.private-settlement-metrics strong { color: var(--brand); font-size: clamp(18px,2vw,25px); overflow-wrap: anywhere; }
.private-settlement-section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.private-settlement-section-head p { margin-bottom: 0; line-height: 1.6; max-width: 750px; }
.private-customer-search { width: min(100%,320px); }
.private-customer-list { display: grid; gap: 10px; }
.private-customer-card { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr) minmax(80px,.45fr); align-items: center; gap: 12px 24px; width: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.private-customer-card:hover { border-color: var(--brand); background: #f6faf9; }
.private-customer-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.private-customer-card > div { display: grid; gap: 6px; min-width: 0; }
.private-customer-card strong { font-size: 17px; overflow-wrap: anywhere; }
.private-customer-card small, .private-customer-card p { color: var(--muted); font-size: 12px; }
.private-customer-card p { grid-column: 1 / -1; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); line-height: 1.6; }
.private-customer-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.private-customer-title h2 { margin: 0; }
.private-customer-title span { color: var(--muted); }
.private-statement-actions { display: grid; gap: 14px; margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f5faf8; }
.private-statement-actions .actions, .private-payment-form .actions { margin: 0; flex-wrap: wrap; }
.private-statement-actions > label { display: grid; gap: 7px; max-width: 270px; color: var(--muted); font-size: 12px; }
.private-statement-actions > p { margin: 0; font-size: 13px; line-height: 1.7; }
.private-export-more { min-width: 0; }
.private-export-more > summary { cursor: pointer; padding: 11px 14px; color: var(--brand); font-size: 13px; }
.private-export-more > .actions { padding: 8px 0; }
.private-payment-form { border: 1px solid var(--brand); }
.private-payment-form form { display: grid; gap: 16px; }
.private-payment-form p { font-size: 13px; line-height: 1.7; }
.private-payment-details { padding: 0 16px 12px; }
.private-payment-details > summary { color: var(--brand); cursor: pointer; font-size: 13px; padding: 8px 0; }
.private-first-open { margin-bottom: 0; font-size: 13px; line-height: 1.7; }
.private-settlement-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.private-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.private-toggle input { width: 16px; min-height: 16px; height: 16px; accent-color: var(--brand); }
.private-settlement-documents { display: grid; gap: 12px; }
.private-document { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.private-document-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding: 16px; }
.private-document-head > div:first-child { display: grid; gap: 6px; min-width: 150px; }
.private-document-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.private-document-value { margin-left: auto; text-align: right; }
.private-document-head .actions { margin: 0; }
.private-document > p { margin: 0; padding: 0 16px 12px; }
.private-settlement-scroll { min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.private-settlement-scroll table { width: 100%; margin: 0; }
.private-settlement-items { min-width: 1000px; }
.private-settlement-prices { min-width: 630px; }
.private-settlement-scroll td { vertical-align: middle; }
.private-settlement-scroll td > small { display: block; margin-top: 6px; color: var(--muted); }
.private-price-input { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.private-price-input input { width: 125px; }
.private-price-input span { color: var(--muted); font-size: 12px; }
.private-settlement-items input[data-private-remark] { min-width: 170px; }
.private-settlement-preview { border: 2px solid var(--brand); background: #f7fbfa; }
.private-settlement-preview h2 { margin-top: 0; }
.private-settlement-preview > p { font-size: 13px; line-height: 1.8; }
.private-preview-summary { display: flex; gap: 16px 28px; flex-wrap: wrap; padding: 14px 0; font-size: 14px; }
.private-preview-list { max-height: 290px; border: 1px solid var(--line); border-radius: 8px; margin: 14px 0; }
.private-preview-list table { min-width: 500px; }
.private-confirm-form { margin-top: 16px; }
.private-reverse-form { display: grid; gap: 12px; padding: 16px; border-top: 1px solid var(--line); background: #fff8ec; }
.private-reverse-form label { display: grid; gap: 8px; font-size: 13px; }
.private-reverse-form textarea { width: 100%; }
.private-new-customer { display: grid; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 12px; max-width: 440px; }
.private-new-price { display: grid; gap: 14px; margin-bottom: 24px; padding: 16px; background: var(--brand-soft); border-radius: 10px; }
.private-new-price > button { justify-self: start; }
.private-settlement-prices td:last-child .btn { margin: 3px 6px 3px 0; }
@media (max-width: 700px) {
  .private-statement-actions { padding: 14px; }
  .private-statement-actions > .actions > .btn { flex: 1 1 170px; }
  .private-statement-actions > label { max-width: none; }
  .private-settlement-metrics { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .private-settlement-metrics > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; }
  .private-settlement-metrics strong { font-size: 18px; }
  .private-customer-card { grid-template-columns: minmax(0,1fr) minmax(75px,.4fr); padding: 14px; gap: 12px; }
  .private-customer-name { grid-column: 1 / -1; }
  .private-document-head { gap: 12px; padding: 14px; }
  .private-document-head .actions { flex: 1 1 100%; }
  .private-document-head .actions .btn { flex-grow: 1; }
  .private-document-value { width: 100%; text-align: left; }
  .private-settlement-tabs .btn { flex: 1 1 100px; }
  .private-settlement-scroll table { display: table; overflow: visible; }
  .private-price-input input { padding: 8px; }
}

@media (max-width: 860px) {
  .payroll-source-cards { grid-template-columns: 1fr; }
  .payroll-month { gap: 5px; }
  .payroll-month .btn { padding: 7px 10px; }
  .payroll-team-table { display: table; overflow: visible; }
  .payroll-detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .payroll-month-rules { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .payroll-save-actions .btn { flex: 1 1 180px; }
}

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .brand { min-width: 0; }
  .brand strong { font-size: 15px; }
  .brand span { font-size: 11px; }
  .top-actions { flex-wrap: wrap; gap: 6px; width: 100%; justify-content: space-between; }
  .top-actions .btn { padding: 7px 10px; min-height: 38px; }
  .main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); min-width: 0; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head h1 { font-size: 22px; }
  .page-head .actions { flex-wrap: wrap; }
  .connection-banner { align-items: flex-start; flex-wrap: wrap; }
  .btn, input, select { min-height: 44px; }
  input, select, textarea { font-size: 16px; max-width: 100%; }
  .mobile-switch { padding-bottom: env(safe-area-inset-bottom); overflow-x: hidden; }
  .mobile-switch button { flex: 1 1 0; min-width: 0; padding: 7px 4px; }
  .mobile-menu-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; position: fixed; left: 10px; right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); max-height: 65vh; overflow-y: auto; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; z-index: 31; box-shadow: 0 6px 24px #0002; }
  .modal-card { max-height: calc(100dvh - 30px); overflow-y: auto; }
  .dashboard-total-metric strong { font-size: clamp(26px,8vw,42px); overflow-wrap: anywhere; }
}
.private-customer-entry { border: 1px solid var(--border, #d5dfdf); border-radius: 12px; padding: 10px; min-width: 0; }
.private-customer-entry .private-customer-card { width: 100%; box-sizing: border-box; }
.private-customer-actions { margin-top: 10px; flex-wrap: wrap; }
.private-internal-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0; }
.private-internal-filter label { display: grid; gap: 5px; }
.private-internal-customer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid #e2e9e9; padding: 8px 0; }
.private-internal-document { border: 1px solid #d5dfdf; border-radius: 10px; padding: 14px; margin: 12px 0; min-width: 0; }
.private-internal-document summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; cursor: pointer; }
/* Returns workspace: inline forms, no prompt/modal bookkeeping. */
.return-editor, .return-detail, .return-search, .return-actions { margin: 16px 0; }
.return-editor fieldset, .return-detail fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.return-editor label, .return-detail label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.return-detail .inline-check, .return-editor .inline-check { flex-direction: row; align-items: flex-start; }
.return-editor input[type="number"] { min-width: 125px; }
.return-editor small, .return-detail small, .return-records small { display: block; margin-top: 4px; }
.return-preview { margin-top: 18px; border-left: 4px solid #19766a; background: #edf6f4; padding: 18px; border-radius: 8px; }
.return-preview strong { display: block; font-size: 22px; margin-top: 6px; }
.return-candidates { display: grid; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); gap: 10px; margin-top: 12px; }
.return-candidates button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 6px; white-space: normal; }
.selling-store-label { white-space: normal; max-width: 240px; }
.credit-sale-source { grid-column: 1 / -1; padding: 16px; border: 1px solid #d5e2df; border-radius: 10px; background: #f4f8f7; }
.credit-sale-source strong, .credit-history small, .customer-list-table small { display: block; margin-top: 5px; }
.credit-history { overflow-x: auto; }
.credit-history table { min-width: 960px; table-layout: fixed; }
.credit-history-col-date { width: 10%; }
.credit-history-col-customer { width: 18%; }
.credit-history-col-type, .credit-history-col-amount, .credit-history-col-payment { width: 12%; }
.credit-history-col-sale { width: 15%; }
.credit-history-col-person { width: 10.5%; }
.credit-history th { white-space: nowrap; }
.credit-history td { max-width: none; white-space: normal; overflow-wrap: anywhere; vertical-align: top; line-height: 1.45; }
.credit-history .credit-history-date, .credit-history-amount strong, .credit-history-source dd { white-space: nowrap; }
.credit-history-summary.has-details td { border-bottom: 0; padding-bottom: 8px; }
.credit-history-summary .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.credit-history-detail > td { padding: 0 8px 14px; }
.credit-history-details { border: 1px solid #e2e9ef; border-radius: 8px; padding: 12px 14px; background: #f7fafb; }
.credit-history-source { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px; margin: 0; }
.credit-history-source div { min-width: 0; }
.credit-history-source dt { font-size: 12px; color: var(--muted); }
.credit-history-source dd { margin: 5px 0 0; font-weight: 700; }
.credit-history-comment { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; }
.credit-history-comment strong { color: var(--muted); font-size: 12px; padding-top: 2px; }
.credit-history-comment p { min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.credit-history-source + .credit-history-comment { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 780px) {
  .credit-history { overflow-x: visible; }
  .credit-history table { display: block; min-width: 0; white-space: normal; overflow: visible; }
  .credit-history colgroup, .credit-history thead { display: none; }
  .credit-history tbody { display: block; }
  .credit-history-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--line); padding: 14px 0; }
  .credit-history-summary td { display: block; min-width: 0; border: 0; padding: 0; }
  .credit-history-summary td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
  .credit-history-summary.has-details td { padding-bottom: 0; }
  .credit-history-summary .btn { text-align: left; }
  .credit-history-detail { display: block; }
  .credit-history-detail > td { display: block; padding: 0 0 14px; }
  .credit-history-source { grid-template-columns: 1fr; }
  .credit-history-comment { grid-template-columns: 1fr; gap: 6px; }
}
.customer-business-tabs { flex-wrap: wrap; }
.payment-trace-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.payment-trace-panel { margin-top: 14px; }
.payment-trace-hint { padding: 12px 14px; border: 1px solid #cfe3dc; border-radius: 8px; background: #f0f7f4; line-height: 1.6; }
.payment-trace-table { min-width: 880px; white-space: normal; }
.payment-trace-table td { vertical-align: top; }
.payment-trace-table td small { display: block; margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
.payment-trace-table td:nth-child(2) { min-width: 170px; }
.payment-trace-table td:nth-child(3), .payment-trace-table td:nth-child(4) { min-width: 145px; }
.payment-trace-table td:nth-child(5) { min-width: 125px; }
.payment-trace-table td > .btn, .payment-trace-table td > .tag { margin-bottom: 5px; }
.payment-trace-amount { display: block; white-space: nowrap; margin-top: 6px; }
.payment-trace-note { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; line-height: 1.6; }
.payment-trace-detail > td { padding: 0 10px 14px; }
.payment-trace-detail .payment-trace-note { padding: 8px 12px; background: #f7fafb; border-radius: 6px; }
.payment-vouchers { display: grid; gap: 12px; }
.payment-voucher-card, .payment-voucher-upload { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfc; }
.payment-voucher-title { display: flex; align-items: start; flex-wrap: wrap; gap: 10px; }
.payment-voucher-title .btn { text-align: left; white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
.payment-vouchers summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.payment-vouchers form { display: grid; gap: 10px; margin-top: 10px; }
.payment-vouchers form > button { justify-self: start; }
.payment-vouchers label { display: grid; gap: 5px; }
.payment-vouchers textarea { resize: vertical; width: 100%; min-height: 60px; }
.payment-voucher-review { margin-top: 10px; }
.payment-trace-date-nav { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.payment-trace-date-nav label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.payment-trace-date-nav input { min-width: 165px; }
.payment-trace-summary { margin-bottom: 16px; }
.payment-trace-summary .metric strong { font-size: clamp(20px, 2.3vw, 30px); overflow-wrap: anywhere; }
.payment-voucher-status { white-space: normal; line-height: 1.4; }
.payment-voucher-status-pending { color: #9b4b09; background: #fff2d8; }
.payment-voucher-status-uploaded { color: #2455a0; background: #eaf1ff; }
.payment-voucher-status-approved { color: #176b4e; background: #e6f5eb; }
.payment-voucher-status-rejected, .payment-voucher-status-void { color: #aa3030; background: #fdeaea; }
.payment-voucher-status-legacy { color: #526275; background: #eef1f4; }
.credit-workspace-actions { align-items: center; margin-bottom: 16px; }
.credit-workspace-actions > .muted { flex: 1 1 320px; }
.credit-wide, .credit-amount-preview { grid-column: 1 / -1; }
.credit-entry-form > label, .credit-correction > form > label { min-width: 0; }
.credit-entry-form textarea, .credit-correction textarea { min-height: 68px; }
.credit-amount-preview { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-radius: 8px; background: #e9f5ee; color: #14654a; }
.credit-amount-preview:empty { display: none; }
.credit-amount-preview strong { font-size: 23px; }
.credit-ledger-totals { margin-top: 16px; }
.credit-ledger-totals .metric strong { font-size: clamp(18px, 2vw, 28px); overflow-wrap: anywhere; }
.credit-ledger-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; padding: 12px 14px; border-radius: 8px; background: #eef5f4; }
.credit-ledger-line > .actions { margin: 0; margin-left: auto; }
.credit-ledger-line > small { color: var(--muted); }
.credit-ledger-line > details { flex: 1 0 100%; }
.credit-ledger-line strong { white-space: nowrap; }
.credit-audit-entry { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.credit-audit-entry p { white-space: pre-wrap; overflow-wrap: anywhere; }
.credit-correction, .credit-voucher-workspace { margin-top: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.credit-correction { border-color: #d8b56c; background: #fffdf6; }
.credit-correction h3 { margin-top: 0; }
.credit-voucher-totals { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.credit-voucher-totals span { display: grid; gap: 5px; }
.credit-bank-receipt { margin: 12px 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #f7fafb; }
.credit-bank-receipt > p { overflow-wrap: anywhere; }
.credit-voucher-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 12px 0; }
.credit-voucher-files > div { display: grid; justify-items: start; gap: 6px; }
.credit-voucher-files .btn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.credit-voucher-files small { color: var(--muted); }
.credit-transfer-row { border-top: 1px solid var(--line); padding: 18px 0; }
.credit-transfer-row:first-of-type { border-top: 0; }
.credit-transfer-row .panel-title { flex-wrap: wrap; gap: 12px; }
.credit-transfer-row .panel-title small { display: block; margin-top: 6px; color: var(--muted); }
.payment-voucher-status-partial { color: #8a5b06; background: #fff2d8; }
.payment-voucher-status-not_required { color: #526275; background: #eef1f4; }
@media (max-width: 780px) {
  .credit-ledger-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credit-ledger-line { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .credit-ledger-line > .actions { margin-left: 0; }
  .credit-correction, .credit-voucher-workspace { padding: 12px; }
  .credit-correction .form.three, .credit-voucher-workspace .form.three, .credit-entry-form.form.three { grid-template-columns: 1fr; }
  .credit-bank-receipt { padding: 12px; }
}
.sales-voucher-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.sales-voucher-action { display: flex; flex-direction: column; align-items: start; gap: 7px; width: 100%; padding-top: 7px; border-top: 1px solid var(--line); }
.sales-voucher-expanded > td { padding: 10px 0 20px; max-width: none; white-space: normal; }
.sales-voucher-workspace { border: 1px solid #c6ddd5; border-radius: 10px; padding: 14px; background: #f6faf8; max-width: 100%; }
.sales-voucher-workspace .payment-trace-table { background: white; }
.sales-voucher-workspace .panel-title { flex-wrap: wrap; }
@media (max-width: 700px) {
  .payment-trace-filters { grid-template-columns: 1fr; }
  .payment-voucher-upload .form.two { grid-template-columns: 1fr; }
}
.inventory-picker { background: #f4f8f7; border: 1px solid #d5e2df; border-radius: 12px; padding: 14px; }
.loan-ledger-launcher { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 10px 0 20px; }
.loan-ledger-launcher label { display: grid; gap: 6px; flex: 1 1 300px; max-width: 540px; }
.loan-ledger-launcher small { flex-basis: 100%; line-height: 1.6; }
.loan-repayment-preview { padding: 14px; border: 1px solid #c9dfd7; border-radius: 8px; background: #f0f8f5; line-height: 1.6; }
.loan-repayment-preview > span { display: block; }
.loan-repayment-preview p { margin: 8px 0; }
.loan-repayment-preview small { color: var(--muted); }
.employee-loan-modal { width: min(1480px, calc(100vw - 40px)); max-width: calc(100vw - 40px); min-width: 0; }
.employee-loan-modal h2 { margin: 0; font-size: 21px; }
.employee-loan-modal > .panel-title { align-items: start; gap: 14px; }
.loan-ledger-filters { display: grid; grid-template-columns: minmax(210px, 2fr) repeat(2, minmax(160px, 1fr)) auto; gap: 12px; align-items: end; margin: 16px 0; }
.loan-ledger-filters label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.loan-ledger-filters input, .loan-ledger-filters select { width: 100%; min-width: 0; }
.loan-ledger-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.loan-ledger-summary > div { padding: 16px; background: #f1f8f5; border: 1px solid #d3e5dd; border-radius: 9px; }
.loan-ledger-summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 9px; }
.loan-ledger-summary strong { font-size: clamp(18px, 2vw, 25px); overflow-wrap: anywhere; }
.employee-loan-table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; }
.employee-loan-table { min-width: 1660px; table-layout: auto; }
.employee-loan-table th, .employee-loan-table td { vertical-align: top; min-width: 90px; }
.employee-loan-table td:first-child { min-width: 160px; }
.employee-loan-table td:nth-child(2), .employee-loan-table td:nth-child(7) { min-width: 170px; }
.employee-loan-table td:nth-child(5) { min-width: 165px; }
.employee-loan-table td:nth-child(10) { min-width: 150px; }
.employee-loan-table td small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; }
.employee-loan-table td p { margin: 7px 0 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.employee-loan-table .loan-ledger-note { min-width: 280px; max-width: 400px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.loan-ledger-amount { white-space: nowrap; }
.loan-ledger-void { background: #fff7f6; color: #7c5555; }
.loan-ledger-void td:nth-child(3), .loan-ledger-void td:nth-child(4) { text-decoration: line-through; }
.loan-void-target { display: grid; gap: 8px; border: 1px solid #e9cccc; background: #fff5f3; padding: 16px; border-radius: 9px; }
@media (max-width: 760px) {
  .employee-loan-modal { width: calc(100vw - 20px); max-width: calc(100vw - 20px); padding: 16px; }
  .loan-ledger-filters { grid-template-columns: minmax(0, 1fr); }
  .loan-ledger-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.inventory-picker-results { max-height: 275px; overflow: auto; display: grid; gap: 6px; margin: 12px 0; }
.inventory-product-option { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border: 1px solid #d5e2df; background: white; border-radius: 8px; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.inventory-product-option:hover { border-color: #176b5d; }
.inventory-product-option.selected { background: #e6f1ed; opacity: .7; cursor: default; }
.inventory-product-option small, .location-line small { display: block; color: #64776f; margin-top: 5px; }
.location-editor .location-line { display: grid; grid-template-columns: minmax(180px,2fr) repeat(4,minmax(100px,1fr)) auto; align-items: end; padding: 12px; background: #f8faf9; border: 1px solid #dce7e2; border-radius: 10px; }
.location-editor .location-line input, .location-editor .location-line select { min-width: 0; width: 100%; box-sizing: border-box; }
.location-tabs { flex-wrap: wrap; }
.panel-title > select[onchange="state.inventoryOverviewScope=this.value;render()"] { width: min(100%,360px); flex: 0 1 360px; }
.panel-title:has(> select[onchange="state.inventoryOverviewScope=this.value;render()"]) h2 { flex-shrink: 0; white-space: nowrap; }
@media(max-width:1100px) { .location-editor .location-line { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media(max-width:640px) { .location-editor .location-line { grid-template-columns: repeat(2,minmax(0,1fr)); } .inventory-product-option { align-items: flex-start; flex-direction: column; gap: 6px; } }
/* Approval and stocktake workspaces: readable tables, explicit count cutoffs. */
.stocktake-status { border-left: 5px solid #167569; }
.stocktake-status .card { padding: 16px; background: #f0f8f6; }
.stocktake-status p { margin: 9px 0; }
.stocktake-workspace { border: 2px solid #b1d6cc; margin: 16px 0; }
.operation-notice { padding: 16px; background: #fff8df; border-radius: 10px; line-height: 1.65; }
.operation-detail { margin-top: 18px; padding-top: 16px; border-top: 2px solid #c4ded8; }
.operation-detail > form, .operation-delivery { padding: 16px; margin-top: 14px; background: #f5f8fb; border-radius: 10px; }
.operation-event { padding: 14px 0; border-bottom: 1px solid #dce4ed; }
.operation-table { min-width: 780px; }
.operation-table input[type="number"] { min-width: 110px; max-width: 150px; }
.operation-table input:not([type="number"]):not([type="checkbox"]) { min-width: 190px; }
.inventory-ledger-drawer { position: fixed; inset: 88px 18px 18px 250px; z-index: 40; overflow: auto; background: #f6f9fc; padding: 22px; border: 1px solid #c4d4e4; border-radius: 14px; box-shadow: 0 10px 80px #17324b55; }
.inventory-ledger-drawer > .panel-title { position: sticky; top: -22px; background: #f6f9fc; z-index: 1; padding: 16px 0; }
.inventory-ledger-drawer table { min-width: 1000px; }
.inventory-ledger-drawer .panel { margin-top: 16px; }
@media (max-width: 760px) { .inventory-ledger-drawer { inset: 74px 8px 8px; padding: 12px; } .stocktake-status .grid { grid-template-columns: 1fr; } }

/* Store edge-banding material selector; shared pricing controls remain unchanged. */
.factory-price-table { min-width: 960px; }
.factory-price-row td:first-child { min-width: 160px; }
.factory-price-row td small { display: block; margin-top: 7px; color: var(--muted); }
.factory-price-mode { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.factory-price-mode .btn { white-space: nowrap; }
.factory-unit-price { display: grid; gap: 6px; font-weight: 700; min-width: 230px; }
.factory-price-table .factory-unit-price input { width: 100%; max-width: 230px; padding: 11px 12px; font-size: 17px; font-weight: 700; }
.factory-price-custom { background: #fffbee; }
.factory-review-price { display: grid; justify-items: start; gap: 7px; margin-top: 9px; min-width: 180px; max-width: 420px; }
.factory-review-price small { color: var(--muted); }
.factory-review-price p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.factory-price-custom .factory-unit-price input { border: 2px solid #c37b12; background: #fff; color: #7a4300; }
.factory-unit-price input[readonly] { background: #f2f5f7; color: #526275; }
.factory-line-subtotal strong { display: block; white-space: nowrap; padding-top: 12px; font-size: 15px; }
.factory-quote-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 18px; padding: 18px; border: 1px solid #c9dfd7; border-radius: 9px; background: #edf6f2; }
.factory-quote-total > strong { font-size: 25px; color: var(--brand); }
.factory-quote-total > small { flex-basis: 100%; color: var(--muted); line-height: 1.6; }
.factory-payment-credit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 12px 0; padding: 14px; border: 1px solid #c9dfd7; border-radius: 8px; background: #eff8f4; }
.factory-payment-credit small, .factory-payment-credit .form-error { flex-basis: 100%; line-height: 1.6; }
.sale-edge-picker { grid-column: 1 / -1; padding: 14px; border: 1px solid #cbded8; border-radius: 10px; background: #f5faf8; min-width: 0; }
.sale-edge-picker > label { display: grid; gap: 6px; }
.sale-edge-picker > small { display: block; margin-top: 10px; line-height: 1.5; }
.sale-edge-picker summary { cursor: pointer; color: var(--brand); font-weight: 700; padding: 9px 0; }
.sale-edge-selected { margin: 12px 0; padding: 10px; border-radius: 7px; background: white; }
.sale-edge-stock { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 14px; margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sale-edge-stock.shortage { color: var(--danger); }
.sale-edge-results { display: grid; gap: 7px; max-height: 330px; overflow: auto; margin-top: 8px; }
.sale-edge-option { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); background: white; border-radius: 7px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.sale-edge-option small { display: block; margin-top: 3px; color: var(--muted); }
.sale-edge-option .sale-edge-stock { grid-column: 1 / -1; margin-top: 0; }
.sale-edge-option.selected { border-color: var(--brand); background: #edf7f3; }
.sale-edge-option:focus-visible { outline: 3px solid #7ebcae; outline-offset: 1px; }
@media (max-width: 700px) { .sale-edge-stock { grid-template-columns: 1fr; } .sale-edge-picker { padding: 10px; } }
.quotation-banner { grid-column: 1 / -1; padding: 16px; border: 1px solid #b8d9d2; border-radius: 12px; background: #f0f8f5; display: grid; gap: 12px; }
.quotation-banner p { margin: 0; line-height: 1.6; }
.quotation-banner .inline-check { display: flex; align-items: flex-start; gap: 8px; }
.quotation-banner .inline-check input { width: auto; flex: 0 0 auto; margin-top: 4px; }
.quotation-banner > label:not(.inline-check) { max-width: 420px; }
.quotation-warning { grid-column: 1 / -1; padding: 12px; background: #fff4d8; border: 1px solid #ead39a; border-radius: 8px; line-height: 1.6; }
.quotation-validity { display: grid; gap: 4px; min-width: 160px; font-size: 12px; }
.quotation-table small { display: block; margin-top: 5px; color: var(--muted, #64748b); }
.quotation-table .actions { margin: 0 0 8px; gap: 6px; }
.quotation-history { padding: 6px 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) { .quotation-banner { padding: 12px; } .quotation-banner .panel-title { align-items: flex-start; flex-direction: column; gap: 8px; } .quotation-validity { width: 100%; } }
/* Wholesale customer accounts use the original sales and payment records. */
.wholesale-layout { display: grid; grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); gap: 16px; align-items: start; }
.wholesale-profile { margin-bottom: 16px; }
.wholesale-profile summary { cursor: pointer; padding: 4px 0; }
.wholesale-profile > label { display: grid; gap: 6px; max-width: 620px; }
.wholesale-profile form { margin-top: 12px; align-items: end; }
.wholesale-customers > label { display: grid; gap: 6px; }
.wholesale-customer-list { display: grid; gap: 8px; max-height: 72vh; overflow-y: auto; margin-top: 12px; }
.wholesale-customer { display: grid; gap: 7px; width: 100%; padding: 12px; text-align: left; border: 1px solid #d4e0e8; border-radius: 9px; background: white; color: #172532; cursor: pointer; }
.wholesale-customer[hidden] { display: none; }
.wholesale-customer.selected { background: #edf6f3; border-color: #1e7164; box-shadow: inset 3px 0 #1e7164; }
.wholesale-customer small { color: #5e7182; }
.wholesale-customer em, .wholesale-overdue { color: #a83b21; font-style: normal; font-weight: 600; }
.wholesale-detail { min-width: 0; display: grid; gap: 14px; }
.wholesale-empty { min-height: 180px; display: grid; place-content: center; color: #5e7182; }
.wholesale-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.wholesale-metrics > div { border: 1px solid #d4e0e8; border-radius: 9px; padding: 12px; display: grid; gap: 7px; }
.wholesale-metrics span { color: #5e7182; font-size: 13px; }
.wholesale-metrics strong { font-size: 20px; overflow-wrap: anywhere; }
.wholesale-metrics small { font-size: 12px; font-weight: 400; }
.wholesale-tabs { flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.wholesale-order { border: 1px solid #d4e0e8; border-radius: 9px; margin-bottom: 10px; overflow: hidden; }
.wholesale-order summary { display: flex; gap: 10px 18px; flex-wrap: wrap; padding: 14px; cursor: pointer; background: #f6f9fa; }
.wholesale-order summary strong { flex: 1 1 180px; }
.wholesale-order-body { padding: 0 14px 14px; }
.wholesale-order-body > button { margin-top: 10px; }
.wholesale-error { border: 1px solid #edd5c6; background: #fff6ed; color: #924522; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.wholesale-sale-banner { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px; border: 1px solid #9fc9bd; border-radius: 8px; background: #edf6f3; margin-top: 12px; color: #165f52; }
.wholesale-sale-banner small { flex-basis: 100%; color: #526e66; }
.wholesale-commission-summary { padding: 12px; background: #edf6f3; border-radius: 8px; }
@media (max-width: 1080px) { .wholesale-layout { grid-template-columns: 1fr; } .wholesale-customer-list { grid-template-columns: repeat(2, minmax(0,1fr)); max-height: 300px; } }
@media (max-width: 600px) { .wholesale-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); } .wholesale-metrics strong { font-size: 17px; } .wholesale-customer-list { grid-template-columns: 1fr; } }
