:root {
  --bg: #e1e5eb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #c9d0da;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea {
  font: inherit;
  touch-action: manipulation;
}

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

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 60px rgba(16, 24, 40, .10);
}

.login-logo {
  display: block;
  width: min(300px, 88%);
  max-height: 92px;
  object-fit: contain;
  margin: 0 auto 22px;
}

.login-card h1 { margin: 0 0 8px; font-size: 26px; text-align: center; }
.login-card p { margin: 0 0 22px; color: var(--muted); text-align: center; }

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

.login-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.login-option input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--brand);
}

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

.login-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.login-legal-links a {
  color: var(--muted);
  text-decoration: none;
}

.login-legal-links a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 13px; color: #344054; font-weight: 700; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.btn {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #eef2f6; color: #263242; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.error-box {
  margin-top: 12px;
  color: var(--danger);
  font-weight: 700;
  min-height: 20px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  background: #0f1724;
  color: #fff;
  padding: 16px 12px;
  display: grid;
  align-content: start;
  gap: 14px;
  height: 100vh;
  max-height: 100vh;
  overflow: auto;
  border-right: 1px solid rgba(255,255,255,.08);
}

.brand {
  display: block;
  width: 100%;
  padding: 10px 12px 14px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.brand-home {
  cursor: pointer;
  text-decoration: none;
}

.brand-home:hover,
.brand-home:focus-visible {
  background: rgba(255,255,255,.07);
  outline: none;
}

.brand strong {
  display: block;
  font-size: 19px;
  line-height: 1.15;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: #9aa8ba;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
  padding: 0 2px 14px;
}

.nav-group {
  display: grid;
  gap: 0;
  padding: 8px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.nav-group:last-child { border-bottom: 0; }

.nav-group-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  padding: 8px 12px;
  border-radius: 7px;
  background: rgba(255,255,255,.08);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
}

.nav-group-title:hover {
  background: rgba(255,255,255,.13);
}

.nav-group-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease;
}

.nav-group.is-open .nav-group-chevron {
  transform: rotate(225deg);
}

.nav-group-items {
  display: none;
  gap: 3px;
  padding-top: 4px;
}

.nav-group.is-open .nav-group-items {
  display: grid;
}

.nav [data-route] {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 7px;
  padding: 9px 12px;
  background: transparent;
  color: #d6deea;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  transition: background .14s ease, color .14s ease, padding-left .14s ease;
  text-decoration: none;
}

.nav [data-route]:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.nav [data-route].active {
  background: #e11d2e;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(225,29,46,.22);
}

.main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.topbar {
  height: 64px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px;
}

.topbar h1 { margin: 0; font-size: 20px; }
.user { color: var(--muted); font-size: 14px; }

.notification-top-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.dealer-cart-top-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.dealer-cart-top-btn:hover {
  border-color: var(--brand);
  background: #eefdfb;
}

.dealer-cart-top-btn span {
  line-height: 1;
  font-size: 18px;
}

.dealer-cart-top-btn b {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 2px 5px;
  background: #e11d2e;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}

.notification-top-btn:hover {
  border-color: var(--brand);
  background: #eefdfb;
}

.notification-top-btn span {
  line-height: 1;
  font-size: 18px;
}

.notification-top-btn b {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 2px 5px;
  background: #e11d2e;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  border: 2px solid #fff;
}

.mobile-menu-btn {
  display: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.content {
  padding: 22px;
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  box-shadow: 0 2px 8px rgba(23, 32, 42, .07);
}

.metric { padding: 16px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; }

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(23, 32, 42, .07);
}

.dashboard-hero span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-hero h2 {
  margin: 5px 0 4px;
  font-size: 22px;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
}

.dashboard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.alert-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.stock-price-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.product-analysis-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.forecast-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.metric-button {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.metric-button.active {
  border-color: var(--brand);
  background: #eefdfb;
}

.metric-button:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
}

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

.bulk-import-box {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.product-bulk-stack {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.dashboard-panel-body {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.dashboard-alert {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.dashboard-alert:hover {
  border-color: #a7b0c0;
  background: #f9fafb;
}

.dashboard-alert strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.dashboard-alert b {
  min-width: 28px;
  border-radius: 999px;
  background: #eef2f6;
  color: #263242;
  padding: 3px 8px;
  text-align: center;
}

.dashboard-alert small {
  display: grid;
  gap: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.dashboard-alert small i {
  font-style: normal;
}

.dashboard-alert small span {
  display: block;
  color: #98a2b3;
  font-size: 12px;
}

.dashboard-fact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #edf0f5;
  padding: 9px 0;
}

.dashboard-fact:last-child {
  border-bottom: 0;
}

.dashboard-fact span {
  color: var(--muted);
}

.dashboard-fact strong {
  text-align: right;
}

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

.panel-header h2 { margin: 0; font-size: 17px; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar input { min-width: 240px; }

.stock-accordion {
  overflow: hidden;
}

.stock-accordion-toggle {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border: 0;
  background: #f4f7fa;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.stock-accordion-toggle:hover {
  background: #edf2f6;
}

.stock-accordion-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease;
}

.stock-accordion.is-open .stock-accordion-chevron {
  transform: rotate(225deg);
}

.stock-accordion-body {
  display: none;
  border-top: 1px solid var(--line);
}

.stock-accordion.is-open .stock-accordion-body {
  display: block;
}

.stock-accordion-body > form {
  padding: 16px;
}

.stock-accordion-tools {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.stock-accordion-tools input {
  width: min(360px, 100%);
}

.dealer-cart-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.dealer-order-form .panel-subhead {
  padding: 20px 16px 0;
}

.dealer-order-form .panel-subhead h3 {
  margin: 0;
  font-size: 17px;
}

.dealer-order-form .dealer-order-message {
  margin: 14px 16px 0;
}

.dealer-order-form input[readonly],
.dealer-order-form textarea[readonly] {
  background: #f8fafc;
  color: #475467;
}

.pos-slip-panel {
  margin-top: 16px;
}

.pos-slip-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.pos-slip-upload-row input[type="file"] {
  min-width: 0;
  flex: 1;
}

.pos-slip-picker {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 8px;
}

.pos-slip-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pos-slip-native-input {
  display: none;
}

.pos-slip-selection-summary {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pos-slip-picker [data-pos-slip-clear] {
  justify-self: start;
}

@media (max-width: 620px) {
  .dealer-order-form .panel-subhead {
    padding: 16px 12px 0;
  }

  .dealer-order-form .dealer-order-message {
    margin: 12px 12px 0;
  }

  .pos-slip-upload-row {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }
}

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

.cart-inline input,
.small-input {
  width: 72px;
  min-width: 72px;
}

.dealer-customer-head {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

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

.purchase-invoice-lines {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}
.toolbar select { border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; background: #fff; }

.receipt-action-header {
  justify-content: flex-end;
  padding-bottom: 10px;
}

.report-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 160px 180px auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.report-toolbar .field { margin-bottom: 0; }
.report-toolbar > *,
.order-report-toolbar > *,
.form-grid > * {
  min-width: 0;
}

input[type="date"] {
  min-width: 0;
  max-width: 100%;
}
.report-metrics { padding: 0 16px 16px; }

.sales-report-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.order-report-kpis {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  padding: 14px 16px 10px;
}

.order-report-kpis .metric {
  padding: 12px 14px;
}

.order-report-kpis .metric strong {
  font-size: 24px;
  margin-top: 4px;
}

.order-report-toolbar {
  grid-template-columns: minmax(280px, 1fr) repeat(4, minmax(130px, 150px)) auto auto;
  padding: 10px 16px 14px;
  border-top: 1px solid #edf0f5;
}

.order-report-toolbar .search-field {
  grid-column: auto;
}

.order-report-print-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 14px;
  white-space: nowrap;
}

.order-report-batch-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-report-batch-actions[hidden] {
  display: none;
}

.order-report-batch-actions label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.marketplace-order-address-products {
  min-width: 260px;
  line-height: 1.35;
}

.marketplace-order-address-products > strong {
  display: block;
  margin-bottom: 6px;
}

.marketplace-order-address-products > div {
  display: grid;
  gap: 3px;
  color: #475467;
  font-size: 12px;
}

.marketplace-order-address-products span {
  display: block;
}

.accounting-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.accounting-toolbar .field {
  margin-bottom: 0;
}

.accounting-invoice-no {
  min-width: 170px;
  width: 100%;
  text-transform: uppercase;
}

.accounting-metrics {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  padding: 14px 16px 10px;
}

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

.notification-preference-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.notification-preference-item input { margin-top: 3px; }
.notification-preference-item span { display: grid; gap: 3px; min-width: 0; }
.notification-preference-item small { color: var(--muted); line-height: 1.35; }

.delivery-order-matches {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.delivery-order-match {
  display: grid;
  grid-template-columns: 150px minmax(150px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.delivery-order-match:hover { border-color: var(--brand); background: #f0fdfa; }
.delivery-order-match small { color: var(--muted); }

@media (max-width: 700px) {
  .order-report-print-toolbar {
    display: none;
  }

  .notification-preference-grid { grid-template-columns: 1fr; }
  .delivery-order-match { grid-template-columns: 1fr; gap: 4px; }
}

.service-delivery-modal {
  max-width: min(1100px, calc(100vw - 32px));
  width: 100%;
}

.service-delivery-modal-body {
  display: grid;
  gap: 18px;
  max-height: min(72vh, 760px);
  overflow: auto;
}

.service-cod-fields {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  padding: 14px;
}

.service-cod-fields legend {
  font-weight: 700;
  padding: 0 6px;
}

.service-final-confirm {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 6px;
  padding: 12px;
}

.service-history h3 { margin: 0 0 10px; }

.accounting-metrics .metric {
  padding: 12px 14px;
}

.accounting-metrics .metric strong {
  font-size: 24px;
  margin-top: 4px;
}

.accounting-toolbar #accListBtn {
  grid-column: 1 / -1;
  width: 100%;
}

.marketplace-report-toolbar {
  grid-template-columns: 160px 160px auto auto;
}

.marketplace-report-tabs {
  padding: 0 16px 14px;
}

.marketplace-report-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  padding: 0 16px 16px;
}

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

.marketplace-report-grid .wide {
  grid-column: 1 / -1;
}

.dimension-report-section {
  padding: 0;
  overflow: hidden;
}

.dimension-report-summary {
  min-height: 52px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.dimension-report-summary::-webkit-details-marker {
  display: none;
}

.dimension-report-summary h2 {
  margin: 0;
  font-size: 16px;
}

.dimension-report-summary span {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.dimension-report-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.dimension-report-section[open] > .dimension-report-summary::after {
  transform: rotate(225deg);
}

.dimension-report-tools {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.dimension-report-tools input {
  width: min(320px, 100%);
}

.dimension-report-scroll {
  max-height: min(52vh, 520px);
  overflow: auto;
}

.dimension-report-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.accounting-table select,
.accounting-table textarea {
  width: 100%;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.accounting-table textarea {
  min-width: 190px;
  resize: vertical;
}

.payment-split {
  display: grid;
  gap: 10px;
}

.payment-rows {
  display: grid;
  gap: 8px;
}

.payment-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 180px) auto;
  gap: 8px;
  align-items: center;
}

.payment-row select,
.payment-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.payment-add-btn {
  justify-self: start;
}

.cash-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cash-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.cash-tabs button.active {
  background: #dff8f3;
  border-color: var(--primary);
  color: var(--primary-dark);
}

.cash-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  padding: 14px 16px;
}

.credit-card-checkbox {
  align-content: end;
}

.stock-accordion-body > form.credit-card-accordion-form {
  padding: 0;
}

.credit-card-checkbox label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.credit-card-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 auto;
}

.stock-movement-filters {
  display: grid;
  grid-template-columns: minmax(145px, 0.7fr) minmax(145px, 0.7fr) minmax(260px, 1.5fr) minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.stock-movement-filters .field {
  min-width: 0;
}

.stock-movement-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.stock-movement-count {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

@media (max-width: 1050px) {
  .stock-movement-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-movement-search,
  .stock-movement-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .stock-movement-filters {
    grid-template-columns: 1fr;
  }

  .stock-movement-search,
  .stock-movement-actions {
    grid-column: auto;
  }
}

.pos-rule-groups {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.pos-rule-group {
  min-width: 0;
  max-width: 100%;
}

.pos-rule-group + .pos-rule-group {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.pos-rule-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--text);
}

.pos-rule-group-title span {
  color: var(--muted);
  font-size: 12px;
}

.pos-rule-group-title .card-program-heading {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.pos-rule-group-title .card-program-heading > span:last-child {
  color: var(--text);
  font-size: inherit;
}

.card-program-logo-frame {
  position: relative;
  display: inline-flex;
  flex: 0 0 86px;
  width: 86px;
  height: 24px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}

.card-program-logo-frame img {
  display: block;
  width: 84px;
  height: auto;
  max-width: none;
}

.card-program-logo-fallback {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.pos-rule-table th,
.pos-rule-table td {
  padding-top: 6px;
  padding-bottom: 6px;
  line-height: 1.2;
}

.pos-rule-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

table.pos-rule-flat {
  min-width: 940px;
}

.pos-rule-flat th,
.pos-rule-flat td {
  white-space: nowrap;
  vertical-align: middle;
}

.pos-rule-flat th:first-child,
.pos-rule-flat td:first-child {
  min-width: 150px;
  white-space: normal;
}

.pos-rule-installment {
  display: inline-block;
  margin-right: 8px;
}

.pos-rule-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
}

.pos-rule-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 620px) {
  .card-program-logo-frame {
    flex-basis: 72px;
    width: 72px;
  }

  .card-program-logo-frame img {
    width: 70px;
  }

  .pos-rule-group .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }

  .pos-rule-flat th,
  .pos-rule-flat td {
    padding: 7px 8px;
  }
}

.payment-iban-value {
  font-family: Consolas, "Courier New", monospace;
  white-space: nowrap;
}

.pos-credential {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cash-in-row td {
  background: #f0fdf4;
}

.cash-out-row td {
  background: #fff1f2;
}

.integration-response-json {
  width: 100%;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e5eefb;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.operation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 0 16px 16px;
}

.operation-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.operation-heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.operation-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff7ed;
}

.operation-card.hot-1 { background: #fff7ed; }
.operation-card.hot-2 { background: #ffedd5; }
.operation-card.hot-3 { background: #fed7aa; }
.operation-card.hot-4 { background: #fdba74; }
.operation-card.hot-5 { background: #fb923c; }

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

.operation-card-head span {
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, .75);
  font-weight: 700;
}

.operation-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #344054;
  font-size: 12px;
}

.operation-mini-stats span {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, .7);
}

.operation-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.operation-title h2 {
  margin: 0;
}

.operation-title > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #176c60;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.operation-title > span i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #20a77d;
  box-shadow: 0 0 0 0 rgba(32, 167, 125, .5);
  animation: operation-live-pulse 2s infinite;
}

@keyframes operation-live-pulse {
  70% { box-shadow: 0 0 0 8px rgba(32, 167, 125, 0); }
  100% { box-shadow: 0 0 0 0 rgba(32, 167, 125, 0); }
}

.dashboard-operation-panel {
  margin-bottom: 16px;
}

.dashboard-metrics-compact {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.topbar-title small {
  color: #66737c;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.product-finance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  background: #dfe6e8;
}

.product-finance-grid .dashboard-fact {
  min-width: 0;
  padding: 16px;
  background: #ffffff;
}

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

.operation-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid #d5dee2;
  border-radius: 7px;
  background: #eef3f4;
  overflow-x: auto;
}

.operation-segment button {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  padding: 5px 10px;
  background: transparent;
  color: #52606a;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.operation-segment button.active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
}

.operation-map-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  border: 1px solid #cfdadd;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.operation-map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #dff2f3;
}

.operation-map-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 70px rgba(37, 84, 86, .12);
}

.operation-map-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.operation-map-canvas svg {
  width: 100%;
  height: 100%;
  max-height: 680px;
  display: block;
  transform-origin: 0 0;
  transition: transform .32s ease;
}

.operation-map-canvas svg path[id^="ilce_"] {
  vector-effect: non-scaling-stroke;
  transition: fill .28s ease, opacity .24s ease, stroke-width .2s ease;
}

.operation-map-canvas svg path[id^="ilce_"].has-load {
  stroke-dasharray: 4 2;
  animation: operation-district-flow 3.2s linear infinite;
}

.operation-map-canvas.is-focused svg path[id^="ilce_"].is-selected {
  stroke-dasharray: none;
  filter: drop-shadow(0 7px 10px rgba(15, 23, 42, .24)) !important;
}

@keyframes operation-district-flow {
  to { stroke-dashoffset: -12; }
}

.operation-map-tooltip {
  position: absolute;
  z-index: 4;
  width: max-content;
  max-width: 210px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(17, 24, 39, .94);
  color: #ffffff;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .22);
}

.operation-focus-summary {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(300px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 7px;
  background: rgba(255, 255, 255, .9);
  color: #18232b;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .22);
  backdrop-filter: blur(5px);
}

.operation-focus-summary[hidden] {
  display: none;
}

.operation-focus-summary > span {
  display: block;
  color: #64727b;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.operation-focus-summary h3 {
  margin: 4px 0 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.operation-focus-summary > strong {
  display: block;
  color: #087d70;
  font-size: 26px;
}

.operation-focus-summary > strong small {
  font-size: 12px;
}

.operation-focus-summary > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.operation-focus-summary > div b {
  padding: 6px;
  border: 1px solid #dce5e7;
  border-radius: 4px;
  background: #f8faf9;
  font-size: 10px;
}

.operation-focus-summary section {
  margin-top: 10px;
  padding-top: 7px;
  border-top: 1px solid #d9e2e4;
  text-align: left;
}

.operation-focus-summary p {
  margin: 0;
  padding: 4px 0;
}

.operation-focus-summary p b,
.operation-focus-summary p span {
  display: block;
}

.operation-focus-summary p b {
  font-size: 10px;
}

.operation-focus-summary p span {
  margin-top: 1px;
  color: #607079;
  font-size: 9px;
}

.operation-map-tooltip strong,
.operation-map-tooltip span {
  display: block;
}

.operation-map-tooltip span {
  margin-top: 2px;
  color: #d5e3e5;
  font-size: 11px;
}

.operation-map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 6px;
  background: rgba(255, 255, 255, .9);
  color: #344054;
  font-size: 11px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .09);
}

.operation-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.operation-map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--legend-color);
}

.operation-map-reset {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 6px;
  padding: 6px 11px;
  background: rgba(17, 24, 39, .9);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.operation-district-detail {
  min-width: 0;
  padding: 18px;
  border-top: 1px solid #d7e0e3;
  border-left: 0;
  background: #fbfcfc;
  overflow: auto;
}

.operation-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #dfe6e8;
}

.operation-detail-head span {
  color: #64727b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.operation-detail-head h3 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.operation-detail-head > strong {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font-size: 20px;
}

.operation-detail-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 14px 0;
  border: 1px solid #dfe6e8;
  background: #dfe6e8;
}

.operation-detail-stats span {
  min-height: 58px;
  padding: 9px;
  background: #ffffff;
  color: #66737c;
  font-size: 11px;
}

.operation-detail-stats b {
  display: block;
  color: #18232b;
  font-size: 17px;
}

.operation-detail-orders h4,
.operation-ranking h4 {
  margin: 16px 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  color: #5a6871;
}

.operation-detail-orders a {
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid #e1e7e9;
  color: #18232b;
  text-decoration: none;
}

.operation-detail-orders a:hover {
  color: #087d70;
}

.operation-detail-orders a strong,
.operation-detail-orders a span,
.operation-detail-orders a small {
  display: block;
  overflow-wrap: anywhere;
}

.operation-detail-orders a span {
  margin-top: 2px;
  font-size: 12px;
}

.operation-detail-orders a small {
  margin-top: 3px;
  color: #71808a;
  font-size: 10px;
}

.operation-ranking button {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid #e2e8ea;
  padding: 5px 0;
  background: transparent;
  color: #26343c;
  text-align: left;
  cursor: pointer;
}

.operation-ranking button b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e7edef;
  font-size: 10px;
}

.operation-ranking button strong {
  color: #087d70;
}

.driver-performance-presets .active {
  background: var(--brand);
  color: #fff;
}

.driver-performance-range {
  padding: 12px 16px 0;
}

.driver-performance-metrics {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  padding-top: 12px;
}

.driver-performance-table {
  min-width: 620px;
}

.driver-day-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  padding: 12px 16px 16px;
}

.driver-day-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.driver-day-strip strong,
.driver-day-strip span {
  display: block;
}

.driver-day-strip span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.operation-rank {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  max-height: 560px;
  overflow: auto;
}

.operation-rank h3 {
  margin: 0 0 10px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #edf0f5;
}

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

.alert-accordion {
  grid-column: 1 / -1;
}

.forecast-toolbar {
  display: grid;
  grid-template-columns: 220px 180px 180px auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.forecast-toolbar .field {
  margin-bottom: 0;
}

#forecastArea {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

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

.forecast-grid .wide,
.panel.wide {
  grid-column: 1 / -1;
}

.forecast-panel-body {
  padding: 16px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.forecast-panel-body table {
  width: max-content;
  min-width: min(760px, 100%);
}

.forecast-actions {
  display: grid;
  gap: 8px;
}

.forecast-ai-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.forecast-ai-actions,
.forecast-ai-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.forecast-ai-summary span {
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 13px;
}

.forecast-ai-label {
  font-weight: 700;
  font-size: 13px;
}

.forecast-ai-preview {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

.analysis-tab-panel {
  display: none;
  padding: 0 16px 16px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

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

.analysis-section {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.analysis-section h3 {
  margin: 0;
  font-size: 16px;
}

.forecast-comment {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.definition-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 16px;
}

.definition-new {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.definition-new h3 {
  margin: 0 0 12px;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.clean-definition {
  background: #fff;
}

.compact-definition-grid {
  grid-template-columns: minmax(220px, 360px) 110px 130px;
  align-items: end;
  max-width: 720px;
}

.sub-category-definition-grid {
  grid-template-columns: minmax(220px, 280px) minmax(220px, 360px) 110px 130px;
  max-width: 940px;
}

.clean-definition-table {
  min-width: 640px;
}

.clean-definition-table th,
.clean-definition-table td {
  vertical-align: middle;
}

.clean-definition-table td:first-child {
  width: 44%;
}

.clean-definition-table select,
.clean-definition-table input {
  min-height: 36px;
}

.clean-definition-table .action-cell {
  white-space: nowrap;
  width: 150px;
}

.settings-behavior {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 18px;
  padding: 16px;
}

.settings-behavior h3 {
  margin: 0 0 8px;
}

.settings-behavior p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.settings-option-card {
  display: grid;
  gap: 10px;
  max-width: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.settings-option-group {
  display: grid;
  gap: 9px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.settings-option-group:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-option-card label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.settings-option-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.integration-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.integration-tabs {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.integration-card[hidden],
#integrationCardsArea[hidden],
.integration-log-panel[hidden] {
  display: none !important;
}

.integration-log-panel {
  margin-top: 16px;
}

.integration-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  min-width: 0;
}

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

.integration-card h3 {
  margin: 0 0 6px;
}

.integration-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.integration-form {
  padding: 0;
}

.integration-form .message-box {
  grid-column: 1 / -1;
}

.online-sales-shell {
  overflow: hidden;
}

.online-sales-header p {
  margin: 5px 0 0;
}

.online-sales-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  border-top: 0;
  scrollbar-width: thin;
}

.online-sales-tabs .pill-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  text-decoration: none;
}

.online-sales-mode-band {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.online-sales-mode-band span {
  color: #7c2d12;
  font-size: 13px;
}

.metrics.online-sales-metrics {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  padding: 16px;
}

.metrics.online-sales-metrics .metric {
  box-shadow: none;
}

.online-sales-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.online-sales-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.online-sales-toolbar.history {
  grid-template-columns: repeat(4, minmax(150px, 220px));
}

.online-sales-toolbar .field {
  margin-bottom: 0;
}

.online-sales-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.online-sales-table {
  min-width: 1080px;
}

.online-sales-table th,
.online-sales-table td,
.online-sales-rule-table th,
.online-sales-rule-table td {
  vertical-align: middle;
}

.online-sales-rule-table {
  min-width: 680px;
}

.online-sales-empty-row td {
  height: 96px;
  color: var(--muted);
  text-align: center;
}

.online-sales-matching-table {
  min-width: 1380px;
}

.online-sales-matching-table td:nth-child(4) {
  min-width: 260px;
}

.online-sales-category-cell {
  color: #344054;
}

.online-sales-unmatched-row > td {
  background: #fffcf5;
}

.online-sales-match-modal {
  width: min(1180px, calc(100vw - 32px));
  max-width: 1180px;
}

.online-sales-match-choices {
  max-height: min(60vh, 620px);
  overflow: auto;
}

.online-sales-match-choices table {
  min-width: 820px;
}

.online-sales-match-choices thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 1050px) {
  .online-sales-overview-grid {
    grid-template-columns: 1fr;
  }

  .online-sales-toolbar,
  .online-sales-toolbar.history {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .online-sales-tabs {
    padding: 10px 12px;
  }

  .online-sales-mode-band {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 11px 12px;
  }

  .metrics.online-sales-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .online-sales-toolbar,
  .online-sales-toolbar.history {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

.integration-mode-note {
  margin: 0 16px 16px;
}

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

.integration-summary .metric {
  padding: 12px;
}

.integration-summary .metric strong {
  font-size: 20px;
}

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

.integration-queue-table table {
  min-width: 620px;
}

.integration-webhook {
  display: grid;
  gap: 8px;
}

.integration-webhook label {
  font-weight: 800;
}

.panel-soft {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  margin-bottom: 16px;
}

.integration-test-note {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.copy-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-line input {
  min-width: 0;
}

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

.permission-grid .settings-option-card {
  max-width: none;
}

.notification-permission-card {
  cursor: pointer;
  min-width: 0;
}

.notification-permission-card:hover {
  border-color: var(--primary);
  background: #f4fbfa;
}

.notification-permission-card .check-row {
  color: var(--text);
  font-size: 14px;
}

.integration-visibility-card {
  max-width: 760px;
}

.integration-visibility-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  margin: 0;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  font-weight: 700;
}

.settings-option-card .inline-form {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.settings-option-card .inline-form label {
  display: grid;
  gap: 6px;
  align-items: start;
}

.settings-option-card input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.definition-table input,
.definition-table select {
  min-width: 130px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.definition-table input[readonly],
.definition-table select:disabled {
  background: #f3f4f6;
  color: var(--muted);
}

.text-ok {
  color: var(--ok);
}

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

.action-cell {
  white-space: nowrap;
}

.mini-btn {
  border: 0;
  border-radius: 7px;
  padding: 7px 9px;
  margin: 2px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mini-btn.secondary { background: #344054; }
.mini-btn.danger { background: #dc2626; }

.portal-match-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.portal-match-picker select {
  min-width: 180px;
  max-width: 320px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.product-filter-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.filter-block {
  display: grid;
  gap: 10px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.pill-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  color: #101828;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pill-btn.active {
  border-color: var(--brand);
  background: #e6fffb;
  color: var(--brand-dark);
}

.product-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-list-area {
  padding: 16px;
}

.product-category-title {
  margin: 2px 0 10px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #111827;
  color: #fff;
  font-weight: 700;
}

.product-category-title span {
  color: #cbd5e1;
  font-size: 12px;
  margin-left: 6px;
}

.product-list-table {
  margin-bottom: 18px;
}

.product-list-table input {
  min-width: 110px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.stock-price-head .panel-header {
  align-items: flex-start;
}

.stock-price-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stock-price-switches label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  color: #344054;
}

.stock-price-actions {
  margin-top: -2px;
  justify-content: flex-start;
}

.stock-price-group-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 4px 0 8px;
  padding: 10px 12px;
  border-radius: 7px;
  background: #111827;
  color: #fff;
}

.stock-price-group-title span {
  color: #cbd5e1;
  font-size: 12px;
}

.stock-price-wrap {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stock-price-table {
  min-width: 1180px;
}

.stock-price-table th {
  white-space: nowrap;
}

.stock-price-table td {
  vertical-align: middle;
}

.stock-price-table td:first-child {
  min-width: 220px;
}

.stock-price-table td:first-child span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stock-price-table input {
  width: 110px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.stock-price-table tr.price-missing td {
  background: #fff7f7;
}

.stock-price-table tr.cost-missing td {
  background: #fffbeb;
}

.stock-price-table tr.changed-row td {
  box-shadow: inset 3px 0 0 var(--brand);
}

.stock-cell {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 800;
}

.stock-cell.ok {
  background: #dcfae6;
  color: var(--ok);
}

.stock-cell.zero {
  background: #f2f4f7;
  color: #667085;
}

.stock-cell.bad {
  background: #fee4e2;
  color: var(--danger);
}

.product-control-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.control-card {
  border: 1px solid var(--line);
  border-left: 5px solid #dc2626;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .06);
}

.product-control-guide {
  margin: 0 16px 12px;
}

.product-edit-warning {
  margin: 0 16px 12px;
}

.control-title {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 700;
}

.control-meta {
  margin-bottom: 12px;
  color: #475467;
  font-size: 13px;
  line-height: 1.55;
}

.control-lines {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.control-lines div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.control-lines span {
  color: var(--muted);
  text-align: right;
}

.control-match-box {
  margin: 12px 0;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  background: #fbfdff;
}

.control-match-box label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.control-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.product-merge-modal {
  min-width: min(860px, 90vw);
}

.product-merge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 16px 0;
}

.product-merge-field > label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

.product-merge-arrow {
  padding-top: 36px;
  color: var(--danger);
  font-size: 28px;
  font-weight: 700;
  text-align: center;
}

.product-merge-selection {
  min-height: 58px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.product-merge-selection strong,
.product-merge-selection small {
  display: block;
}

.product-merge-selection strong {
  color: var(--text);
  margin-bottom: 4px;
}

.danger-badge {
  color: #dc2626;
  font-weight: 700;
  margin-left: 5px;
}

.count-badge {
  display: inline-block;
  min-width: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.ok-btn {
  background: #16a34a;
}

@media (max-width: 720px) {
  .control-match-row,
  .control-lines div {
    grid-template-columns: 1fr;
    display: grid;
  }

  .control-lines span {
    text-align: left;
  }

  .product-merge-modal {
    min-width: 0;
  }

  .product-merge-grid {
    grid-template-columns: 1fr;
  }

  .product-merge-arrow {
    padding: 0;
    transform: rotate(90deg);
  }
}

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

.left {
  text-align: left;
}

.table-wrap { overflow: auto; }

.purchase-receive-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
}

.purchase-receive-summary span {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.purchase-receive-table { min-width: 1080px; }

.purchase-receive-table select,
.purchase-receive-table input { min-width: 120px; }

.purchase-control-actions {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 270px;
}

.purchase-control-actions .barcode-scan-btn {
  position: static;
  grid-column: 1 / -1;
  width: 100%;
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #edf0f5; font-size: 13px; vertical-align: top; }
th { color: #475467; background: #f8fafc; font-size: 12px; text-transform: uppercase; }

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #eef2f6;
  color: #344054;
}

.status.ok { background: #dcfae6; color: var(--ok); }
.status.warn { background: #fff4df; color: var(--warn); }
.status.danger { background: #fee4e2; color: var(--danger); }
.status.bad { background: #fee4e2; color: var(--danger); }
.marketplace-delivery-error {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status.order-print-updated {
  background: #fee4e2;
  color: #b42318;
  border: 1px solid #fda29b;
  font-weight: 700;
}

tr.order-row-updated > td {
  background: #fff5f4;
}

tr.order-row-updated > td:first-child {
  box-shadow: inset 4px 0 0 #d92d20;
}

.compact-metrics {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  padding: 14px 16px;
}

.compact-metrics .metric {
  padding: 12px;
}

.compact-metrics .metric strong {
  margin-top: 4px;
  font-size: 22px;
}

.invoice-mode-banner {
  margin: 0 16px 14px;
  padding: 10px 12px;
  border: 1px solid #f2cc8f;
  background: #fff8e8;
  color: #8a4600;
  font-size: 13px;
  font-weight: 700;
}

.marketplace-invoice-toolbar .field.grow {
  min-width: 260px;
  flex: 1 1 320px;
}

.marketplace-invoice-table-wrap {
  max-height: 62vh;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.marketplace-invoice-table {
  min-width: 1380px;
}

.marketplace-invoice-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
}

.marketplace-invoice-table td {
  max-width: 280px;
}

.invoice-ref-stack {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.invoice-error {
  display: inline-block;
  max-width: 260px;
  margin-top: 5px;
  font-size: 11px;
}

.invoice-preview-list {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0;
  margin: 0;
  border: 1px solid var(--border);
}

.invoice-preview-list dt,
.invoice-preview-list dd {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.invoice-preview-list dt {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 700;
}

.invoice-preview-list dt:last-of-type,
.invoice-preview-list dd:last-of-type {
  border-bottom: 0;
}

.invoice-preview-body .invoice-mode-banner {
  margin: 0 0 14px;
}

.accounting-channel-tabs {
  padding: 0 16px 12px;
}

.accounting-receipt-modal {
  width: min(1240px, calc(100vw - 32px));
  max-width: 1240px;
}

.accounting-receipt-modal-header {
  gap: 12px;
}

.accounting-receipt-modal-header .inline-actions {
  justify-content: flex-end;
}

.accounting-receipt-modal-body {
  padding: 0;
}

.receipt-slip-gallery {
  min-height: 560px;
  padding: 18px;
  background: #f8fafc;
}

.receipt-slip-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.receipt-slip-gallery-head h3,
.receipt-slip-gallery-head p {
  margin: 0;
}

.receipt-slip-gallery-head p,
.receipt-slip-card-info small {
  color: var(--muted);
}

.receipt-slip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.receipt-slip-card {
  display: grid;
  grid-template-rows: 260px auto;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.receipt-slip-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #eef2f6;
}

.receipt-slip-file-preview {
  display: grid;
  place-items: center;
  color: #b42318;
  font-size: 30px;
  font-weight: 800;
  background: #fef3f2;
}

.receipt-slip-card-info {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
}

.accounting-receipt-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 180px);
  min-height: 560px;
  border: 0;
  background: #fff;
}

.inline-actions,
.dealer-logo-match {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dealer-logo-match {
  min-width: 210px;
  align-items: flex-start;
  flex-direction: column;
}

.dealer-logo-match select {
  min-width: 230px;
}

.dealer-logo-process {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.dealer-logo-flow {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 4px;
}

.dealer-logo-flow span {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 5px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.dealer-logo-flow span.done {
  border-color: #86efac;
  background: #dcfae6;
  color: var(--ok);
}

.dealer-logo-flow span.current {
  border-color: #f5c76b;
  background: #fff4df;
  color: var(--warn);
}

.dealer-logo-flow span.failed {
  border-color: #fca5a5;
  background: #fee4e2;
  color: var(--danger);
}
.status.cancelled {
  background: #dc2626;
  color: #fff;
  font-weight: 700;
  border: 1px solid #b91c1c;
}

.status.cancelled,
.status.status-cancelled {
  background: #c81e1e !important;
  border-color: #c81e1e !important;
  color: #fff !important;
  font-weight: 700;
}

.purchase-metrics {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-top: 14px;
}

.purchase-status-select.ok {
  border-color: #abefc6;
  background: #ecfdf3;
  color: var(--ok);
  font-weight: 700;
}

.purchase-status-select.warn {
  border-color: #fedf89;
  background: #fffaeb;
  color: var(--warn);
  font-weight: 700;
}

.purchase-status-select.bad {
  border-color: #fecdca;
  background: #fef3f2;
  color: var(--danger);
  font-weight: 700;
}
.inline-status { margin-left: 8px; vertical-align: middle; }

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

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

.dispatch-ready-orders td:nth-child(3) {
  min-width: 260px;
  white-space: normal;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.left-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.wide { grid-column: 1 / -1; }

.message-box {
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
}

.message-box.ok {
  background: #dcfae6;
  color: var(--ok);
}

.message-box.bad {
  background: #fee4e2;
  color: var(--danger);
}

.message-box.warn {
  background: #fff4df;
  color: var(--warn);
}

.split-control {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.stock-count-entry {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(150px, 0.65fr);
  gap: 14px;
  padding: 16px;
  align-items: start;
}

.stock-count-session {
  display: grid;
  gap: 10px;
  margin: 14px 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stock-count-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stock-count-session-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stock-count-session-meta span {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.stock-count-session-meta b {
  color: var(--text);
}

.stock-count-history-detail {
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.stock-count-history-detail .panel-header {
  border-bottom: 1px solid var(--line);
}

.stock-count-entry .field,
.stock-count-entry input,
.stock-count-entry select {
  min-width: 0;
  width: 100%;
}

.stock-count-depot {
  grid-column: 1 / -1;
}

.stock-count-product,
.stock-count-selected,
.stock-count-note {
  grid-column: 1;
}

.stock-count-qty {
  grid-column: 2;
  grid-row: 2 / span 2;
  display: grid;
  gap: 8px;
  align-content: start;
}

.count-save-inline {
  width: 100%;
}

.count-selected-product {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.count-selected-product strong {
  font-size: 14px;
}

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

.count-diff-zero {
  color: var(--ok);
}

.count-diff-plus,
.count-diff-minus {
  color: var(--danger);
}

.order-lines {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.order-line-actions {
  display: flex;
  justify-content: flex-start;
  padding: 0 16px 16px;
}

.order-submit-panel .form-actions {
  padding: 16px;
}

.line-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.panel-subtitle {
  padding: 4px 16px 10px;
  font-weight: 800;
}

.line-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfd;
}

.line-card-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 12px 12px 0;
}

.line-editor {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(90px, .7fr) minmax(110px, .9fr) auto;
  gap: 10px;
  align-items: end;
}

.set-actions {
  padding: 0 16px 16px;
}

.set-line-editor {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(120px, 180px);
  gap: 10px;
  padding: 12px;
  align-items: start;
}

.set-list {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

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

.set-card-head > div:first-child {
  display: grid;
  gap: 4px;
}

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

.set-count {
  min-width: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  text-align: right;
  background: #f8fafc;
}

.set-count strong {
  display: block;
  font-size: 22px;
}

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

.set-price-grid .metric {
  padding: 12px;
}

.set-lines-table {
  padding: 0;
}

.set-lines-table table {
  margin: 0;
}

.order-line-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fcfcfd;
}

.line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.line-meta strong {
  color: var(--ink);
  margin-left: auto;
}

.delivery-card {
  margin-bottom: 18px;
}

.delivery-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}

.delivery-customer-fields,
.delivery-service-fields,
.delivery-recipient-field,
.delivery-fail-fields {
  border-top: 1px solid var(--line);
}

.delivery-recipient-field {
  padding: 16px;
}

.delivery-recipient-field .field {
  margin-bottom: 0;
}

.delivery-summary {
  padding: 16px;
}

.delivery-summary h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.delivery-table th {
  background: #111827;
  color: #fff;
}

.driver-delivery-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.service-definition-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.service-delivery-table {
  min-width: 760px;
}

.service-delivery-table th:last-child,
.service-delivery-table td:last-child {
  width: 190px;
}

.driver-delivery-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.driver-delivery-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.driver-delivery-head strong,
.driver-delivery-head span {
  display: block;
}

.driver-delivery-head span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.driver-delivery-head b {
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #fff;
}

.delivery-driver-group > summary {
  cursor: pointer;
  list-style: none;
  border-bottom: 0;
}

.delivery-driver-group > summary::-webkit-details-marker {
  display: none;
}

.delivery-driver-group > summary::before {
  content: "";
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg);
}

.delivery-driver-group[open] > summary {
  border-bottom: 1px solid var(--line);
}

.delivery-driver-group[open] > summary::before {
  transform: rotate(45deg);
}

.delivery-driver-group > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.delivery-driver-group > summary > div {
  flex: 1;
  min-width: 0;
}

.delivery-overview-wrap {
  margin: 0;
}

.delivery-overview-table {
  min-width: 620px;
}

.service-tracking-orders-table {
  min-width: 1180px;
  table-layout: fixed;
}

.service-tracking-orders-table th:nth-child(1) { width: 17%; }
.service-tracking-orders-table th:nth-child(2) { width: 14%; }
.service-tracking-orders-table th:nth-child(3) { width: 20%; }
.service-tracking-orders-table th:nth-child(4) { width: 29%; }
.service-tracking-orders-table th:nth-child(5) { width: 20%; }

.service-tracking-orders-table td {
  overflow-wrap: anywhere;
}

.service-tracking-orders-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.service-tracking-orders-table .portal-match-picker select {
  max-width: 100%;
}

.service-tracking-orders-table .portal-approved {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #86efac;
  border-radius: 4px;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
}

.service-movement-table {
  min-width: 1180px;
  table-layout: fixed;
}

.service-movement-table th:nth-child(1) { width: 10%; }
.service-movement-table th:nth-child(2) { width: 19%; }
.service-movement-table th:nth-child(3) { width: 16%; }
.service-movement-table th:nth-child(4) { width: 15%; }
.service-movement-table th:nth-child(5) { width: 6%; }
.service-movement-table th:nth-child(6) { width: 14%; }
.service-movement-table th:nth-child(7) { width: 10%; }
.service-movement-table th:nth-child(8) { width: 20%; }

.service-movement-table td {
  overflow-wrap: anywhere;
}

.service-movement-order {
  font-weight: 800;
}

.delivery-table tr.delivery-history-target > td {
  background: #ecfdf5;
  border-bottom-color: #86efac;
}

.delivery-undo-table {
  min-width: 980px;
  table-layout: fixed;
}

.delivery-undo-table th:nth-child(1) { width: 14%; }
.delivery-undo-table th:nth-child(2) { width: 16%; }
.delivery-undo-table th:nth-child(3) { width: 20%; }
.delivery-undo-table th:nth-child(4) { width: 18%; }
.delivery-undo-table th:nth-child(5) { width: 14%; }
.delivery-undo-table th:nth-child(6) { width: 18%; }

.delivery-undo-table td {
  overflow-wrap: anywhere;
}

.delivery-undo-table [data-delivery-undo] {
  white-space: nowrap;
}

.delivery-table tr.service-route-row > td {
  background: #ecfdf5;
  border-bottom-color: #a7f3d0;
}

.delivery-table tr.service-route-row:hover > td {
  background: #d1fae5;
}

.service-route-panel {
  border-left: 5px solid #047857;
}

.service-route-label {
  display: inline-block;
  margin-top: 4px;
  color: #065f46;
  font-size: 12px;
  font-weight: 800;
}

.delivery-count {
  width: 100%;
  min-width: 80px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.signature-pad-wrap {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.signature-pad,
.signature-preview {
  width: 100%;
  height: 230px;
  border: 2px dashed #98a2b3;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  display: block;
}

.signature-receipt {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding: 16px;
  width: 50%;
  max-width: 430px;
  min-width: 320px;
}

.signature-receipt h3 {
  margin: 0 0 10px;
}

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

.receipt-head > div {
  display: grid;
  gap: 4px;
}

.receipt-head > div:last-child {
  text-align: right;
}

.receipt-head strong {
  font-size: 18px;
}

.receipt-head span {
  color: var(--muted);
}

.receipt-document-head {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(170px, 1fr);
  grid-template-areas:
    "logo meta"
    "legal contact";
  align-items: start;
  gap: 16px 28px;
}

.receipt-logo-row {
  grid-area: logo;
  display: flex !important;
  justify-content: center;
  align-items: flex-start;
  min-height: 110px;
}

.receipt-company-block {
  align-self: start;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.receipt-company-legal {
  grid-area: legal;
}

.receipt-company-contact {
  grid-area: contact;
}

.receipt-company-block strong {
  font-size: 14px;
  line-height: 1.35;
}

.receipt-company-block span {
  color: #344054;
  font-size: 12px;
  line-height: 1.35;
}

.receipt-company-block .receipt-related-person {
  font-size: 12px;
  line-height: 1.35;
}

.receipt-logo-block {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px !important;
}

.receipt-logo-block > div {
  display: grid;
  gap: 3px;
}

.receipt-logo-mark {
  width: 58px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.receipt-logo-image {
  width: min(330px, 76%);
  height: 110px;
  object-fit: contain;
  border-radius: 0;
}

.receipt-doc-meta {
  grid-area: meta;
  min-width: 170px;
  display: grid;
  justify-items: center;
  align-self: start;
  text-align: center;
  gap: 7px;
}

.receipt-doc-meta strong {
  font-size: 16px;
  line-height: 1.2;
}

.receipt-doc-meta span {
  color: #344054;
  line-height: 1.2;
}

.receipt-qr {
  width: 170px;
  height: 170px;
  border: 0;
  background: #fff;
  padding: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.receipt-doc-meta small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.receipt-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px;
}

.receipt-info-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.receipt-info-box h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.receipt-line {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #f2f4f7;
  font-size: 13px;
}

.receipt-line:first-of-type {
  border-top: 0;
}

.receipt-line span {
  color: var(--muted);
}

.receipt-line strong {
  font-size: 13px;
  font-weight: 700;
}

.receipt-summary {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 16px;
  padding: 16px;
  border-top: 1px solid #d0d5dd;
}

.receipt-panel .table-wrap {
  padding: 0 16px;
}

.receipt-panel .table-wrap table {
  min-width: 0;
  border-top: 1px solid #d0d5dd;
  border-bottom: 1px solid #d0d5dd;
}

.receipt-panel .table-wrap th,
.receipt-panel .table-wrap td {
  border-bottom-color: #d0d5dd;
}

.receipt-panel .table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.mobile-receipt-close {
  display: none;
}

.receipt-note,
.receipt-total-box {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.receipt-note {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.receipt-note span {
  color: var(--muted);
  line-height: 1.5;
}

.receipt-total-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  align-content: start;
}

.receipt-total-box > span,
.receipt-total-box > strong {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.25;
}

.receipt-total-box > span {
  color: var(--muted);
}

.receipt-total-box > strong {
  text-align: right;
  font-weight: 700;
}

.receipt-total-box .receipt-payment-title {
  grid-column: 1 / -1;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.receipt-total-box > :nth-last-child(-n + 2) {
  border-bottom: 0;
}

.receipt-total-box .receipt-payment-remaining {
  color: #b91c1c;
  font-weight: 700;
}

.dispatch-note-panel {
  max-width: 980px;
  margin-inline: auto;
  color: #111827;
  background: #fff;
}

.dispatch-print-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  padding-top: 12px;
}

.dispatch-print-settings .field {
  min-width: 145px;
  flex: 1 1 145px;
  margin: 0;
}

.dispatch-print-header .toolbar {
  flex-wrap: wrap;
}

.dispatch-note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-bottom: 2px solid #111827;
}

.dispatch-note-title {
  display: grid;
  gap: 7px;
}

.dispatch-note-title span {
  color: #475467;
  font-size: 13px;
  font-weight: 800;
}

.dispatch-note-title strong {
  font-size: 30px;
  line-height: 1.1;
}

.dispatch-note-title small {
  color: #667085;
  font-size: 14px;
}

.dispatch-note-qr {
  width: 150px;
  height: 150px;
  display: block;
  background: #fff;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.dispatch-note-delivery,
.dispatch-note-order-note,
.dispatch-note-products {
  padding: 22px 24px;
}

.dispatch-note-delivery,
.dispatch-note-order-note {
  border-bottom: 1px solid #d0d5dd;
}

.dispatch-note-delivery h2,
.dispatch-note-order-note h2,
.dispatch-note-products h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.dispatch-note-order-note p {
  margin: 0;
  color: #111827;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.marketplace-delivery-pilot-note {
  margin: 16px;
}

.dispatch-note-delivery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
}

.dispatch-note-delivery-grid .receipt-line strong {
  overflow-wrap: anywhere;
}

.dispatch-note-delivery-grid .receipt-line:last-child {
  grid-column: 1 / -1;
}

.dispatch-note-products .table-wrap {
  padding: 0;
}

.dispatch-note-products table {
  min-width: 0;
  border: 1px solid #d0d5dd;
}

.dispatch-note-products th {
  background: #f2f4f7;
  color: #344054;
}

.dispatch-note-products th:last-child,
.dispatch-note-products td:last-child {
  width: 90px;
  text-align: center;
}

.dispatch-note-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
  padding: 36px 24px 24px;
}

.dispatch-note-footer span {
  min-height: 72px;
  padding-top: 10px;
  border-top: 1px solid #667085;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.suggest-wrap { position: relative; }

.barcode-field {
  position: relative;
}

.barcode-field > input:not([type="hidden"]) {
  padding-right: 92px;
}

.barcode-scan-btn {
  position: absolute;
  right: 6px;
  top: 28px;
  height: 32px;
  min-width: 76px;
  border: 0;
  border-radius: 5px;
  background: #263242;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.barcode-scan-btn:hover {
  background: #111827;
}

.barcode-field-no-label .barcode-scan-btn {
  top: 6px;
}

.barcode-scanner-modal {
  width: min(560px, calc(100vw - 24px));
}

.barcode-scanner-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.barcode-video-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #111827;
  aspect-ratio: 4 / 3;
}

.barcode-video-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.barcode-html5-reader,
.barcode-html5-reader > div {
  width: 100% !important;
  height: 100% !important;
}

.barcode-html5-reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.barcode-html5-reader img,
.barcode-html5-reader button,
.barcode-html5-reader select {
  max-width: 100%;
}

.barcode-scan-line {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: #22d3ee;
  box-shadow: 0 0 18px rgba(34, 211, 238, .85);
}

.barcode-manual-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.barcode-manual-entry input {
  min-width: 0;
}

.suggest-box {
  display: grid;
  gap: 6px;
}

.suggest-wrap .suggest-box {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border-radius: 6px;
}

.suggest-wrap .suggest-box:empty {
  display: none;
}

.autocomplete-create {
  color: var(--primary);
}

@page receipt {
  size: A5 portrait;
  margin: 7mm;
}

@page dispatch {
  size: A5 portrait;
  margin: 7mm;
}

@media print {

  html,
  body {
    background: #fff;
    width: auto;
    min-width: 0;
  }

  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .layout,
  .main,
  .content {
    display: block;
    margin: 0;
    padding: 0;
    background: #fff;
    min-height: 0;
    height: auto;
  }

  .panel {
    box-shadow: none;
    border-radius: 0;
  }

  .content > :not(.receipt-panel) {
    display: none !important;
  }

  .receipt-panel {
    page: receipt;
    display: block !important;
    margin: 0;
    width: 100%;
    font-size: 9px;
  }

  .dispatch-note-panel {
    page: dispatch;
    width: var(--dispatch-print-width, 134mm);
    max-width: none;
    margin-inline: auto;
    zoom: var(--dispatch-print-scale, 1);
    break-inside: avoid;
  }

  .receipt-head {
    padding: 12px 0;
  }

  .receipt-document-head {
    border-bottom-color: #111827;
    grid-template-columns: minmax(0, 3fr) 36mm;
    grid-template-areas: "logo meta" "legal contact";
    gap: 3mm 7mm;
    align-items: start;
  }

  .receipt-logo-row { min-height: 27mm; }
  .receipt-logo-image { width: 60mm; height: 24mm; }
  .receipt-doc-meta { min-width: 0; }
  .receipt-qr { width: 30mm; height: 30mm; }
  .receipt-company-block strong,
  .receipt-company-block span { font-size: 7px; line-height: 1.35; }
  .receipt-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3mm; }
  .receipt-info-box { padding: 3mm; }
  .receipt-line { grid-template-columns: 27mm minmax(0, 1fr); padding: 1.2mm 0; font-size: 8px; }
  .receipt-products th, .receipt-products td { padding: 2mm 1.5mm; font-size: 8px; }
  .receipt-summary { grid-template-columns: minmax(0, 1fr) 48mm; gap: 3mm; }

  .form-grid {
    padding: 12px 0;
  }

  .receipt-info-grid,
  .receipt-summary {
    padding: 12px 0;
  }

  .receipt-info-box,
  .receipt-note,
  .receipt-total-box {
    border-color: #111827;
  }

  .field input,
  .field textarea,
  .field select {
    border: 0;
    padding: 0;
  }

  .table-wrap {
    overflow: visible;
  }

  .receipt-panel .table-wrap {
    padding: 0;
  }

  .receipt-panel .table-wrap table {
    border-top-color: #111827;
    border-bottom-color: #111827;
  }

  .dispatch-note-panel {
    max-width: none;
  }

  .dispatch-note-head {
    gap: 5mm;
    padding-top: 4mm;
    padding-bottom: 4mm;
  }

  .dispatch-note-title {
    gap: 1.5mm;
  }

  .dispatch-note-title strong {
    font-size: 22px;
  }

  .dispatch-note-title small {
    font-size: 10px;
  }

  .dispatch-note-qr {
    width: 30mm;
    height: 30mm;
    flex: 0 0 30mm;
  }

  .dispatch-note-head,
  .dispatch-note-delivery,
  .dispatch-note-order-note,
  .dispatch-note-products,
  .dispatch-note-footer {
    padding-left: 0;
    padding-right: 0;
  }

  .dispatch-note-delivery,
  .dispatch-note-order-note,
  .dispatch-note-products {
    padding-top: 3mm;
    padding-bottom: 3mm;
  }

  .dispatch-note-delivery h2,
  .dispatch-note-order-note h2,
  .dispatch-note-products h2 {
    margin-bottom: 2mm;
    font-size: 12px;
  }

  .dispatch-note-delivery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    column-gap: 6mm;
  }

  .dispatch-note-delivery-grid .receipt-line {
    grid-template-columns: 24mm minmax(0, 1fr);
    gap: 2mm;
    padding: 1.5mm 0;
    font-size: 9px;
  }

  .dispatch-note-delivery-grid .receipt-line:last-child {
    grid-column: 1 / -1 !important;
  }

  .dispatch-note-delivery-grid .receipt-line strong {
    font-size: 10px;
    line-height: 1.25;
  }

  .dispatch-note-order-note p {
    font-size: 10px;
  }

  .dispatch-note-products th,
  .dispatch-note-products td {
    font-size: 9px;
  }

  .dispatch-note-footer {
    gap: 6mm;
    padding-top: 7mm;
    padding-bottom: 0;
  }

  .dispatch-note-footer span {
    min-height: 15mm;
  }

  table {
    font-size: 11px;
  }

  .signature-preview {
    height: 160px;
  }

  .signature-receipt {
    width: 50%;
    max-width: none;
    min-width: 260px;
    padding-left: 0;
  }
}

.suggest-item {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .08);
}

.suggest-item small,
.suggest-item span { color: var(--muted); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  padding: 32px 16px;
  background: rgba(17, 24, 39, .45);
  overflow: auto;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  width: min(960px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(16, 24, 40, .22);
}

.modal > .panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

#newProductModal .modal {
  max-height: none;
  overflow: visible;
}

#newProductModal .suggest-wrap .suggest-box {
  z-index: 60;
  min-height: 0;
  max-height: 248px;
}

.modal.wide-modal {
  width: min(1100px, calc(100vw - 32px));
  max-width: 1100px;
}

.modal-body {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 16px;
}

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

.password-change-modal {
  width: min(480px, calc(100vw - 32px));
}

.password-change-form .field {
  margin-bottom: 0;
}

.password-change-form .form-actions {
  padding-top: 2px;
}

.total-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

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

a.btn,
a.mini-btn,
a.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .operation-map-workspace {
    grid-template-columns: 1fr;
  }
  .operation-map-stage,
  .operation-map-canvas {
    min-height: 0;
  }
  .operation-district-detail {
    max-height: none;
    border-top: 1px solid #d7e0e3;
    border-left: 0;
  }
  .product-finance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: min(82vw, 300px);
    height: 100dvh;
    max-height: 100dvh;
    padding-top: calc(16px + env(safe-area-inset-top));
    transform: translateX(-104%);
    transition: transform .18s ease;
    box-shadow: 20px 0 50px rgba(15, 23, 36, .25);
  }

  .mobile-receipt-close {
    position: fixed;
    z-index: 80;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 12px;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .18);
    font: 700 30px/1 Arial, sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-receipt-close:active {
    background: #e5e7eb;
    transform: scale(.96);
  }

  .layout.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .layout.mobile-menu-open::after {
    content: "";
    position: fixed;
    z-index: 35;
    inset: 0;
    background: rgba(15, 23, 36, .42);
  }

  .metrics { grid-template-columns: repeat(2, 1fr); }
  .payment-row { grid-template-columns: 1fr 150px auto; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .dashboard-actions { justify-content: flex-start; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .integration-layout { grid-template-columns: 1fr; }
  .report-toolbar,
  .accounting-toolbar { grid-template-columns: 1fr 1fr; }
  .order-report-kpis {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .order-report-toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .order-report-toolbar .search-field {
    grid-column: 1 / -1;
  }

  .stock-count-entry {
    grid-template-columns: 1fr;
  }

  .stock-count-session-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-count-depot,
  .stock-count-product,
  .stock-count-selected,
  .stock-count-qty,
  .stock-count-note {
    grid-column: 1;
    grid-row: auto;
  }

  .operation-layout,
  .operation-warning-grid,
  .marketplace-report-grid,
  .forecast-grid { grid-template-columns: 1fr; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    min-height: 58px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar h1 {
    flex: 1;
    min-width: 0;
    font-size: 18px;
  }

  .topbar .toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
  }

  .content { padding: 14px; }

  .panel {
    max-width: calc(100vw - 28px);
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .compact-definition-grid,
  .sub-category-definition-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.settlement-data-note {
  margin: 0 16px 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 700;
}

.settlement-data-note.ready {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.settlement-data-note.waiting {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.settlement-report-grid .table-wrap {
  overflow-x: auto;
}

.settlement-scope > .settlement-report-grid {
  margin-top: 16px;
}

.settlement-scope[open] > .dimension-report-summary::after,
.settlement-metrics-section[open] > .dimension-report-summary::after {
  transform: rotate(225deg);
}

.settlement-report-grid .wide table {
  min-width: 1250px;
}

.settlement-detail-scroll .table-wrap {
  max-height: clamp(360px, 60vh, 680px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.settlement-detail-scroll .table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  box-shadow: 0 1px 0 #d8dee8;
}

@media (max-width: 700px) {
  .settlement-detail-scroll .table-wrap {
    max-height: 58vh;
  }
}

@media (max-width: 560px) {
  .topbar-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .topbar-title small {
    font-size: 11px;
  }
  .dashboard-metrics-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .operation-layout {
    padding: 0 10px 10px;
  }
  .operation-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .operation-map-toolbar,
  .operation-status-segment {
    width: 100%;
  }
  .operation-status-segment {
    overflow-x: auto;
  }
  .operation-map-stage,
  .operation-map-canvas {
    min-height: 0;
  }
  .operation-map-stage {
    aspect-ratio: 4 / 3;
  }
  .operation-map-legend {
    gap: 6px 9px;
  }
  .operation-district-detail {
    padding: 14px;
  }
  .operation-focus-summary {
    width: min(260px, calc(100% - 24px));
    padding: 12px;
  }
  .operation-focus-summary h3 {
    font-size: 20px;
  }
  .product-finance-grid {
    grid-template-columns: 1fr;
  }
  .purchase-receive-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .report-toolbar,
  .accounting-toolbar,
  .marketplace-report-toolbar,
  .forecast-toolbar,
  .form-grid,
  .line-editor,
  .set-line-editor,
  .set-price-grid { grid-template-columns: 1fr; }

  .set-card-head {
    display: grid;
  }

  .set-count {
    text-align: left;
  }

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

  .order-report-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .order-report-toolbar .search-field {
    grid-column: 1 / -1;
  }

  .order-report-toolbar .btn {
    width: 100%;
  }

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

  .dashboard-metrics,
  .alert-metrics,
  .stock-price-metrics,
  .marketplace-report-metrics,
  .product-analysis-metrics,
  .purchase-metrics,
  .forecast-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signature-receipt {
    width: 100%;
    min-width: 0;
  }

  .receipt-document-head {
    grid-template-columns: minmax(0, 3fr) minmax(105px, 1fr);
    grid-template-areas:
      "logo meta"
      "legal legal"
      "contact contact";
    gap: 10px 16px;
  }

  .receipt-doc-meta {
    justify-self: center;
    min-width: 0;
  }

  .receipt-logo-row {
    min-height: 90px;
  }

  .receipt-logo-image {
    width: min(230px, 100%);
    height: 86px;
  }

  .receipt-qr {
    width: 105px;
    height: 105px;
  }

  .receipt-info-grid {
    grid-template-columns: 1fr;
  }

  .dispatch-note-head {
    align-items: flex-start;
  }

  .dispatch-note-title strong {
    font-size: 22px;
  }

  .dispatch-note-qr {
    width: 116px;
    height: 116px;
  }

  .dispatch-note-delivery-grid {
    grid-template-columns: 1fr;
  }

  .dispatch-note-delivery-grid .receipt-line:last-child {
    grid-column: auto;
  }

  .receipt-info-box {
    min-width: 0;
  }

  .permission-grid {
    grid-template-columns: 1fr;
  }

  .accounting-toolbar #accListBtn {
    grid-column: 1 / -1;
  }

  .payment-row {
    grid-template-columns: 1fr;
  }

  .payment-row .mini-btn {
    width: 100%;
  }

  .toolbar { flex-wrap: wrap; }
  .toolbar input { min-width: 0; width: 100%; }

  .stock-count-entry .split-control {
    grid-template-columns: 1fr;
  }

  .stock-count-entry .split-control .btn {
    width: 100%;
  }

  .login-screen {
    align-items: stretch;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }

  .login-card {
    align-self: center;
    padding: 22px;
  }

  .metrics {
    gap: 10px;
  }

  .metric {
    padding: 12px;
  }

  .metric strong {
    font-size: 22px;
  }

  .panel-header,
  .report-toolbar,
  .accounting-toolbar,
  .form-grid {
    padding: 12px;
  }

  .btn,
  .mini-btn,
  .link-btn {
    min-height: 40px;
  }

  .order-submit-panel .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .order-submit-panel .btn {
    width: 100%;
  }

  .barcode-manual-entry {
    grid-template-columns: 1fr;
  }

  .barcode-manual-entry .btn {
    width: 100%;
  }

  .content {
    padding: 10px;
    gap: 12px;
  }
}
.pilot-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pilot-checklist {
  display: grid;
  gap: 8px;
}

.pilot-check-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px minmax(240px, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel-soft, #f4f6f8);
}

.pilot-check-row > div {
  display: grid;
  gap: 3px;
}

.pilot-check-row span {
  color: var(--muted);
}

@media (max-width: 760px) {
  .pilot-check-row {
    grid-template-columns: 1fr;
  }

  .invoice-preview-list {
    grid-template-columns: 1fr;
  }

  .invoice-preview-list dt {
    border-bottom: 0;
  }

  .accounting-receipt-modal-header {
    align-items: flex-start;
  }

  .accounting-receipt-modal-header .inline-actions {
    justify-content: flex-start;
  }

  .accounting-receipt-frame {
    height: calc(100vh - 230px);
    min-height: 440px;
  }

  .receipt-slip-gallery {
    min-height: 440px;
    padding: 12px;
  }

  .receipt-slip-grid {
    grid-template-columns: 1fr;
  }

  .receipt-slip-card {
    grid-template-rows: minmax(260px, 55vh) auto;
  }
}
.mobile-pull-indicator {
  position: fixed;
  z-index: 120;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #172033;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .16);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px) scale(.96);
  transition: opacity .14s ease, transform .14s ease;
}

.mobile-pull-indicator.visible {
  opacity: 1;
  transform: translate(-50%, calc(var(--pull-progress, 0) * 18px)) scale(1);
}

.mobile-pull-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: #0f766e;
  border-radius: 50%;
}

.mobile-pull-indicator.ready .mobile-pull-spinner,
.mobile-pull-indicator.refreshing .mobile-pull-spinner {
  animation: mobile-pull-spin .7s linear infinite;
}

@keyframes mobile-pull-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 860px) {
  .main {
    transition: transform .16s ease;
  }

  html.mobile-back-gesture .main {
    transform: translateX(calc(var(--mobile-back-progress, 0) * 18px));
    transition: none;
  }
}
.bank-heading .panel-header {
  align-items: center;
}

.bank-connection-state {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bank-connection-state img {
  width: 72px;
  height: 30px;
  object-fit: contain;
}

.bank-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  background: #fff;
}

.bank-tabs a.active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #ecfdf5;
}

.bank-owner-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.bank-metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.bank-sync-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 24px;
}

.bank-sync-summary div {
  display: grid;
  gap: 5px;
}

.bank-sync-summary span {
  color: var(--muted);
  font-size: 12px;
}

.bank-filter-form {
  display: grid;
  grid-template-columns: 180px 180px minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.bank-settings-section {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-bottom: 1px solid var(--line);
}

.bank-settings-section h3 {
  margin: 0 0 8px;
}

.bank-test-field {
  justify-content: end;
}

.bank-cheque-metrics {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.bank-entry-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.compact-select {
  min-width: 130px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.bank-overdue-row {
  background: #fff1f0;
  box-shadow: inset 4px 0 0 var(--danger);
}

.cargo-metrics {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  margin: 14px 0;
}

.cargo-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 190px auto auto;
  gap: 12px;
  align-items: end;
}

.cargo-delay-check {
  min-height: 42px;
  align-items: center;
  white-space: nowrap;
}

.cargo-table th,
.cargo-table td {
  vertical-align: top;
}

.cargo-delayed-row {
  background: #fff1f0;
  box-shadow: inset 4px 0 0 var(--danger);
}

.cargo-update-grid {
  margin: 14px 0 20px;
}

.cargo-history {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.cargo-history h3 {
  margin: 0 0 12px;
}

.cargo-history ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.cargo-history li span,
.cargo-history li small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.marketplace-question-toolbar {
  align-items: end;
  grid-template-columns: minmax(260px, 1fr) repeat(4, minmax(145px, auto)) auto auto;
}

.marketplace-question-connectors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}

.marketplace-quick-answers {
  margin: 2px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.marketplace-quick-answers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
}

.marketplace-quick-answers-head h3,
.marketplace-quick-answers-head p {
  margin: 0;
}

.marketplace-quick-answer-manager {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.marketplace-quick-answer-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 100px max-content;
  align-items: end;
  gap: 12px;
}

.marketplace-quick-answer-text {
  grid-column: 1 / -1;
}

.marketplace-quick-answer-active {
  min-height: 42px;
  align-items: center;
}

.marketplace-quick-answer-list {
  margin-top: 16px;
}

.marketplace-quick-answer-list table {
  min-width: 780px;
}

.marketplace-quick-answer-list th:nth-child(1) { width: 70px; }
.marketplace-quick-answer-list th:nth-child(2) { width: 190px; }
.marketplace-quick-answer-list th:nth-child(4) { width: 90px; }
.marketplace-quick-answer-list th:nth-child(5) { width: 150px; }

.marketplace-quick-answer-preview {
  max-width: 520px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.connector-state {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 8px;
}

.connector-state.ready { border-color: #8fd5bd; color: #08745f; }
.connector-state.waiting { border-color: #e9c36c; color: #8b5b00; }
.connector-state.unsupported { background: #f4f5f7; }

.marketplace-question-table td { vertical-align: top; }
.marketplace-question-table th:nth-child(1) { width: 155px; }
.marketplace-question-table th:nth-child(2) { width: 220px; }
.marketplace-question-table th:nth-child(3) { width: 150px; }
.marketplace-question-table th:nth-child(5) { width: 145px; }
.marketplace-question-table th:nth-child(6) { width: 100px; }

.marketplace-source {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.marketplace-question-text {
  min-width: 300px;
  white-space: normal;
}

.marketplace-answer-preview {
  border-left: 3px solid #69bca7;
  color: #334155;
  margin-top: 10px;
  padding: 7px 10px;
}

.marketplace-answer-preview span,
.marketplace-question-detail > span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.marketplace-question-detail {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 14px;
}

.marketplace-question-detail.answer { border-left: 4px solid #218c74; }
.marketplace-question-detail p { margin: 0; white-space: pre-wrap; }
.marketplace-question-modal textarea { resize: vertical; }

@media (max-width: 1100px) {
  .marketplace-question-toolbar { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .cargo-metrics {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .cargo-filter-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .bank-metrics {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .bank-filter-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .bank-entry-grid,
  .bank-cheque-metrics {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 700px) {
  .marketplace-question-toolbar { grid-template-columns: 1fr; }
  .marketplace-quick-answers-head {
    align-items: stretch;
    flex-direction: column;
  }
  .marketplace-quick-answer-form {
    grid-template-columns: 1fr;
  }
  .marketplace-quick-answer-text {
    grid-column: auto;
  }
  .cargo-metrics,
  .cargo-filter-form {
    grid-template-columns: 1fr;
  }

  .bank-tabs,
  .bank-filter-form,
  .bank-sync-summary,
  .bank-metrics {
    grid-template-columns: 1fr;
  }


  .bank-entry-grid,
  .bank-cheque-metrics {
    grid-template-columns: 1fr;
  }

  .bank-tabs {
    display: grid;
  }
}
