:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --line-soft: #edf1f6;
  --primary: #1f6feb;
  --primary-hover: #1a5fd0;
  --primary-soft: #edf5ff;
  --good: #138a51;
  --warn: #b45309;
  --danger: #b42318;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow-md: 0 10px 28px rgb(16 24 40 / 8%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

body.login-page {
  display: block;
  min-height: 100vh;
  background: #eef3f9;
}

.mobile-appbar,
.mobile-nav-overlay,
.mobile-nav-account,
.mobile-menu-close,
.brand strong {
  display: none;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(340px, 460px);
  align-items: stretch;
  padding: 0;
}

.login-hero {
  display: flex;
  align-items: center;
  padding: 56px;
  background: #111827;
  color: #fff;
}

.login-hero h1 {
  margin: 12px 0;
  font-size: 42px;
}

.login-hero p {
  max-width: 560px;
  color: #c7d2e4;
  line-height: 1.8;
}

.login-logo-lockup {
  display: flex;
  align-items: center;
}

.login-logo-lockup img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 5px;
  box-shadow: 0 10px 28px rgb(0 0 0 / 18%);
}

.login-card {
  align-self: center;
  margin: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.login-card form,
.login-card label {
  display: grid;
  gap: 8px;
}

.login-card form {
  margin-top: 18px;
  gap: 16px;
}

.login-card input,
.login-card button {
  width: 100%;
  height: 42px;
}

.remember-login {
  display: flex !important;
  align-items: center;
  grid-template-columns: none !important;
  gap: 8px !important;
  color: var(--ink);
}

.remember-login input {
  width: 16px;
  height: 16px;
}

.remember-login.disabled {
  color: var(--muted);
}

.remember-note {
  margin-top: -8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
}

.role-help {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.role-help div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.role-help strong,
.role-help span {
  display: block;
}

.role-help span {
  margin-top: 4px;
  color: var(--muted);
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 18px 12px;
  box-shadow: inset -1px 0 0 rgb(255 255 255 / 6%);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 5px;
}

.sidebar button {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 6px;
  margin: 4px 0;
  text-align: left;
  padding: 0 12px 0 14px;
  background: transparent;
  color: #d9e1ef;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-group {
  padding: 14px 0 6px;
}

.nav-group span {
  display: block;
  padding: 0 12px 6px;
  color: #8f9bb0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar button.active,
.sidebar button:hover {
  background: #233047;
  color: #fff;
  border-left-color: #66a3ff;
}

main {
  min-width: 0;
  padding: 24px;
}

.app-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.app-footer a {
  margin-left: 12px;
  color: inherit;
}

.login-footer {
  margin: -36px 0 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

#page-subtitle {
  margin-top: 6px;
  color: var(--muted);
}

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

.userbar span {
  font-weight: 600;
}

.login,
.userbar,
.toolbar,
.global-search {
  display: flex;
  gap: 8px;
  align-items: center;
}

input,
select,
button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
}

input,
select,
textarea {
  background: #fff;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: #8bb7ff;
  box-shadow: 0 0 0 3px rgb(31 111 235 / 12%);
  outline: 0;
}

input[type="checkbox"] {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--primary);
}

input[type="checkbox"]:focus {
  box-shadow: none;
  outline: 0;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

button {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button:focus-visible,
.button-link:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgb(31 111 235 / 18%);
}

button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

button.secondary:hover,
.button-link.secondary-link:hover {
  background: #f8fafc;
  border-color: #bfc8d6;
}

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

button.danger-button:hover {
  background: #9f1f16;
  border-color: #9f1f16;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.weak-password-status {
  color: var(--danger);
  font-weight: 700;
}

.account-security-panel {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.security-warning {
  display: grid;
  gap: 6px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
  padding: 12px 14px;
}

.security-warning strong {
  color: #7f1d1d;
  font-size: 15px;
}

.security-warning span {
  line-height: 1.55;
}

.password-form {
  display: grid;
  gap: 14px;
  max-width: 460px;
}

.password-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.password-form input {
  width: 100%;
}

.password-rules {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px;
  color: var(--muted);
}

.password-rules strong {
  color: var(--ink);
}

.global-search {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.global-search input {
  flex: 1;
}

.hidden {
  display: none !important;
}

.print-template-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.panel,
.search-results,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

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

.danger-zone {
  border-color: #f2b8b5;
  background: #fff8f7;
}

.table-wrap.inner {
  padding: 0;
  border: 0;
  margin-bottom: 0;
}

.sales-customer-picker {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.sales-customer-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
}

.muted-box,
.customer-pick-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: var(--shadow-sm);
}

.muted-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--muted);
}

.muted-box.selected {
  color: var(--ink);
  border-color: #c7d9f6;
  background: var(--primary-soft);
}

.muted-box div {
  display: grid;
  gap: 3px;
}

.muted-box span,
.muted-box small {
  color: var(--muted);
  font-size: 12px;
}

.customer-pick-results {
  display: grid;
  overflow: hidden;
}

.customer-pick-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(200px, 2fr) auto;
  align-items: center;
  gap: 10px;
  height: auto;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

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

.customer-pick-item:hover {
  background: var(--primary-soft);
}

.customer-pick-item span,
.customer-pick-item small {
  color: var(--muted);
  word-break: break-word;
}

.sales-items-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 8px;
  font-weight: 700;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.icon-button:disabled,
.inline-actions button:disabled {
  background: #eef2f7;
  border-color: var(--line);
  color: var(--muted);
}

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

.sales-items {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.sales-item-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: var(--shadow-sm);
}

.sales-item-top,
.sales-product-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sales-product-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
}

.sales-product-selected,
.sales-product-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.sales-product-selected {
  min-height: 48px;
  padding: 10px 12px;
  color: var(--muted);
}

.sales-product-selected.selected {
  color: var(--ink);
  border-color: #c7d9f6;
  background: var(--primary-soft);
}

.sales-product-selected div {
  display: grid;
  gap: 3px;
}

.sales-product-selected span,
.sales-product-selected small {
  color: var(--muted);
  font-size: 12px;
}

.sales-product-results {
  display: grid;
  overflow: hidden;
}

.product-pick-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto;
  align-items: center;
  gap: 10px;
  height: auto;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

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

.product-pick-item:hover {
  background: var(--primary-soft);
}

.product-pick-item.disabled,
.product-pick-item:disabled {
  cursor: not-allowed;
  background: #fff7f7;
  color: var(--muted);
}

.product-pick-item.disabled:hover,
.product-pick-item:disabled:hover {
  background: #fff7f7;
}

.product-pick-item span,
.product-pick-item small {
  color: var(--muted);
  word-break: break-word;
}

.pick-status {
  display: inline-block;
  margin-right: 8px;
  font-style: normal;
  font-weight: 700;
}

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

.pick-status.good {
  color: var(--good);
}

.sales-item-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

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

.sales-item-fields input[readonly] {
  background: #f3f6fb;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.card.summary-action {
  cursor: pointer;
}

.card.summary-action:hover,
.card.summary-action.active {
  border-color: #f5a18d;
  background: #fff1ed;
}

.card.summary-action.active {
  box-shadow: 0 0 0 2px rgba(217, 79, 49, 0.14);
}

.danger-card {
  border-color: #f4c2bd;
  background: #fff8f7;
}

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

.warn-card strong {
  color: var(--warn);
}

.good-card strong {
  color: var(--good);
}

.dashboard-alerts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
  box-shadow: var(--shadow-sm);
}

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

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.mini-stat.warn strong {
  color: var(--warn);
}

.mini-stat.danger strong {
  color: var(--danger);
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.flow-step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 96px;
  box-shadow: var(--shadow-sm);
}

.flow-step span {
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

.flow-step strong {
  display: block;
  margin: 8px 0 4px;
}

.flow-step small,
.section-title p {
  color: var(--muted);
}

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

.reconciliation-toolbar {
  align-items: end;
  grid-template-columns: minmax(140px, 170px) minmax(140px, 170px) minmax(260px, 1fr) auto auto;
  gap: 10px;
  margin-top: 10px;
}

.filter-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.filter-field input {
  width: 100%;
}

.filter-field-wide {
  min-width: 260px;
}

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

.inline-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid #b7c6dc;
  border-radius: 4px;
  background: #fff;
}

.inline-check input:checked + .check-box {
  border-color: var(--primary);
  background: var(--primary);
}

.inline-check input:checked + .check-box::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  content: "";
  transform: rotate(45deg);
}

.reconciliation-action {
  min-width: 92px;
  height: 36px;
}

.reconciliation-cards {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.reconciliation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reconciliation-tab {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  box-shadow: none;
}

.reconciliation-tab:hover {
  border-color: #cfe1ff;
  background: var(--primary-soft);
  color: var(--primary);
}

.reconciliation-tab.active {
  border-color: #cfe1ff;
  background: var(--primary-soft);
  color: var(--primary);
}

.reconciliation-tab-panel {
  display: none;
}

.reconciliation-tab-panel.active {
  display: block;
}

.reconciliation-stat {
  min-height: 86px;
  border-left: 3px solid var(--line);
}

.reconciliation-stat.warn-card {
  border-left-color: var(--warn);
}

.reconciliation-stat.good-card {
  border-left-color: var(--good);
}

.reconciliation-stat.danger-card {
  border-left-color: var(--danger);
}

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

.reconciliation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.reconciliation-grid .panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 12px;
}

.reconciliation-grid .panel h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

.reconciliation-grid th {
  background: #f6f8fb;
}

.reconciliation-grid td:not(.table-wrap-text),
.reconciliation-grid th:not(.table-wrap-text) {
  white-space: nowrap;
}

.reconciliation-grid .table-wrap {
  flex: 1;
  max-height: 300px;
  overflow: auto;
  padding-bottom: 10px;
  scrollbar-color: #98a2b3 #edf1f6;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
}

.reconciliation-grid .table-wrap::-webkit-scrollbar,
.financial-ledger-grid .table-wrap::-webkit-scrollbar,
.correction-grid .table-wrap::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.reconciliation-grid .table-wrap::-webkit-scrollbar-track,
.financial-ledger-grid .table-wrap::-webkit-scrollbar-track,
.correction-grid .table-wrap::-webkit-scrollbar-track {
  background: #edf1f6;
  border-radius: 999px;
}

.reconciliation-grid .table-wrap::-webkit-scrollbar-thumb,
.financial-ledger-grid .table-wrap::-webkit-scrollbar-thumb,
.correction-grid .table-wrap::-webkit-scrollbar-thumb {
  background: #98a2b3;
  border: 4px solid #edf1f6;
  border-radius: 999px;
}

.reconciliation-grid .table-wrap::-webkit-scrollbar-thumb:hover,
.financial-ledger-grid .table-wrap::-webkit-scrollbar-thumb:hover,
.correction-grid .table-wrap::-webkit-scrollbar-thumb:hover {
  background: #667085;
}

.reconciliation-grid .table-wrap th,
.financial-ledger-grid .table-wrap th,
.correction-grid .table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.reconciliation-grid .table-wrap table,
.financial-ledger-grid .table-wrap table,
.correction-grid .table-wrap table {
  min-width: 760px;
}

.panel-pagination .pagination {
  justify-content: space-between;
  padding: 12px 0 0;
}

.financial-ledger-workspace {
  margin-top: 14px;
  padding: 14px;
}

.business-analysis-workspace {
  margin: 0 0 14px;
  padding: 14px;
}

.business-analysis-cards {
  margin-bottom: 12px;
}

.business-risk-grid {
  margin-top: 12px;
}

.aging-workspace {
  margin-top: 14px;
  padding: 14px;
}

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

.financial-ledger-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.financial-ledger-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.financial-ledger-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ledger-table-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.ledger-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #f8fafc;
}

.ledger-table-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.ledger-table-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.financial-ledger-grid .table-wrap {
  flex: 1;
  max-height: 360px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: none;
}

.business-risk-grid .table-wrap {
  max-height: 300px;
}

.financial-ledger-grid td:not(.table-wrap-text),
.financial-ledger-grid th:not(.table-wrap-text) {
  white-space: nowrap;
}

.ledger-party {
  display: grid;
  gap: 2px;
  min-width: 160px;
}

.ledger-party strong {
  color: var(--ink);
}

.ledger-party small {
  color: var(--muted);
  font-size: 12px;
}

.signed-money {
  font-weight: 700;
}

.signed-money.positive {
  color: var(--warn);
}

.signed-money.negative {
  color: var(--good);
}

.profit-money {
  font-weight: 700;
}

.profit-money.positive-profit {
  color: var(--good);
}

.profit-money.negative-profit {
  color: var(--danger);
}

.correction-workspace {
  margin-top: 14px;
  padding: 14px 14px 12px;
  border-color: #dbe7f6;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

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

.correction-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.correction-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.correction-search {
  display: grid;
  grid-template-columns: minmax(260px, 420px) max-content;
  gap: 8px;
  align-items: end;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f6f9fd;
}

.correction-search .filter-field-wide {
  min-width: min(420px, 58vw);
}

.correction-search-button {
  width: 92px;
  min-width: 92px;
  border-color: #c8d6ea;
  background: #fff;
  color: #25405f;
  box-shadow: none;
}

.correction-search-button:hover {
  border-color: #9bb8df;
  background: #eef5ff;
  color: #1d4ed8;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid #cfe1ff;
  border-radius: 999px;
  background: #eef5ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.correction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.correction-table-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.correction-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: #f8fafc;
}

.correction-table-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.correction-table-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.correction-grid .table-wrap {
  flex: 1;
  max-height: 260px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: none;
}

.correction-party {
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.correction-party strong {
  color: var(--ink);
}

.correction-party small {
  color: var(--muted);
  font-size: 12px;
}

.correction-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #f0b8b1;
  border-radius: 999px;
  background: #fff8f7;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.correction-button:hover {
  border-color: var(--danger);
  background: #fff0ed;
  color: #9f1f16;
  transform: none;
}

.correction-button:focus-visible {
  box-shadow: 0 0 0 3px rgb(180 35 24 / 14%);
}

.form-grid button {
  min-width: 120px;
}

.product-code-field,
.supplier-field {
  position: relative;
  min-width: 0;
}

.product-code-field input,
.supplier-field input,
.customer-address-field input {
  width: 100%;
}

.customer-address-field {
  position: relative;
  min-width: 0;
}

.product-code-suggestions,
.supplier-suggestions,
.customer-address-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.product-code-suggestion,
.supplier-suggestion,
.customer-address-suggestion {
  display: grid;
  gap: 4px;
  width: 100%;
  height: auto;
  min-height: 52px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.product-code-suggestion:last-child,
.supplier-suggestion:last-child,
.customer-address-suggestion:last-child {
  border-bottom: 0;
}

.product-code-suggestion:hover,
.supplier-suggestion:hover,
.customer-address-suggestion:hover {
  background: var(--primary-soft);
}

.supplier-suggestion-add {
  background: #f6fff8;
}

.product-code-suggestion strong,
.supplier-suggestion strong,
.customer-address-suggestion strong {
  color: var(--primary);
}

.product-code-suggestion span,
.product-code-suggestion small,
.supplier-suggestion span,
.supplier-suggestion small,
.customer-address-suggestion span,
.customer-address-suggestion small {
  color: var(--muted);
  word-break: break-word;
}

.batch-product-form {
  display: grid;
  gap: 10px;
}

.batch-product-form h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.batch-product-form p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.batch-product-form textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  line-height: 1.6;
}

.service-resource-panel {
  display: grid;
  gap: 10px;
}

.service-resource-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.service-resource-editors label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.service-resource-editors textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.service-resource-panel .form-error.success {
  color: var(--good);
}

.field-bind-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faf9;
}

.field-bind-panel h3 {
  margin: 0 0 6px;
}

.field-bind-controls {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto auto;
  gap: 10px;
  align-items: center;
  justify-content: start;
}

.field-bind-status {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.field-bind-result {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
}

.field-bind-result svg {
  width: 260px;
  height: 260px;
  border: 1px solid var(--line);
  background: #fff;
}

.field-bind-code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
}

.field-bind-payload {
  margin-top: 8px;
  word-break: break-all;
  color: var(--muted);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.template-import-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) auto;
  gap: 8px;
  align-items: center;
  justify-content: start;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.button-link:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button-link.secondary-link {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.toolbar {
  margin-bottom: 12px;
}

.toolbar.compact {
  margin: 12px 0;
}

.toolbar input {
  min-width: 320px;
}

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

table.resizable-table {
  table-layout: fixed;
}

#products-table table {
  table-layout: fixed;
  min-width: 1460px;
}

th,
td {
  border-right: 1px solid #e4e9f1;
  border-bottom: 1px solid var(--line-soft);
  padding: 7px 8px;
  text-align: left;
  vertical-align: middle;
  line-height: 1.28;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  position: relative;
  color: #344054;
  background: linear-gradient(#f9fbfe, #eef3f8);
  font-weight: 700;
  padding-top: 7px;
  padding-bottom: 7px;
}

th.column-resize-active {
  background: #eaf2ff;
}

tbody tr:hover td {
  background: #fbfdff;
}

.table-nowrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resizable-table th,
.resizable-table td {
  height: 36px;
  max-width: 0;
}

.resizable-table th.table-nowrap,
.resizable-table td.table-nowrap {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-nowrap .badge {
  white-space: nowrap;
}

.table-wrap-text {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.3;
}

.reconciliation-grid .table-wrap-text {
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.financial-ledger-grid .table-wrap-text {
  min-width: 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.text-number {
  text-align: right;
}

#products-table .table-select-cell {
  padding-right: 6px;
  padding-left: 6px;
  text-align: center;
  white-space: nowrap;
}

.resizable-table .table-select-cell {
  padding-right: 6px;
  padding-left: 6px;
  text-align: center;
  white-space: nowrap;
  cursor: default;
  overflow: visible;
}

.resizable-table .table-select-cell input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  vertical-align: middle;
}

.resizable-table .table-select-cell input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.resizable-table .selection-locked {
  cursor: help;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: auto;
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-align: left;
}

.table-header-label {
  display: inline-block;
  padding-right: 8px;
}

.column-resize-handle {
  position: absolute;
  top: 0;
  right: -5px;
  z-index: 3;
  width: 11px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 1px;
  background: transparent;
}

th:hover .column-resize-handle::after,
.column-resize-active .column-resize-handle::after,
.column-resizing .column-resize-handle::after {
  background: rgb(31 111 235 / 42%);
  width: 2px;
}

body.column-resizing {
  cursor: col-resize;
  user-select: none;
}

.column-resize-guide {
  position: fixed;
  z-index: 200;
  display: none;
  width: 2px;
  background: var(--primary);
  box-shadow: 0 0 0 1px rgb(31 111 235 / 18%);
  pointer-events: none;
}

.column-resize-guide.active {
  display: block;
}

.sort-button small {
  color: var(--muted);
  font-size: 11px;
}

.sort-button.active small {
  color: var(--primary);
}

.customer-cell {
  display: grid;
  gap: 3px;
  min-width: 160px;
  max-width: 280px;
}

.resizable-table td .customer-cell {
  gap: 1px;
  min-width: 0;
  max-width: none;
}

.customer-cell strong {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
}

.customer-cell small {
  color: var(--muted);
  line-height: 1.25;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #334155;
  font-weight: 600;
  line-height: 1;
}

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

.badge.good {
  background: #ecfdf3;
  color: var(--good);
}

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

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

.inline-actions button {
  height: 30px;
  font-size: 12px;
  font-weight: 600;
}

.table-actions-cell {
  white-space: nowrap;
  padding-top: 4px;
  padding-bottom: 4px;
}

.table-actions-cell .inline-actions {
  flex-wrap: nowrap;
  align-items: center;
}

.table-actions-cell .inline-actions button {
  height: 28px;
  min-width: max-content;
  padding: 0 9px;
  white-space: nowrap;
}

.date-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(15 23 42 / 32%);
}

.date-dialog {
  display: grid;
  width: min(320px, 100%);
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgb(15 23 42 / 18%);
}

.date-dialog strong {
  font-size: 15px;
}

.date-dialog input,
.date-dialog textarea {
  width: 100%;
}

.date-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.date-dialog label input,
.date-dialog label select,
.date-dialog label textarea,
.payment-method-options button {
  color: var(--text);
}

.floating-select {
  position: relative;
  width: 100%;
}

.toolbar .floating-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 148px;
}

.floating-select-button {
  position: relative;
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff !important;
  border-color: var(--line) !important;
  color: var(--text);
  text-align: left;
  font-weight: 400;
  padding: 0 28px 0 10px;
  box-shadow: none;
}

.floating-select-button:hover,
.floating-select.open .floating-select-button {
  background: #fff !important;
  border-color: #bfc8d6 !important;
  color: var(--text);
}

.floating-select-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgb(31 111 235 / 10%);
}

.floating-select-button::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1px solid #667085;
  border-bottom: 1px solid #667085;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.floating-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 260;
  display: none;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #c8d2e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgb(15 23 42 / 18%);
}

.floating-select.open .floating-select-menu {
  display: block;
}

.floating-select-option {
  display: block;
  width: 100%;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  padding: 0 8px;
  box-shadow: none;
}

.floating-select-option:hover {
  background: #edf5ff;
  color: var(--primary);
}

.date-dialog textarea {
  min-height: 72px;
  resize: vertical;
}

.date-dialog input[readonly] {
  background: var(--bg);
  color: var(--muted);
}

.payment-dialog {
  width: min(380px, 100%);
}

.delivery-dialog {
  width: min(720px, 100%);
}

.dialog-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.dialog-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
}

.dialog-check input {
  width: auto;
}

.delivery-item-picker {
  display: grid;
  gap: 8px;
}

.delivery-item-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.delivery-item-picker-head .inline-actions {
  margin: 0;
}

.delivery-item-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.delivery-item-card {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 8px !important;
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.delivery-item-card input {
  width: auto;
  margin-top: 3px;
}

.delivery-item-card strong,
.delivery-item-card small {
  display: block;
}

.delivery-item-card small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.delivery-item-qty {
  display: grid;
  grid-template-columns: auto minmax(80px, 120px);
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.delivery-item-qty input {
  height: 30px;
}

.payment-method-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.payment-method-options button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 400;
}

.payment-method-options button:hover {
  border-color: #b7c6dc;
  background: var(--primary-soft);
}

.payment-method-options button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.payment-method-options button:focus-visible {
  outline: 2px solid rgb(37 99 235 / 30%);
  outline-offset: 2px;
}

.date-dialog .inline-actions {
  justify-content: flex-end;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.batch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.batch-note {
  color: #8a4b00;
  background: #fff4df;
  border: 1px solid #ffd79a;
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 1.3;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #fbfdff;
}

.detail-row td {
  background: #f8fafc;
}

.detail-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.customer-summary {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(120px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.customer-summary > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.customer-summary span,
.customer-summary small {
  color: var(--muted);
  font-size: 12px;
}

.installation-task-list {
  display: grid;
  gap: 10px;
}

.installation-task-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.installation-task-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.installation-task-card-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.installation-task-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.installation-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.installation-task-grid > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.installation-task-grid span,
.installation-task-grid small {
  color: var(--muted);
  font-size: 12px;
}

.installation-task-grid strong,
.installation-task-grid small {
  overflow-wrap: anywhere;
}

.installation-task-actions {
  justify-content: flex-start;
}

.installation-print-actions {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

.installation-print-actions .secondary {
  justify-self: start;
}

.print-choice-list {
  display: grid;
  gap: 10px;
}

.print-choice-list button {
  display: grid;
  gap: 5px;
  justify-items: start;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
}

.print-choice-list button span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.print-choice-list small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.print-choice-dialog {
  width: min(520px, 100%);
  gap: 14px;
}

.print-choice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.print-choice-head .dialog-hint {
  margin-top: 4px;
}

.print-choice-head .icon-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.installation-site-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow-wrap: normal;
  word-break: normal;
}

.installation-site-panel * {
  overflow-wrap: normal;
  word-break: normal;
}

.installation-site-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.installation-site-summary > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.installation-site-summary span,
.installation-site-summary small {
  color: var(--muted);
  font-size: 12px;
}

.installation-site-summary small {
  overflow-wrap: break-word;
  line-height: 1.45;
}

.field-worker-batches {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.field-worker-batches > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-worker-batches > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.field-worker-batches small {
  color: var(--text);
  font-size: 12px;
}

.installation-site-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.installation-site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.installation-site-head strong {
  font-size: 13px;
}

.installation-site-head small {
  color: var(--muted);
  font-size: 12px;
}

.installation-site-items.compact {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 6px;
}

.installation-site-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(116px, auto);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.installation-site-item.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 7px 9px;
}

.installation-site-item.muted {
  background: #f8fafc;
  color: var(--muted);
}

.installation-site-item-main {
  min-width: 0;
}

.installation-site-item strong,
.installation-site-item small {
  display: block;
  overflow-wrap: break-word;
  line-height: 1.32;
}

.installation-site-item small,
.installation-site-item-stats small {
  color: var(--muted);
  font-size: 12px;
}

.installation-site-item-stats {
  display: grid;
  gap: 2px;
  min-width: 132px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

.installation-site-item-stats small {
  overflow-wrap: break-word;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .installation-site-items.compact {
    grid-template-columns: 1fr;
  }
}

.field-batch-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.field-batch-section summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.field-batch-section summary::-webkit-details-marker {
  display: none;
}

.field-batch-section summary::after {
  content: "展开";
  margin-left: auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.field-batch-section[open] summary::after {
  content: "收起";
}

.field-batch-section summary span,
.field-batch-section summary small {
  color: var(--muted);
  font-size: 12px;
}

.field-batch-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.field-batch-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.field-batch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field-batch-head span,
.field-batch-head small,
.field-batch-card p {
  font-size: 12px;
}

.field-batch-head span,
.field-batch-head small {
  color: var(--muted);
}

.field-warning {
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff1ed;
  color: #a23f22;
  font-size: 12px;
  font-weight: 600;
}

.field-warning.inline {
  display: block;
  width: fit-content;
  margin-top: 4px;
}

.purchase-records {
  display: grid;
  gap: 12px;
}

.purchase-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.purchase-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.purchase-card-head div {
  display: grid;
  gap: 3px;
}

.purchase-card-head span,
.purchase-card-head small {
  color: var(--muted);
  font-size: 12px;
}

.detail-heading {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 360px));
  justify-content: start;
  align-items: start;
  gap: 10px;
  width: 100%;
  max-width: 1100px;
}

.product-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 7px 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.product-index {
  grid-row: 1 / span 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e8f1ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.product-item > strong,
.product-item > small,
.product-item > .sales-stock-status,
.product-item > .line-action {
  grid-column: 2;
  word-break: break-word;
  min-width: 0;
}

.product-item > strong {
  line-height: 1.35;
}

.product-item small {
  color: var(--muted);
  line-height: 1.5;
}

.payment-record {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.payment-record.danger {
  border-color: #f3c9c4;
  background: #fff8f7;
}

.payment-record.system {
  border-color: #d7e1ee;
  background: #f8fbff;
}

.payment-record-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.payment-record-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-record-title strong {
  color: var(--ink);
  line-height: 1.3;
}

.installation-log-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.field-proof-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.field-proof-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #cfe0d8;
  border-radius: 8px;
  background: #f8fffb;
  box-shadow: var(--shadow-sm);
}

.field-proof-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.field-proof-head strong {
  color: var(--ink);
  font-size: 14px;
}

.field-proof-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.field-proof-card small {
  color: var(--muted);
}

.field-proof-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-proof-photos a {
  display: block;
}

.field-proof-photos img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2ef;
}

.installation-log-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: var(--shadow-sm);
}

.installation-log-card.compact {
  padding: 9px 10px;
  box-shadow: none;
}

.installation-log-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.installation-log-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.installation-log-title strong {
  color: var(--ink);
  line-height: 1.3;
}

.installation-log-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

.installation-log-main small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.installation-log-meta {
  display: grid;
  gap: 5px;
  min-width: 120px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.payment-record small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.payment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.payment-chip.good {
  background: #e9f8ef;
  color: #11804b;
}

.payment-chip.danger {
  background: #fff0ed;
  color: var(--danger);
}

.payment-chip.system {
  background: #eef5ff;
  color: #315f9f;
}

.payment-unlock-button {
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid #d6aa4d;
  border-radius: 999px;
  background: #fffaf0;
  color: #855500;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.payment-unlock-button:hover {
  border-color: #b98316;
  background: #fff3d7;
  color: #6f4600;
  transform: none;
  box-shadow: none;
}

.payment-unlock-button:focus-visible {
  outline: 3px solid rgba(217, 160, 46, 0.22);
  outline-offset: 2px;
}

.product-meta {
  display: block;
  margin-top: 2px;
  color: #475569;
}

.sales-stock-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.stock-chip {
  display: grid;
  gap: 3px;
  min-height: 50px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stock-chip em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.25;
}

.stock-chip strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.stock-chip.good {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.stock-chip.good strong {
  color: var(--good);
}

.stock-chip.warn {
  border-color: #fed7aa;
  background: #fff7ed;
}

.stock-chip.warn em,
.stock-chip.warn strong {
  color: var(--warn);
}

.stock-chip.neutral {
  background: #f8fafc;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 18px;
}

.detail-grid div {
  display: grid;
  gap: 4px;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  font-weight: 600;
}

.detail-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  color: #334155;
}

.pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pagination select {
  height: 32px;
}

.pagination button {
  height: 32px;
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.search-results {
  display: grid;
  gap: 8px;
}

.result {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.result:last-child {
  border-bottom: 0;
}

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

.task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.task-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.compact-task {
  grid-template-columns: 110px 1fr;
}

.line-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  justify-content: start;
  min-width: 0;
}

.line-action input {
  width: 100%;
}

.price-review-action {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  max-width: 100%;
}

.price-save-button {
  min-width: 72px;
  padding-inline: 8px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(31, 111, 235, 0.18);
}

.price-save-button:hover {
  background: #1a5fd0;
  border-color: #1a5fd0;
}

.price-save-all-button {
  min-width: 108px;
}

.line-action button {
  min-width: 0;
  white-space: nowrap;
}

.line-action .status-text {
  min-width: 0;
  line-height: 1.5;
  white-space: normal;
}

@media (max-width: 1280px) {
  .product-item .price-review-action {
    grid-template-columns: 1fr;
  }

  .product-item .price-save-button {
    width: 100%;
  }
}

.detail-actions {
  margin: 12px 0;
}

mark {
  background: #fff1a8;
  border-radius: 3px;
  padding: 0 2px;
}

.status-text {
  color: var(--muted);
  font-size: 12px;
}

.page-guide {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 4px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.page-guide strong {
  flex: 0 0 auto;
  color: var(--ink);
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 280px;
    padding: 32px;
  }

  .login-card {
    margin: 18px;
  }

  body {
    display: block;
    min-height: 100dvh;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 40px 32px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    border-bottom: 1px solid rgb(255 255 255 / 8%);
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 10px rgb(16 24 40 / 16%);
  }

  .mobile-appbar img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 2px;
  }

  .mobile-appbar strong {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-menu-toggle {
    display: grid;
    place-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-color: rgb(255 255 255 / 14%);
    background: rgb(255 255 255 / 8%);
  }

  .mobile-menu-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .mobile-nav-overlay,
  .mobile-nav-overlay:hover {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgb(15 23 42 / 52%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  body.mobile-nav-open .mobile-nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: block;
    width: min(84vw, 320px);
    max-width: 320px;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: max(12px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
    box-shadow: 10px 0 28px rgb(0 0 0 / 24%);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-group {
    padding: 10px 0 4px;
  }

  .brand {
    justify-content: flex-start;
    gap: 10px;
    padding: 4px 4px 14px;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .brand strong,
  .mobile-menu-close {
    display: block;
  }

  .brand strong {
    min-width: 0;
    font-size: 15px;
  }

  .sidebar .mobile-menu-close {
    width: 36px;
    min-width: 36px;
    height: 36px;
    margin: 0 0 0 auto;
    padding: 0;
    border-left: 0;
    color: #c7d2e4;
    font-size: 26px;
    line-height: 1;
    text-align: center;
  }

  .sidebar button {
    min-width: 0;
    min-height: 44px;
    text-align: left;
  }

  .mobile-nav-account {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    padding: 16px 4px 4px;
    border-top: 1px solid rgb(255 255 255 / 10%);
    color: #c7d2e4;
    font-size: 13px;
  }

  .mobile-nav-account .secondary {
    width: 100%;
    margin: 0;
    border: 1px solid rgb(255 255 255 / 16%);
    background: rgb(255 255 255 / 8%);
    color: #fff;
    text-align: center;
  }

  main {
    padding: 16px;
  }

  .topbar {
    display: none;
  }

  .login,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .global-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
  }

  .global-search input {
    width: 100%;
    min-width: 0;
  }

  .global-search button {
    min-width: 76px;
  }

  .form-grid,
  .dialog-grid,
  .flow,
  .dashboard-alerts,
  .mini-stats,
  .task-grid,
  .reconciliation-toolbar,
  .reconciliation-cards,
  .reconciliation-grid,
  .financial-ledger-grid,
  .correction-grid,
  .correction-search,
  .detail-grid,
  .service-resource-editors,
  .product-list,
  .customer-summary,
  .sales-customer-search,
  .sales-product-search,
  .sales-item-fields,
  .product-pick-item,
  .customer-pick-item {
    grid-template-columns: 1fr;
  }

  .correction-search {
    width: 100%;
  }

  .correction-search .filter-field-wide,
  .correction-search-button {
    width: 100%;
    min-width: 0;
  }

  .financial-ledger-head,
  .ledger-table-head,
  .correction-table-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-item {
    grid-template-columns: 1fr;
  }

  .line-action {
    grid-template-columns: 1fr;
  }

  .sales-stock-status {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

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

  .card {
    min-width: 0;
    padding: 13px;
  }

  .card strong {
    margin-top: 6px;
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .sales-value-card strong {
    font-size: clamp(17px, 4.6vw, 20px);
    letter-spacing: -0.03em;
  }

  .toolbar input {
    min-width: 0;
  }

  .toolbar .floating-select {
    width: 100%;
  }

  .filter-field-wide {
    min-width: 0;
  }
}

@media (max-width: 359px) {
  .mobile-appbar {
    grid-template-columns: 38px 28px minmax(0, 1fr);
    gap: 8px;
    padding-inline: 10px;
  }

  main {
    padding: 12px;
  }

  .cards {
    gap: 8px;
  }

  .card {
    padding: 11px;
  }

  .card span {
    font-size: 12px;
  }

  .card strong {
    font-size: 21px;
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  .sidebar {
    width: min(58vw, 320px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .mobile-nav-overlay {
    transition: none;
  }
}
