:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --line: #dfdfdf;
  --soft: #f6f6f6;
  --accent: #d92f45;
  --accent-dark: #a8172a;
  --ok: #0f7a3c;
  --warn: #9a6400;
  --danger: #b7192d;
  --radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--erp-font-14,14px);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 36px;
}

button.secondary {
  background: #ffffff;
  color: var(--ink);
}

.button-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  border-radius: 6px;
  padding: 9px 12px;
  text-decoration: none;
  font-weight: 700;
}

.button-link.secondary {
  background: #ffffff;
  color: var(--ink);
}

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

button.success {
  border-color: var(--ok);
  background: var(--ok);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
  position: relative;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f7 100%);
}

.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.07);
}

.auth-logo {
  width: 230px;
  max-width: 100%;
  display: block;
  margin: 0 auto 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 18px;
}

.auth-tabs button {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
}

.auth-tabs button.active {
  background: var(--ink);
  color: #ffffff;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #ffffff;
}

.message.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.layout {
  height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.brand {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.brand img {
  width: 170px;
  display: block;
}

.brand:hover {
  background: #fafafa;
}

.nav {
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  overflow: auto;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid #d9d9d9;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  border-radius: 4px;
  font-size: var(--erp-font-12,12px);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nav button:hover {
  background: #f4f4f4;
  border-color: #bcbcbc;
}

.nav button.active {
  background: #eeeeee;
  border-color: #bcbcbc;
  color: #111111;
  box-shadow: inset 3px 0 0 #111111;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--danger);
  color: #fff;
  font-size: var(--erp-font-11,11px);
  font-weight: 800;
  letter-spacing: 0;
}

.account {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.account strong {
  display: block;
}

.content {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.menu-toggle,
.menu-overlay {
  display: none;
}

.topbar h1 {
  margin: 0;
  font-size: var(--erp-font-22,22px);
  line-height: 1.2;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
}

.workarea {
  padding: 20px 22px 28px;
  overflow: auto;
  background: #ffffff;
  min-height: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.revenue-metrics {
  margin-top: -6px;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.revenue-metric {
  padding: 12px;
}

.revenue-metric strong {
  font-size: var(--erp-font-20,20px);
}

.revenue-metric small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-top: 3px;
}

.revenue-metric small.positive {
  color: #16823a;
}

.revenue-metric small.negative {
  color: #b42318;
}

.order-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
  margin: -6px 0 18px;
}

.order-stats-table table {
  min-width: 0;
}

.order-stats-table td,
.order-stats-table th {
  white-space: nowrap;
}

.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: var(--erp-font-24,24px);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 360px) 150px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.supplier-toolbar {
  grid-template-columns: minmax(170px, 1.4fr) minmax(130px, 0.9fr) minmax(150px, 1fr) minmax(130px, 0.8fr) minmax(110px, 0.7fr) minmax(140px, 0.9fr) minmax(130px, 0.8fr) auto;
}

.requests-toolbar {
  grid-template-columns: minmax(180px, 1fr) minmax(145px, 190px) minmax(150px, 210px) minmax(170px, 230px) minmax(130px, 180px) auto;
}

.products-toolbar {
  grid-template-columns: minmax(190px, 1.2fr) minmax(150px, 0.9fr) minmax(150px, 0.9fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(220px, 1fr) auto auto;
}

.orders-toolbar {
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 170px) minmax(145px, 190px) auto auto auto;
}

.returns-toolbar {
  grid-template-columns: minmax(220px, 1fr) minmax(145px, 190px) auto auto auto;
}

.sales-toolbar {
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 340px) auto;
}

.sales-operator-toolbar {
  grid-template-columns: minmax(160px, 220px) auto;
}

.watch-service-toolbar {
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 170px) minmax(160px, 210px) auto auto auto auto;
}

.watch-service-appointments-toolbar {
  grid-template-columns: minmax(140px, 180px) minmax(220px, 1fr) auto auto auto;
}

.watch-service-stats-toolbar {
  grid-template-columns: minmax(140px, 180px) auto;
}

.watch-service-monthly-stats {
  margin-bottom: 14px;
}

.watch-service-yearly-stats {
  margin-top: 16px;
}

.watch-service-monthly-stats .section-head {
  margin-top: 8px;
}

.watch-service-monthly-wrap {
  margin-bottom: 12px;
}

.watch-service-monthly-table th,
.watch-service-monthly-table td {
  padding: 7px 9px;
  white-space: nowrap;
}

.watch-service-monthly-table tbody tr.current {
  background: #f6fbf8;
}

.orders-toolbar,
.returns-toolbar,
.sales-toolbar,
.sales-operator-toolbar {
  align-items: end;
}

.orders-toolbar button,
.returns-toolbar button,
.sales-toolbar button,
.sales-operator-toolbar button {
  white-space: nowrap;
}

.service-items-toolbar {
  grid-template-columns: minmax(190px, 1.2fr) minmax(90px, 0.55fr) minmax(100px, 0.55fr) minmax(90px, 0.5fr) minmax(95px, 0.5fr) minmax(180px, 1fr) minmax(130px, 0.7fr) auto;
}

.sms-template-list {
  display: grid;
  gap: 10px;
}

.sms-template-editor textarea {
  min-height: 76px;
  resize: vertical;
}

.api-toolbar {
  grid-template-columns: minmax(220px, 420px) minmax(150px, 190px) auto auto;
}

.short-url-toolbar {
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px) minmax(120px, 150px) auto auto auto;
}

.short-url-table-wrap table {
  min-width: 1040px;
}

.short-url-table td {
  vertical-align: middle;
}

.short-url-table .mono,
.short-url-destination {
  display: inline-block;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.short-url-destination {
  color: #111827;
}

.short-url-actions {
  flex-wrap: nowrap;
}

.short-url-form textarea {
  min-height: 110px;
}

.short-url-clicks .modal-table-wrap table {
  min-width: 760px;
}

.short-url-clicks .mono {
  display: inline-block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adjustment-toolbar {
  grid-template-columns: minmax(240px, 1fr) minmax(145px, 180px) minmax(180px, 240px) auto;
}

.customers-toolbar {
  grid-template-columns: minmax(240px, 420px) auto;
}

.inventory-toolbar {
  grid-template-columns: minmax(190px, 1.2fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) minmax(170px, 0.9fr) minmax(145px, 0.8fr) minmax(120px, 0.7fr) auto auto;
}

.revision-toolbar {
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 230px) auto;
}

.action-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(300px, 1.2fr);
  gap: 12px;
  margin-bottom: 14px;
}

.action-panel,
.jobs-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.module-loading {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
}

.module-loading strong {
  color: var(--text);
  font-size: var(--erp-font-16,16px);
}

.module-loading small {
  font-size: var(--erp-font-12,12px);
}

.module-loading-dot {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #111111;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.pause-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pause-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--erp-font-12,12px);
  font-weight: 800;
  letter-spacing: .02em;
}

.pause-badge.active {
  background: #e4f7eb;
  color: #137a3a;
}

.pause-badge.paused {
  background: #fff1df;
  color: #9a4b00;
}

.action-grid-collapsed {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.action-details {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.action-details summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.action-details summary::-webkit-details-marker {
  display: none;
}

.action-details summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  margin-left: auto;
}

.action-details[open] summary::after {
  content: "-";
}

.action-details summary span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
  white-space: nowrap;
}

.action-details-body,
.action-form,
.jobs-panel-body {
  display: grid;
  gap: 10px;
}

.action-details-body {
  padding: 0 12px 12px;
}

.jobs-panel table {
  min-width: 0;
}

.jobs-panel th,
.jobs-panel td {
  padding: 7px 8px;
}

.offer-list {
  display: grid;
  gap: 5px;
}

.filter-checks,
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pagination {
  justify-content: flex-end;
  margin-top: 12px;
}

.pagination span {
  color: var(--muted);
  font-size: var(--erp-font-13,13px);
}

.table-meta {
  color: var(--muted);
  font-size: var(--erp-font-13,13px);
  margin: 0 0 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin: 18px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: var(--erp-font-18,18px);
}

.section-head p {
  margin: 4px 0 0;
}

.adjustment-log {
  margin-top: 18px;
}

.adjustment-metrics {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.adjustment-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.adjustment-table th,
.adjustment-table td {
  font-size: var(--erp-font-11,11px);
  line-height: 1.18;
  padding: 5px 5px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.adjustment-table .wrap-cell {
  min-width: 0;
}

.adjustment-table .status {
  min-height: 18px;
  padding: 2px 5px;
  font-size: var(--erp-font-10,10px);
  white-space: normal;
}

.adjustment-table th:nth-child(1),
.adjustment-table td:nth-child(1) {
  width: 70px;
}

.adjustment-table th:nth-child(2),
.adjustment-table td:nth-child(2) {
  width: 92px;
}

.adjustment-table th:nth-child(3),
.adjustment-table td:nth-child(3) {
  width: 52px;
  text-align: center;
}

.adjustment-table th:nth-child(4),
.adjustment-table td:nth-child(4) {
  width: 70px;
}

.adjustment-table th:nth-child(5),
.adjustment-table td:nth-child(5),
.adjustment-table th:nth-child(6),
.adjustment-table td:nth-child(6),
.adjustment-table th:nth-child(7),
.adjustment-table td:nth-child(7) {
  width: 100px;
}

.adjustment-table th:nth-child(9),
.adjustment-table td:nth-child(9) {
  width: 42px;
  text-align: center;
}

.adjustment-table th:nth-child(11),
.adjustment-table td:nth-child(11),
.adjustment-table th:nth-child(12),
.adjustment-table td:nth-child(12) {
  width: 86px;
}

.adjustment-table td:nth-child(5),
.adjustment-table td:nth-child(6),
.adjustment-table td:nth-child(7),
.adjustment-table td:nth-child(8),
.adjustment-table td:nth-child(10),
.adjustment-table td:nth-child(9) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.stock-delta {
  display: inline-flex;
  justify-content: center;
  min-width: 30px;
  border-radius: 999px;
  padding: 2px 6px;
  font-weight: 800;
}

.stock-delta.positive {
  background: #e9f7ef;
  color: var(--ok);
}

.stock-delta.negative {
  background: #fdecee;
  color: var(--danger);
}

.muted {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.product-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.subtabs button {
  background: #ffffff;
  color: var(--ink);
}

.subtabs button.active {
  background: var(--ink);
  color: #ffffff;
}

.combo-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.detail-header h2 {
  margin: 0;
  font-size: var(--erp-font-20,20px);
}

.detail-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.detail-card table {
  min-width: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.inventory-stats {
  margin-bottom: 12px;
}

.inventory-metrics {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.inventory-metrics .metric {
  padding: 12px;
}

.inventory-metrics .metric strong {
  font-size: var(--erp-font-21,21px);
}

.inventory-stat-card {
  align-content: start;
}

.inventory-stat-details {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.inventory-stat-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.inventory-stat-details summary::-webkit-details-marker {
  display: none;
}

.inventory-stat-details summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.inventory-stat-details[open] summary::after {
  content: "-";
}

.inventory-stat-details summary span {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.inventory-stat-details .table-wrap {
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
}

.store-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  display: grid;
  align-content: start;
}

.store-photo,
.store-detail-photo {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: #f3f4f6;
}

.store-photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0;
}

.store-card-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.store-card-title {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: start;
}

.store-facts {
  display: grid;
  gap: 7px;
}

.store-facts div {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 8px;
}

.store-facts span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.store-facts strong {
  font-size: var(--erp-font-13,13px);
  overflow-wrap: anywhere;
}

.store-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.store-stats .metric {
  padding: 10px;
}

.store-stats .metric strong {
  font-size: var(--erp-font-18,18px);
}

.store-detail {
  gap: 12px;
}

.store-detail-photo {
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.sales-actions {
  margin: 0 0 10px;
}

.pos-shell {
  min-height: 100vh;
  padding: 18px;
  background: #f6f7f9;
  display: grid;
  gap: 16px;
  align-content: start;
}

.pos-header {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 16px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.pos-header img {
  width: 160px;
}

.pos-header strong,
.pos-header span {
  display: block;
}

.pos-header strong {
  font-size: var(--erp-font-24,24px);
}

.pos-keyboard-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pos-keyboard-toggle .pos-keyboard-icon {
  font-size: var(--erp-font-18,18px);
  line-height: 1;
}

.pos-keyboard-toggle.active {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}

.pos-grid {
  display: grid;
  grid-template-columns: minmax(390px, 1.15fr) minmax(300px, 0.8fr) minmax(340px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.pos-panel,
.pos-product-card,
.pos-message {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px;
}

.pos-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.pos-panel h2 {
  margin: 0;
  font-size: var(--erp-font-22,22px);
}

.pos-panel input,
.pos-panel select,
.pos-panel button {
  min-height: 48px;
  font-size: var(--erp-font-17,17px);
}

.pos-results {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.pos-product-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
}

.pos-product-card img,
.pos-no-photo {
  width: 116px;
  height: 116px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.pos-no-photo {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.pos-product-main {
  display: grid;
  gap: 8px;
}

.pos-product-main h3 {
  margin: 0;
  font-size: var(--erp-font-18,18px);
}

.pos-sell-row {
  display: grid;
  grid-template-columns: 90px 130px minmax(130px, 1fr);
  gap: 10px;
  align-items: end;
}

.pos-payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pos-payment-grid input {
  min-height: 46px;
  font-size: var(--erp-font-17,17px);
}

.pos-cart {
  position: sticky;
  top: 16px;
}

.pos-cart-lines,
.pos-confirm-list {
  display: grid;
  gap: 10px;
}

.pos-cart-line,
.pos-confirm-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto 34px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.pos-confirm-line {
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
}

.pos-cart-thumb,
.service-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.service-thumb {
  width: 54px;
  height: 54px;
}

.service-thumb-empty,
.pos-cart-thumb.pos-no-photo {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--erp-font-11,11px);
  font-weight: 800;
  text-align: center;
  padding: 4px;
}

.pos-cart-main,
.pos-cart-numbers {
  display: grid;
  gap: 3px;
}

.pos-cart-main span,
.pos-confirm-line span {
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.pos-cart-numbers {
  justify-items: end;
}

.pos-cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: var(--erp-font-20,20px);
}

.pos-cart-subtotal {
  font-size: var(--erp-font-14,14px);
  color: var(--muted);
}

.pos-cart-discount {
  display: flex;
  justify-content: space-between;
  min-height: 22px;
  color: #047857;
  font-weight: 800;
}

.pos-discount-button {
  width: 100%;
}

.discount-pad-modal {
  max-width: 360px;
}

.discount-pad-label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.discount-pad-input {
  font-size: var(--erp-font-24,24px);
  font-weight: 900;
  text-align: center;
  height: 52px;
}

.discount-pad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.discount-pad-grid button,
.discount-pad-clear {
  min-height: 50px;
  font-size: var(--erp-font-20,20px);
  font-weight: 900;
}

.discount-pad-clear {
  width: 100%;
  margin-top: 8px;
}

.touch-keyboard {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 80;
  width: min(860px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}

.touch-keyboard-head,
.touch-keyboard-actions,
.touch-keyboard-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.touch-keyboard-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.touch-keyboard-grid.numeric {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.touch-keyboard-row {
  justify-content: center;
  margin-top: 8px;
}

.touch-key {
  min-width: 56px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: var(--erp-font-20,20px);
  font-weight: 900;
}

.touch-key.wide {
  min-width: 104px;
}

.touch-key.space {
  flex: 1;
  max-width: 280px;
}

.touch-keyboard-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.pos-finish-button {
  min-height: 58px;
  font-size: var(--erp-font-19,19px);
  font-weight: 900;
}

.pos-confirm-title {
  margin: 0;
  font-size: var(--erp-font-28,28px);
  text-align: center;
  letter-spacing: 0;
}

.pos-payment-box {
  display: grid;
  gap: 12px;
}

.pos-payment-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pos-pay-choice {
  border: 2px solid var(--line);
  border-radius: 8px;
  min-height: 86px;
  display: grid;
  gap: 4px;
  place-items: center;
  color: #111;
  font-size: var(--erp-font-18,18px);
  background: #fff;
}

.pos-pay-choice.active {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
  background: #f8fafc;
}

.pos-payment-manual {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pos-payment-manual.hidden {
  display: none;
}

.pos-payment-summary {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 800;
}

.pos-payment-summary.ok {
  color: #047857;
}

.pos-payment-summary.warning {
  color: #92400e;
}

.pos-payment-summary.error {
  color: var(--danger);
}

.old-price {
  color: var(--muted);
  text-decoration: line-through;
}

.receipt-modal {
  display: grid;
  gap: 16px;
}

.receipt-print {
  max-width: 420px;
  margin: 0 auto;
  font-family: Consolas, "Courier New", monospace;
  color: #111;
}

.receipt-print h2,
.receipt-thanks {
  text-align: center;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
}

.receipt-table td {
  padding: 6px 0;
  border-bottom: 1px dashed #bbb;
  vertical-align: top;
}

.receipt-table td:nth-child(n+2) {
  text-align: right;
  white-space: nowrap;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt-total {
  font-size: var(--erp-font-18,18px);
}

.receipt-site {
  display: block;
  width: 100%;
  margin: 12px auto 0;
  padding: 8px 10px;
  background: #111;
  color: #fff;
  text-align: center;
  font-weight: 900;
  letter-spacing: 0;
}

.receipt-actions {
  justify-content: center;
}

.pos-message {
  min-height: 52px;
  font-size: var(--erp-font-18,18px);
  font-weight: 700;
  color: #047857;
}

.pos-message.error {
  color: var(--danger);
}

.workarea h3 {
  margin: 18px 0 10px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  background: #ffffff;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.wrap-cell,
.supplier-stock-table td:nth-child(5),
.supplier-stock-table th:nth-child(5) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.order-location {
  display: inline-block;
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.orders-table {
  min-width: 100%;
  width: 100%;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  padding: 7px 8px;
  font-size: var(--erp-font-13,13px);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-table .orders-col-site-order-number {
  width: 8%;
  font-weight: 700;
}

.orders-table .orders-col-channel {
  width: 4.5%;
  text-align: center;
}

.orders-table .orders-col-customer-name {
  width: 13%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.orders-table .orders-col-payment-method {
  width: 10.5%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.orders-table .orders-col-fulfillment-location {
  width: 9%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.orders-table .orders-col-status {
  width: 7%;
}

.orders-table .orders-col-tracking {
  width: 5.5%;
}

.orders-table .orders-col-total {
  width: 6%;
  text-align: right;
}

.orders-table .orders-col-products {
  width: 4.2%;
  text-align: center;
}

.orders-table .orders-col-phone {
  width: 8%;
}

.orders-table .orders-col-city-normalized {
  width: 7%;
}

.orders-table .orders-col-order-date {
  width: 9%;
}

.orders-table .orders-col-external-id {
  width: 4%;
}

.orders-table .orders-col-actions {
  width: 3.8%;
  text-align: center;
}

.orders-table .order-location {
  max-width: 100%;
}

.orders-table .status {
  min-height: 22px;
  padding: 2px 7px;
  font-size: var(--erp-font-11,11px);
}

.shop-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #ffffff;
  font-size: var(--erp-font-11,11px);
  font-weight: 800;
  letter-spacing: 0;
}

.shop-badge.w24 {
  background: #111111;
}

.shop-badge.ts {
  background: #1769d8;
}

.shop-badge.mobile {
  background: #147a61;
}

.order-number-stack,
.order-location-stack {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.order-number-stack strong,
.order-location-stack strong {
  overflow-wrap: anywhere;
}

.mobile-transfer-note {
  color: #0f766e;
  font-weight: 700;
}

.mobile-order-panel {
  border: 1px solid #d6dbe4;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.mobile-order-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-order-panel-head > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mobile-label-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: var(--erp-font-12,12px);
  font-weight: 700;
  background: #eef2f7;
  color: #334155;
}

.mobile-label-state.is-ready {
  background: #e8f7ef;
  color: #047857;
}

.mobile-label-state.is-pickup {
  background: #eef2ff;
  color: #3730a3;
}

.mobile-label-state.is-warning {
  background: #fff7ed;
  color: #c2410c;
}

.mobile-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.mobile-context-row {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mobile-context-row span {
  color: var(--muted);
  font-size: var(--erp-font-11,11px);
}

.mobile-context-row strong {
  font-size: var(--erp-font-13,13px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.mobile-sync-preview {
  grid-column: span 2;
}

.mobile-order-actions,
.shipment-preview-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.shipment-preview-panel {
  border: 1px solid #d6dbe4;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.shipment-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.shipment-preview-head > div {
  display: grid;
  gap: 4px;
}

.shipment-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.shipment-preview-row {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.shipment-preview-row span {
  color: var(--muted);
  font-size: var(--erp-font-11,11px);
}

.shipment-preview-row strong {
  font-size: var(--erp-font-13,13px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shipment-message-list {
  border-radius: 6px;
  padding: 9px 12px;
  display: grid;
  gap: 5px;
}

.shipment-message-list ul {
  margin: 0;
  padding-left: 18px;
}

.shipment-message-list.is-error {
  background: #fef2f2;
  color: #991b1b;
}

.shipment-message-list.is-warning {
  background: #fff7ed;
  color: #9a3412;
}

.shipment-payload-preview {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
}

.shipment-payload-preview summary {
  cursor: pointer;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shipment-payload-preview pre {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid #e5e7eb;
  padding: 10px;
  font-size: var(--erp-font-11,11px);
  white-space: pre-wrap;
}

.shipment-validation-panel {
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.shipment-validation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 720px) {
  .mobile-order-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .mobile-sync-preview {
    grid-column: auto;
  }

  .shipment-preview-head {
    flex-direction: column;
  }
}

.mini-button {
  min-height: 23px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: var(--erp-font-11,11px);
  line-height: 1.15;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 6px;
  font-size: var(--erp-font-18,18px);
  line-height: 1;
  font-weight: 800;
}

.delete-order-button {
  color: #ffffff;
}

.deliveries-metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.deliveries-toolbar {
  grid-template-columns: minmax(220px, 2fr) minmax(170px, 1fr) minmax(140px, 1fr) auto auto;
}

.deliveries-table {
  min-width: 1220px;
}

.deliveries-table td:last-child,
.deliveries-table th:last-child {
  width: 122px;
  min-width: 122px;
  white-space: nowrap;
}

.deliveries-table .delivery-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
}

.deliveries-table .delivery-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  min-width: 27px;
  height: 27px;
  min-height: 27px;
  padding: 0;
  border: 1px solid #d5d5d5;
  border-radius: 6px;
  background: #ffffff;
  color: #222222;
  font-size: var(--erp-font-15,15px);
  font-weight: 800;
  line-height: 1;
}

.deliveries-table .delivery-action-button:hover {
  background: #ececec;
}

.deliveries-table .delivery-action-receive {
  border-color: var(--ok);
  background: var(--ok);
  color: #ffffff;
}

.deliveries-table .delivery-action-receive:hover {
  background: #0c6934;
}

.deliveries-table .delivery-action-cancel {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.deliveries-table .delivery-action-cancel:hover {
  background: #9f1426;
}

.deliveries-table td:nth-child(2),
.deliveries-table td:nth-child(7),
.deliveries-table th:nth-child(7) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.delivery-form,
.delivery-detail {
  display: grid;
  gap: 14px;
}

.delivery-form {
  max-height: min(78vh, 780px);
  overflow: auto;
}

.delivery-header-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.delivery-header-fields label:last-child {
  grid-column: 1 / -1;
}

.delivery-items-title,
.delivery-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.delivery-items-editor {
  display: grid;
  gap: 12px;
}

.delivery-item-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.delivery-product-preview {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.delivery-product-thumb {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.delivery-product-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--erp-font-11,11px);
  text-align: center;
}

.delivery-item-fields {
  grid-template-columns: minmax(120px, 0.85fr) minmax(180px, 1.5fr) minmax(120px, 0.8fr) 100px 130px;
}

.allocation-title {
  color: var(--muted);
  font-size: var(--erp-font-13,13px);
  font-weight: 700;
}

.allocation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.allocation-grid input {
  width: 100%;
}

.delivery-totals {
  justify-self: end;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 800;
}

.compact-action {
  min-height: 28px;
  padding: 5px 9px;
  font-size: var(--erp-font-12,12px);
}

.invoicing-toolbar.module-actions {
  display: flex;
  justify-content: flex-start;
  gap: 12px !important;
  align-items: center;
  margin-bottom: 12px;
}

.invoicing-toolbar.module-actions > button {
  margin: 0 !important;
}

.invoicing-metrics.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 12px;
  margin-bottom: 18px;
  align-items: stretch;
}

.filters.compact-filters.invoice-filter-grid,
.invoice-filter-grid.compact-filters {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(180px, 1fr) minmax(130px, .7fr) minmax(150px, .7fr) auto;
  gap: 12px;
  align-items: end;
  margin: 0 0 12px;
}

.filters.compact-filters.invoice-filter-grid label {
  margin: 0;
  min-width: 0;
}

.filters.compact-filters.invoice-filter-grid button {
  align-self: end;
  min-width: 82px;
}

.invoicing-table-wrap {
  overflow-x: auto;
}

.invoicing-table-wrap .invoice-list-table {
  width: 100%;
  min-width: 920px;
  table-layout: auto;
  font-size: var(--erp-font-13,13px);
}

.invoicing-table-wrap table td,
.invoicing-table-wrap table th {
  white-space: nowrap;
}

.invoicing-table-wrap .invoice-list-table th,
.invoicing-table-wrap .invoice-list-table td {
  padding: 8px 10px;
  line-height: 1.25;
  vertical-align: middle;
}

.invoicing-table-wrap .invoice-list-table td:nth-child(3),
.invoicing-table-wrap .invoice-list-table td:nth-child(4) {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-issuer-badge {
  display: inline-block;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid #d8d8d8;
  border-radius: 999px;
  background: #f1f1f1;
  color: #222222;
  font-size: var(--erp-font-11,11px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.invoice-issuer-timeshop {
  border-color: #174f9e;
  background: #1d64c8;
  color: #ffffff;
}

.invoice-issuer-moon {
  border-color: #7c3aed;
  background: #8b5cf6;
  color: #ffffff;
}

.invoice-issuer-meta {
  border-color: #0f7a3a;
  background: #16a34a;
  color: #ffffff;
}

.invoice-issuer-tools {
  border-color: #b7791f;
  background: #f6c453;
  color: #221600;
}

.invoicing-table-wrap .invoice-list-table td:last-child {
  width: 122px;
  min-width: 122px;
  white-space: nowrap;
}

body.api-saving::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

body.api-saving::after {
  content: "Записвам...";
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  padding: 10px 16px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.invoice-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.invoice-actions .invoice-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  min-width: 27px;
  height: 27px;
  min-height: 27px;
  padding: 0;
  border: 1px solid #d5d5d5;
  border-radius: 6px;
  background: #ffffff;
  color: #222222;
  font-size: var(--erp-font-15,15px);
  font-weight: 800;
  line-height: 1;
}

.invoice-actions .invoice-action-button:hover {
  background: #ececec;
}

.invoice-actions .invoice-action-cancel {
  border-color: #d97706;
  background: #f59e0b;
  color: #221600;
}

.invoice-actions .invoice-action-cancel:hover {
  background: #d97706;
  color: #ffffff;
}

.invoice-actions .invoice-action-delete {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.invoice-actions .invoice-action-delete:hover {
  background: #9f1426;
}

.invoice-pagination {
  margin-top: 10px;
}

.invoice-number-cell {
  display: grid;
  gap: 2px;
}

.invoice-number-cell small {
  color: var(--muted);
  font-size: var(--erp-font-11,11px);
  line-height: 1.2;
}

.invoice-editor {
  display: grid;
  gap: 14px;
  padding: 4px 0;
}

.invoice-client-fields {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.invoice-client-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.invoice-client-details > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
  background: #f7f7f7;
}

.invoice-client-details .invoice-client-fields {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.invoice-discount-controls {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(130px, 180px);
  gap: 10px;
  align-items: end;
  justify-content: end;
}

.invoice-discount-controls label {
  margin: 0;
}

.invoice-duplicate-hint {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #f0c36a;
  border-radius: 8px;
  background: #fff8df;
  color: #111111;
}

.invoice-duplicate-hint[hidden] {
  display: none;
}

.invoice-line-head,
.invoice-line {
  display: grid;
  grid-template-columns: 92px minmax(220px, 1.8fr) 70px 104px 126px 108px 42px;
  gap: 8px;
  align-items: center;
}

.invoice-line-head {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
  font-weight: 700;
  text-transform: uppercase;
}

.invoice-line {
  margin-bottom: 8px;
}

.invoice-line input {
  min-width: 0;
}

.invoice-code-lookup {
  position: relative;
  min-width: 0;
}

.invoice-code-lookup input {
  width: 100%;
}

.invoice-product-suggestions {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  left: 0;
  width: min(460px, 70vw);
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.invoice-product-option {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.invoice-product-option:hover {
  background: #f5f5f5;
}

.invoice-product-option img,
.invoice-product-option .no-image {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: var(--erp-font-10,10px);
  display: grid;
  place-items: center;
  color: var(--muted);
}

.invoice-product-option span {
  min-width: 0;
}

.invoice-product-option small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-product-empty {
  padding: 8px;
  color: var(--muted);
  font-size: var(--erp-font-13,13px);
}

.invoice-line-total {
  text-align: right;
}

.invoice-total-box {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(110px, 150px);
  gap: 8px 16px;
  justify-content: end;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--line);
  text-align: right;
}

.invoice-total-box strong:last-child {
  font-size: var(--erp-font-20,20px);
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.product-tabs {
  align-items: center;
  margin-bottom: 14px;
}

.b2b-tabs {
  margin-bottom: 16px;
}

.b2b-tabs button {
  letter-spacing: 0;
}

.product-tabs .product-transfer-action {
  margin-left: auto;
  border-color: var(--ok);
  background: var(--ok);
  color: #ffffff;
}

.product-tabs .product-transfer-action:hover {
  border-color: var(--ok);
  background: #0b6531;
  color: #ffffff;
}

.returns-table th:nth-child(3),
.returns-table td:nth-child(3) {
  width: 106px;
}

.returns-table th:nth-child(6),
.returns-table td:nth-child(6) {
  width: 96px;
}

.return-status-new,
.return-status-processing,
.return-status-received,
.return-status-approved {
  background: #fee2e2;
  color: #991b1b;
}

.return-status-paid,
.return-status-done,
.return-status-exchanged {
  background: #dcfce7;
  color: #166534;
}

.products-combined-panel {
  display: grid;
  gap: 16px;
}

.settings-tabs button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #111111;
  font-size: var(--erp-font-12,12px);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.settings-tabs button.active,
.settings-tabs button:hover {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.settings-panel {
  display: grid;
  gap: 12px;
}

.shipment-settings-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.shipment-settings-card,
.shipment-settings-lock {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.shipment-settings-card {
  display: grid;
  gap: 10px;
}

.shipment-settings-card h3,
.shipment-settings-form h3 {
  margin: 0;
}

.shipment-settings-status {
  display: grid;
  gap: 8px;
}

.shipment-settings-status > div,
.shipment-settings-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shipment-settings-lock {
  background: #f8fafc;
}

.shipment-settings-lock p {
  margin: 4px 0 0;
}

.shipment-settings-form {
  display: grid;
  gap: 12px;
}

.price-comparison-toolbar {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.price-comparison-wrap {
  overflow-x: auto;
}

.price-comparison-table {
  min-width: 1120px;
}

.price-comparison-table td:nth-child(4),
.price-comparison-table td:nth-child(5),
.price-comparison-table td:nth-child(6),
.price-comparison-table td:nth-child(7),
.price-comparison-table td:nth-child(8) {
  white-space: nowrap;
}

.invoice-bank-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.invoice-bank-accounts {
  display: grid;
  gap: 10px;
}

.invoice-client-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.invoice-client-picker label {
  margin: 0;
}

.invoice-bank-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(140px, 1fr) minmax(190px, 1.25fr) 90px 100px 100px 34px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.invoice-preview {
  max-height: 78vh;
  overflow: auto;
  padding: 18px;
  background: #e9edf2;
}

.invoice-paper {
  width: 190mm;
  max-width: 190mm;
  min-height: 277mm;
  margin: 0 auto;
  padding: 8mm 8mm 6mm;
  background: #fff;
  color: #111;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  font-size: var(--erp-font-10,10px);
  line-height: 1.18;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.invoice-paper h2,
.invoice-paper h3 {
  text-align: center;
  margin: 0;
}

.invoice-paper h2 {
  font-size: var(--erp-font-22,22px);
  line-height: 1.1;
}

.invoice-paper h3 {
  margin-top: 3px;
  font-style: italic;
  font-size: var(--erp-font-12,12px);
}

.invoice-number-box {
  width: 270px;
  margin: 8px 0 8px auto;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 10px;
  text-align: right;
}

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 10px;
}

.invoice-party {
  border: 1px solid #111;
  border-radius: 4px;
  padding: 5px;
}

.invoice-party > strong {
  display: block;
  margin-bottom: 4px;
}

.invoice-party div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 4px;
  line-height: 1.12;
}

.invoice-print-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--erp-font-9,9px);
}

.invoice-print-table th,
.invoice-print-table td {
  border: 1px solid #111;
  padding: 2px 3px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.invoice-print-table th {
  background: #d7d7d7;
}

.invoice-print-table td:nth-child(1),
.invoice-print-table td:nth-child(4),
.invoice-print-table td:nth-child(5),
.invoice-print-table td:nth-child(6),
.invoice-print-table td:nth-child(7) {
  text-align: right;
}

.invoice-print-table th:nth-child(1),
.invoice-print-table td:nth-child(1) {
  width: 7mm;
}

.invoice-print-table th:nth-child(2),
.invoice-print-table td:nth-child(2) {
  width: 25mm;
}

.invoice-print-table th:nth-child(4),
.invoice-print-table td:nth-child(4) {
  width: 11mm;
}

.invoice-print-table th:nth-child(5),
.invoice-print-table td:nth-child(5) {
  width: 16mm;
}

.invoice-print-table th:nth-child(6),
.invoice-print-table td:nth-child(6),
.invoice-print-table th:nth-child(7),
.invoice-print-table td:nth-child(7) {
  width: 16mm;
}

.invoice-summary {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 3px 10px;
  max-width: 300px;
  margin: 8px 0 8px auto;
  text-align: right;
}

.invoice-words {
  margin: 8px 0;
}

.invoice-notes {
  margin: 6px 0 8px;
  font-weight: 700;
}

.invoice-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px dashed #111;
  margin-top: 6px;
}

.invoice-footer-grid > div {
  display: grid;
  gap: 2px;
  padding: 5px;
}

.invoice-footer-grid > div + div {
  border-left: 1px dashed #111;
}

.invoice-signatures {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin: 8px 0 5px;
}

.invoice-moon-credit {
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid #dddddd;
  background: transparent;
  color: #111111;
  text-align: center;
  font-size: var(--erp-font-8,8px);
  letter-spacing: 0;
}

.invoice-clients,
.invoice-settings {
  display: grid;
  gap: 12px;
  padding: 20px;
  align-content: start;
}

.invoice-editor,
.invoice-preview {
  padding: 20px;
}

.invoice-clients > input {
  width: 100%;
}

.invoice-clients > *,
.invoice-settings > *,
.invoice-editor > *,
.invoice-preview > *,
.delivery-form > *,
.store-detail > * {
  min-width: 0;
}

.tiny-text {
  font-size: var(--erp-font-12,12px);
  line-height: 1.3;
}

.supplier-stock-table {
  min-width: 0;
  table-layout: fixed;
}

.supplier-stock-table th,
.supplier-stock-table td {
  padding: 8px 9px;
}

.supplier-stock-table th,
.compact-table th {
  white-space: normal;
}

.supplier-stock-table th:nth-child(1),
.supplier-stock-table td:nth-child(1) {
  width: 74px;
}

.supplier-stock-table th:nth-child(2),
.supplier-stock-table td:nth-child(2) {
  width: 150px;
}

.supplier-stock-table th:nth-child(4),
.supplier-stock-table td:nth-child(4) {
  width: 105px;
}

.supplier-stock-table th:nth-child(3),
.supplier-stock-table td:nth-child(3) {
  width: 190px;
  white-space: normal;
}

.supplier-stock-table th:nth-child(6),
.supplier-stock-table td:nth-child(6) {
  width: 92px;
}

.supplier-stock-table th:nth-child(7),
.supplier-stock-table td:nth-child(7),
.supplier-stock-table th:nth-child(8),
.supplier-stock-table td:nth-child(8) {
  width: 122px;
}

.supplier-stock-table th:nth-child(9),
.supplier-stock-table td:nth-child(9) {
  width: 96px;
}

.supplier-stock-table .product-thumb {
  width: 48px;
  height: 48px;
}

.supplier-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  font-size: var(--erp-font-11,11px);
  line-height: 1.2;
  white-space: nowrap;
}

.supplier-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: flex-start;
}

.supplier-badge-timestore {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.supplier-badge-timeshop24 {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.supplier-badge-invicta {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.supplier-badge-megatime {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.supplier-badge-xstream {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}

.inventory-table-wrap {
  width: 100%;
  overflow-x: hidden;
}

.inventory-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.inventory-table th,
.inventory-table td {
  padding: 5px 6px;
  font-size: var(--erp-font-12,12px);
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.inventory-table th {
  white-space: normal;
}

.inventory-table th:nth-child(1),
.inventory-table td:nth-child(1) {
  width: 54px;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  width: 112px;
}

.inventory-table th:nth-child(3),
.inventory-table td:nth-child(3) {
  width: 18%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.inventory-table th:nth-child(4),
.inventory-table td:nth-child(4),
.inventory-table th:nth-child(5),
.inventory-table td:nth-child(5) {
  width: 96px;
}

.inventory-table th:nth-child(6),
.inventory-table td:nth-child(6) {
  width: 78px;
  text-align: right;
}

.inventory-table th:nth-child(7),
.inventory-table td:nth-child(7) {
  width: 62px;
  text-align: right;
}

.inventory-table th:nth-child(8),
.inventory-table td:nth-child(8) {
  width: 190px;
  white-space: normal;
}

.inventory-table th:nth-child(9),
.inventory-table td:nth-child(9),
.inventory-table th:nth-child(10),
.inventory-table td:nth-child(10) {
  width: 108px;
  text-align: right;
}

.inventory-table .product-thumb {
  width: 38px;
  height: 38px;
}

.revision-table {
  min-width: 0;
  table-layout: fixed;
}

.revision-table th,
.revision-table td {
  padding: 8px 9px;
}

.revision-table th {
  white-space: normal;
}

.revision-table th:nth-child(1),
.revision-table td:nth-child(1) {
  width: 74px;
}

.revision-table th:nth-child(2),
.revision-table td:nth-child(2) {
  width: 145px;
}

.revision-table th:nth-child(3),
.revision-table td:nth-child(3) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.revision-table th:nth-child(4),
.revision-table td:nth-child(4),
.revision-table th:nth-child(5),
.revision-table td:nth-child(5) {
  width: 110px;
}

.revision-table th:nth-child(6),
.revision-table td:nth-child(6),
.revision-table th:nth-child(7),
.revision-table td:nth-child(7),
.revision-table th:nth-child(8),
.revision-table td:nth-child(8) {
  width: 112px;
}

.revision-table th:nth-child(9),
.revision-table td:nth-child(9) {
  width: 150px;
}

.revision-table th:nth-child(10),
.revision-table td:nth-child(10) {
  width: 104px;
}

.revision-quick-count {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(120px, 160px) auto;
  gap: 12px;
  align-items: end;
}

.revision-warehouse-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 1.2fr) auto;
  gap: 14px;
  align-items: center;
}

.warehouse-leftover-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.warehouse-leftover-preview span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.revision-count-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.revision-count-actions button {
  min-height: 32px;
  padding: 6px 9px;
}

.suppliers-table {
  min-width: 980px;
  table-layout: fixed;
}

.suppliers-table th,
.suppliers-table td {
  padding: 8px 10px;
}

.suppliers-table th {
  white-space: normal;
}

.suppliers-table th:nth-child(1),
.suppliers-table td:nth-child(1) {
  width: 230px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.suppliers-table th:nth-child(2),
.suppliers-table td:nth-child(2) {
  width: 130px;
  overflow-wrap: anywhere;
}

.suppliers-table th:nth-child(3),
.suppliers-table td:nth-child(3) {
  width: 160px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.suppliers-table th:nth-child(4),
.suppliers-table td:nth-child(4),
.suppliers-table th:nth-child(5),
.suppliers-table td:nth-child(5),
.suppliers-table th:nth-child(6),
.suppliers-table td:nth-child(6) {
  width: 105px;
}

.suppliers-table th:nth-child(7),
.suppliers-table td:nth-child(7) {
  width: 150px;
  white-space: normal;
}

.suppliers-table th:nth-child(8),
.suppliers-table td:nth-child(8) {
  width: 100px;
}

.revisions-list-table {
  min-width: 1040px;
  table-layout: fixed;
}

.revisions-list-table th,
.revisions-list-table td {
  padding: 8px 10px;
}

.revisions-list-table th {
  white-space: normal;
}

.revisions-list-table th:nth-child(1),
.revisions-list-table td:nth-child(1) {
  width: 58px;
}

.revisions-list-table th:nth-child(2),
.revisions-list-table td:nth-child(2) {
  width: 230px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.revisions-list-table th:nth-child(3),
.revisions-list-table td:nth-child(3),
.revisions-list-table th:nth-child(4),
.revisions-list-table td:nth-child(4) {
  width: 130px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.revisions-list-table th:nth-child(5),
.revisions-list-table td:nth-child(5) {
  width: 110px;
}

.revisions-list-table th:nth-child(6),
.revisions-list-table td:nth-child(6),
.revisions-list-table th:nth-child(7),
.revisions-list-table td:nth-child(7),
.revisions-list-table th:nth-child(8),
.revisions-list-table td:nth-child(8) {
  width: 96px;
}

.revisions-list-table th:nth-child(9),
.revisions-list-table td:nth-child(9) {
  width: 150px;
  white-space: normal;
}

.revisions-list-table th:nth-child(10),
.revisions-list-table td:nth-child(10) {
  width: 100px;
}

.stock-requests-table {
  min-width: 0;
  table-layout: fixed;
}

.stock-requests-table th,
.stock-requests-table td {
  padding: 8px 9px;
}

.stock-requests-table th {
  white-space: normal;
}

.stock-requests-table th:nth-child(1),
.stock-requests-table td:nth-child(1) {
  width: 58px;
  text-align: center;
}

.stock-requests-table th:nth-child(2),
.stock-requests-table td:nth-child(2) {
  width: 74px;
}

.stock-requests-table th:nth-child(3),
.stock-requests-table td:nth-child(3) {
  width: 116px;
}

.stock-requests-table th:nth-child(4),
.stock-requests-table td:nth-child(4) {
  width: auto;
  white-space: normal;
  overflow-wrap: anywhere;
}

.stock-requests-table th:nth-child(5),
.stock-requests-table td:nth-child(5) {
  width: 110px;
  white-space: nowrap;
}

.stock-requests-table th:nth-child(6),
.stock-requests-table td:nth-child(6),
.stock-requests-table th:nth-child(8),
.stock-requests-table td:nth-child(8) {
  width: 130px;
}

.stock-requests-table th:nth-child(7),
.stock-requests-table td:nth-child(7) {
  width: 165px;
}

.stock-requests-table th:nth-child(9),
.stock-requests-table td:nth-child(9) {
  width: 230px;
  white-space: normal;
}

.request-basket {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 12px;
  background: #ffffff;
}

.request-basket-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.request-basket textarea {
  min-height: 138px;
  font-family: Consolas, "Courier New", monospace;
  font-size: var(--erp-font-14,14px);
  line-height: 1.45;
  resize: vertical;
}

.request-basket-list {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.request-basket-list div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
}

.request-basket-list span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.stock-request-actions {
  justify-content: flex-start;
  align-items: center;
  margin: 10px 0 12px;
}

th {
  position: sticky;
  top: 0;
  background: #f4f4f4;
  color: #222222;
  font-size: var(--erp-font-12,12px);
  text-transform: uppercase;
}

tr:hover td {
  background: #fafafa;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.actions button {
  min-height: 30px;
  padding: 5px 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f2f2f2;
  color: #222222;
  font-size: var(--erp-font-12,12px);
}

.status.active {
  background: #e9f7ef;
  color: var(--ok);
}

.status.confirmed {
  background: #dcfce7;
  color: #166534;
}

.status.neutral {
  background: #f2f2f2;
  color: #444444;
}

.status.orange {
  background: #ffedd5;
  color: #c2410c;
}

.status.sent {
  background: #e9f4ff;
  color: #1769aa;
}

.status.pending,
.status.draft,
.status.new {
  background: #fff7e5;
  color: var(--warn);
}

.status.issued {
  background: #e8f5ec;
  color: #0f7a3c;
}

.status.disabled,
.status.cancelled {
  background: #fdecee;
  color: var(--danger);
}

.status.paused,
.status.archived {
  background: #f3f4f6;
  color: #374151;
}

.status.service-status-delivered {
  background: #dcfce7;
  color: #166534;
}

.status.service-status-ready {
  background: #dbeafe;
  color: #1d4ed8;
}

.status.service-status-waiting_parts {
  background: #fef3c7;
  color: #92400e;
}

.status.service-status-working {
  background: #fef9c3;
  color: #854d0e;
}

.status.service-status-sent_external {
  background: #ede9fe;
  color: #5b21b6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  display: grid;
  place-items: start center;
  padding: 28px 18px;
  z-index: 20;
  overflow: auto;
}

.modal {
  width: min(980px, calc(100vw - 36px));
  max-height: calc(100vh - 56px);
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header,
.modal-footer {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-body {
  padding: 16px;
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: auto;
}

.modal-body.invoice-clients,
.modal-body.invoice-settings,
.modal-body.invoice-editor,
.modal-body.invoice-client-editor,
.modal-body.invoice-company-editor,
.modal-body.delivery-form,
.modal-body.store-detail {
  padding: 20px;
}

form.modal-body {
  flex: 1 1 auto;
}

.modal-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-table-wrap {
  max-height: 55vh;
}

.system-modal {
  width: min(520px, calc(100vw - 36px));
}

.system-dialog p {
  margin: 0;
  font-size: var(--erp-font-16,16px);
  line-height: 1.45;
}

.system-prompt-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

.sales-location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.sales-location-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.sales-location-card.firm {
  border-color: #111;
}

.sales-location-card span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.sales-location-card strong {
  font-size: var(--erp-font-22,22px);
}

.sales-location-card small {
  color: var(--muted);
}

.sales-analytics-panel {
  display: grid;
  gap: 12px;
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.sales-analytics-panel.collapsed {
  gap: 0;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.sales-analytics-head {
  margin: 0;
  align-items: center;
}

.sales-analytics-head > div {
  display: grid;
  gap: 2px;
}

.sales-analytics-toggle {
  min-width: 104px;
}

.sales-analytics-toolbar {
  margin: 0;
}

.sales-analytics-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.sales-analytics-card {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfc;
}

.sales-analytics-card.primary {
  border-color: #111;
  background: #fff;
}

.sales-analytics-card span,
.sales-analytics-card small {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.sales-analytics-card strong {
  font-size: var(--erp-font-19,19px);
}

.sales-analytics-card small.positive {
  color: #10843f;
  font-weight: 700;
}

.sales-analytics-card small.negative {
  color: #b42318;
  font-weight: 700;
}

.sales-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.sales-analytics-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.sales-analytics-block.wide {
  grid-row: span 4;
}

.section-head.compact {
  margin: 0;
}

.sales-analytics-table {
  width: 100%;
  table-layout: auto;
}

.sales-analytics-table th,
.sales-analytics-table td {
  padding: 7px 8px;
  font-size: var(--erp-font-12,12px);
}

.sales-period-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: #111;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sales-period-button:hover {
  text-decoration: underline;
}

.sales-top-days {
  display: grid;
  gap: 6px;
}

.sales-top-day {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #111;
  text-align: left;
  cursor: pointer;
}

.sales-top-day strong {
  justify-self: end;
}

.sales-top-day small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.tracking-form {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.tracking-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.tracking-card > div {
  display: grid;
  gap: 6px;
}

.tracking-timeline {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.tracking-event {
  border-left: 3px solid var(--line);
  padding: 4px 0 4px 10px;
}

.link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tracking-delivered {
  background: #dcfce7;
  color: #166534;
}

.tracking-returned,
.tracking-cancelled,
.tracking-error {
  background: #fee2e2;
  color: #991b1b;
}

.tracking-office,
.tracking-delivery {
  background: #dbeafe;
  color: #1e40af;
}

.tracking-transit,
.tracking-accepted,
.tracking-registered {
  background: #fef3c7;
  color: #92400e;
}

.compact-table {
  min-width: 0;
  table-layout: fixed;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

.email-message-body {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  line-height: 1.45;
}

.order-items-table th:nth-child(1),
.order-items-table td:nth-child(1) {
  width: 74px;
}

.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
  width: 150px;
}

.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
  width: 170px;
}

.order-items-table th:nth-child(5),
.order-items-table td:nth-child(5) {
  width: 170px;
}

.order-items-table th:nth-child(6),
.order-items-table td:nth-child(6),
.order-items-table th:nth-child(7),
.order-items-table td:nth-child(7),
.order-items-table th:nth-child(8),
.order-items-table td:nth-child(8) {
  width: 92px;
}

.order-return-location {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
}

.order-return-location small {
  grid-column: 1 / -1;
}

.order-return-location-select {
  min-width: 0;
  width: 100%;
  padding: 5px 7px;
  font-size: var(--erp-font-12,12px);
}

.customer-orders-table th:nth-child(1),
.customer-orders-table td:nth-child(1) {
  width: 110px;
}

.customer-orders-table th:nth-child(3),
.customer-orders-table td:nth-child(3) {
  width: 140px;
}

.customer-orders-table th:nth-child(4),
.customer-orders-table td:nth-child(4),
.customer-orders-table th:nth-child(5),
.customer-orders-table td:nth-child(5) {
  width: 110px;
}

.order-thumb {
  width: 50px;
  height: 50px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkline {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: var(--erp-font-13,13px);
}

.checkline input,
.permissions input {
  width: auto;
}

.company-block,
.stats-panel,
.leave-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 14px;
}

.company-fields[hidden] {
  display: none;
}

.postal-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
}

.postal-option {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
}

.postal-option:hover,
.postal-option:focus {
  background: #f7f7f7;
}

.postal-option strong {
  font-size: var(--erp-font-13,13px);
}

.postal-option span,
.postal-empty {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.postal-empty {
  padding: 10px;
}

.compact {
  margin: 0;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.leave-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.mini table {
  min-width: 640px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.vacation {
  min-width: 150px;
  display: grid;
  gap: 5px;
}

.vacation-track {
  height: 8px;
  background: #eeeeee;
  border-radius: 999px;
  overflow: hidden;
}

.vacation-track span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.vacation small {
  color: var(--muted);
}

.permissions {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
}

.permissions table {
  min-width: 620px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .filters.compact-filters.invoice-filter-grid,
  .invoice-filter-grid.compact-filters {
    grid-template-columns: 1fr 1fr;
  }

  .filters.compact-filters.invoice-filter-grid button,
  .invoice-filter-grid.compact-filters button {
    width: 100%;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 310px);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.16);
  }

  .layout.menu-open .sidebar {
    transform: translateX(0);
  }

  .menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    border: 0;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.28);
    padding: 0;
  }

  .layout.menu-open .menu-overlay {
    display: block;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    padding: 0;
    font-size: var(--erp-font-20,20px);
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .metrics,
  .toolbar,
  .supplier-toolbar,
    .deliveries-toolbar,
    .requests-toolbar,
    .products-toolbar,
    .inventory-toolbar,
    .revision-toolbar,
    .short-url-toolbar,
    .orders-toolbar,
    .service-items-toolbar,
    .order-stats-grid,
    .customers-toolbar,
    .action-grid,
    .revision-quick-count,
    .revision-warehouse-panel,
    .stats-grid,
    .store-grid,
    .pos-grid,
    .pos-header,
    .pos-sell-row,
    .pos-payment-grid,
    .pos-payment-buttons,
    .pos-payment-manual,
    .field-grid,
    .delivery-header-fields,
    .delivery-item-fields,
    .allocation-grid,
    .invoice-bank-row,
  .compact,
  .leave-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: row;
    justify-content: flex-start;
  }

  .auth-shell {
    align-items: start;
    padding: 12px;
  }

  .auth-panel {
    padding: 18px;
  }

  .brand {
    padding: 12px;
  }

  .brand img {
    width: 148px;
  }

  .account {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .workarea,
  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    width: 100%;
  }

  .pos-shell {
    padding: 10px;
  }

  .pos-cart {
    position: static;
  }

  .pos-payment-buttons,
  .pos-payment-manual {
    grid-template-columns: 1fr;
  }

  .pos-header img {
    width: 140px;
  }

  .modal-header,
  .modal-footer {
    align-items: stretch;
  }

  .modal-footer,
  .actions {
    flex-direction: column;
  }

  .combo-field,
  .subtabs,
  .tracking-form,
  .detail-header,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .tracking-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .subtabs button,
  .combo-field button {
    width: 100%;
  }

  .modal-footer button,
  .actions button,
  .toolbar button,
  .postal-option {
    width: 100%;
  }

  .postal-dropdown {
    position: static;
    margin-top: 4px;
    max-height: 220px;
  }

  table,
  .permissions table,
  .mini table {
    min-width: 0;
  }

  table thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  .supplier-stock-table th,
  .supplier-stock-table td,
  .suppliers-table th,
  .suppliers-table td,
  .inventory-table th,
  .inventory-table td,
  .revision-table th,
  .revision-table td,
  .revisions-list-table th,
  .revisions-list-table td,
  .stock-requests-table th,
  .stock-requests-table td,
  .order-items-table th,
  .order-items-table td,
  .customer-orders-table th,
  .customer-orders-table td {
    width: 100% !important;
  }

  .invoice-line-head {
    display: none;
  }

  .invoice-line {
    grid-template-columns: 1fr;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .invoicing-metrics.metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .invoice-discount-controls {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .invoice-parties,
  .invoice-footer-grid {
    grid-template-columns: 1fr;
  }

  .invoice-footer-grid > div + div {
    border-left: 0;
    border-top: 1px dashed #111;
  }

  .invoice-paper {
    min-height: 0;
    padding: 18px;
  }

  .modal-summary {
    display: grid;
  }

  tr {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  td {
    border-bottom: 0;
    white-space: normal;
    display: grid;
    grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--erp-font-12,12px);
  }
}

@media (max-width: 560px) {
  .filters.compact-filters.invoice-filter-grid,
  .invoice-filter-grid.compact-filters {
    grid-template-columns: 1fr;
  }
}

.products-table-wrap,
.sales-table-wrap {
  width: 100%;
  overflow-x: hidden;
}

.compact-data-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.compact-data-table th,
.compact-data-table td {
  padding: 7px 8px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.products-table th:nth-child(1),
.products-table td:nth-child(1) {
  width: 54px;
}

.products-table th:nth-child(2),
.products-table td:nth-child(2) {
  width: 112px;
}

.products-table th:nth-child(3),
.products-table td:nth-child(3) {
  width: 18%;
}

.products-table th:nth-child(4),
.products-table td:nth-child(4) {
  width: 86px;
}

.products-table th:nth-child(5),
.products-table td:nth-child(5) {
  width: 58px;
  text-align: right;
}

.products-table th:nth-child(6),
.products-table td:nth-child(6) {
  width: 220px;
  text-align: left;
}

.products-table th:nth-child(7),
.products-table td:nth-child(7),
.products-table th:nth-child(8),
.products-table td:nth-child(8),
.products-table th:nth-child(9),
.products-table td:nth-child(9) {
  width: 74px;
  text-align: right;
}

.products-table th:nth-child(10),
.products-table td:nth-child(10) {
  width: 92px;
}

.products-table th:nth-child(11),
.products-table td:nth-child(11) {
  width: 58px;
  text-align: center;
}

.product-location-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.product-location-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f7f7;
  font-size: var(--erp-font-11,11px);
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.product-location-pill-incoming {
  border-color: #f2c94c;
  background: #fff8df;
  color: #6b4b00;
}

.product-location-list-detail .product-location-pill {
  padding: 4px 8px;
  font-size: var(--erp-font-13,13px);
}

.product-detail-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-order-history {
  min-height: 34px;
}

.product-order-history .modal-table-wrap {
  overflow-x: auto;
}

.product-order-history-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  font-size: var(--erp-font-13,13px);
}

.product-order-history-table th,
.product-order-history-table td {
  padding: 8px 10px;
  vertical-align: top;
}

.product-order-history-table th:nth-child(1),
.product-order-history-table td:nth-child(1) {
  width: 150px;
}

.product-order-history-table th:nth-child(2),
.product-order-history-table td:nth-child(2) {
  width: 62px;
  text-align: center;
}

.product-order-history-table th:nth-child(4),
.product-order-history-table td:nth-child(4),
.product-order-history-table th:nth-child(7),
.product-order-history-table td:nth-child(7) {
  width: 58px;
  text-align: center;
}

.product-order-history-table th:nth-child(5),
.product-order-history-table td:nth-child(5) {
  width: 92px;
  white-space: nowrap;
}

.product-order-history-table th:nth-child(6),
.product-order-history-table td:nth-child(6) {
  width: 132px;
}

.product-order-number {
  display: grid;
  gap: 2px;
  line-height: 1.2;
}

.product-order-history-table small {
  display: block;
  margin-top: 2px;
}

.product-order-history-table .status,
.product-order-history-table .tiny-button {
  white-space: nowrap;
}

.product-cost-edit-button {
  margin-top: 12px;
}

.sales-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.sales-table th,
.sales-table td {
  padding: 6px 7px;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: var(--erp-font-13,13px);
}

.sales-table th:nth-child(1),
.sales-table td:nth-child(1) {
  width: 128px;
}

.sales-table th:nth-child(2),
.sales-table td:nth-child(2) {
  width: 82px;
}

.sales-table th:nth-child(3),
.sales-table td:nth-child(3) {
  width: 105px;
}

.sales-table th:nth-child(6),
.sales-table td:nth-child(6) {
  width: 58px;
  text-align: center;
}

.sales-table th:nth-child(7),
.sales-table td:nth-child(7) {
  width: 82px;
  text-align: right;
}

.sales-table th:nth-child(8),
.sales-table td:nth-child(8) {
  width: 96px;
}

.sales-table th:nth-child(9),
.sales-table td:nth-child(9) {
  width: 86px;
}

.sales-table th:nth-child(10),
.sales-table td:nth-child(10) {
  width: 105px;
}

.sales-table th:nth-child(11),
.sales-table td:nth-child(11) {
  width: 92px;
}

.tiny-button {
  padding: 5px 8px;
  font-size: var(--erp-font-12,12px);
}

.watch-service-table {
  min-width: 100%;
  table-layout: fixed;
}

.watch-service-table th,
.watch-service-table td {
  padding: 6px 7px;
  font-size: var(--erp-font-12,12px);
  line-height: 1.25;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.watch-service-table .status {
  display: inline-block;
  max-width: 100%;
  min-height: 20px;
  padding: 2px 7px;
  font-size: var(--erp-font-11,11px);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.watch-service-table .compact-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.watch-service-table .tiny-button {
  min-height: 25px;
  padding: 4px 6px;
  font-size: var(--erp-font-11,11px);
}

.watch-service-col-request_number,
.watch-service-col-received_date,
.watch-service-col-price {
  width: 6%;
}

.watch-service-col-phone,
.watch-service-col-status {
  width: 8%;
}

.watch-service-table th.watch-service-col-status,
.watch-service-table td.watch-service-col-status {
  overflow: hidden;
  white-space: nowrap;
}

.watch-service-col-customer_name {
  width: 11%;
}

.watch-service-col-watch_model {
  width: 14%;
}

.watch-service-col-procedure {
  width: 13%;
}

.watch-service-col-location_name {
  width: 9%;
}

.watch-service-col-sms {
  width: 6%;
}

.watch-service-col-actions {
  width: 13%;
}

.watch-service-table .service-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  min-width: 27px;
  height: 27px;
  min-height: 27px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #d8d8d8;
  background: #f4f4f4;
  color: #111111;
  font-size: var(--erp-font-15,15px);
  font-weight: 800;
  line-height: 1;
}

.watch-service-table .service-action-button:hover {
  background: #ececec;
}

.watch-service-table .service-action-ready,
.watch-service-table .service-action-delivered {
  border-color: var(--ok);
  background: var(--ok);
  color: #ffffff;
}

.watch-service-table .service-action-ready:hover,
.watch-service-table .service-action-delivered:hover {
  background: #0c6934;
}

.watch-service-table .service-action-delete {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.watch-service-table .service-action-delete:hover {
  background: #9f1426;
}

.service-appointment-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 8px;
}

.service-appointment-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-height: 112px;
  padding: 8px;
}

.service-appointment-day.today {
  border-color: #111111;
}

.service-appointment-day header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.service-appointment-day header span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.service-appointment-items {
  display: grid;
  gap: 5px;
}

.service-appointment-chip {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 0;
  padding: 6px 7px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #eff6ff;
  color: #1e3a8a;
  text-align: left;
  font-size: var(--erp-font-12,12px);
}

.service-appointment-chip.block {
  border-color: #fecaca;
  background: #fff1f2;
  color: #9f1239;
}

.service-appointment-chip.cancelled {
  opacity: 0.55;
  text-decoration: line-through;
}

.service-appointment-chip small {
  color: inherit;
  opacity: 0.8;
}

.service-appointment-empty {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.service-appointment-editor-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.product-detail-modal .product-detail-head {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.product-detail-modal img {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-detail-empty {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8f8f8;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.product-detail-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
}

.product-detail-chip span {
  display: block;
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.product-detail-chip strong {
  display: block;
  margin-top: 3px;
}

.product-description {
  margin-top: 14px;
}

.product-description-content {
  margin-top: 8px;
  color: var(--text);
  line-height: 1.55;
  white-space: normal;
}

.product-description-content p {
  margin: 0 0 8px;
}

.product-description-content p:last-child {
  margin-bottom: 0;
}

.product-description-content ul,
.product-description-content ol {
  margin: 8px 0 8px 18px;
  padding: 0;
}

.product-description-content a {
  color: #075985;
  text-decoration: underline;
}

.upload-field {
  gap: 8px;
}

.upload-field input[type="file"] {
  height: auto;
  padding: 8px;
}

.upload-preview {
  min-height: 54px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  color: var(--muted);
  background: #fafafa;
}

.upload-preview img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.auth-extra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.link-button {
  border: 0;
  background: transparent;
  color: #075985;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.personnel-table-wrap {
  overflow-x: hidden;
}

.personnel-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.personnel-table th,
.personnel-table td {
  padding: 6px 7px;
  font-size: var(--erp-font-12,12px);
  line-height: 1.2;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.personnel-staff-table th:nth-child(1),
.personnel-staff-table td:nth-child(1),
.personnel-staff-table th:nth-child(2),
.personnel-staff-table td:nth-child(2) {
  width: 10%;
}

.personnel-staff-table th:nth-child(3),
.personnel-staff-table td:nth-child(3) {
  width: 14%;
}

.personnel-staff-table th:nth-child(4),
.personnel-staff-table td:nth-child(4) {
  width: 11%;
}

.personnel-staff-table th:nth-child(5),
.personnel-staff-table td:nth-child(5) {
  width: 8%;
  text-align: center;
}

.personnel-staff-table th:nth-child(6),
.personnel-staff-table td:nth-child(6) {
  width: 16%;
}

.personnel-staff-table th:nth-child(7),
.personnel-staff-table td:nth-child(7) {
  width: 9%;
}

.personnel-staff-table th:nth-child(8),
.personnel-staff-table td:nth-child(8) {
  width: 22%;
}

.personnel-salary-table,
.personnel-leave-table {
  table-layout: auto;
}

.personnel-row-actions {
  gap: 4px;
  justify-content: flex-start;
}

.personnel-row-actions .compact-btn {
  width: auto;
  min-width: 0;
  min-height: 23px;
  padding: 3px 6px;
  font-size: var(--erp-font-10-5,10.5px);
}

.personnel-table .status {
  min-height: 18px;
  padding: 2px 5px;
  font-size: var(--erp-font-10-5,10.5px);
}

@media (max-width: 700px) {
  .personnel-row-actions .compact-btn {
    width: auto;
  }
}

@media (max-width: 900px) {
  .products-table-wrap,
  .sales-table-wrap {
    overflow-x: auto;
  }

  .products-table,
  .sales-table {
    min-width: 720px;
  }

  .product-detail-modal .product-detail-head {
    grid-template-columns: 1fr;
  }

  .product-detail-grid {
    grid-template-columns: 1fr;
  }
}

@page {
  size: A4;
  margin: 10mm;
}

@media print {
  html,
  body {
    width: 210mm;
    min-height: 297mm;
    background: #ffffff !important;
  }

  body * {
    visibility: hidden !important;
  }

  .receipt-print,
  .receipt-print *,
  .invoice-paper,
  .invoice-paper * {
    visibility: visible !important;
  }

  .receipt-print {
    position: fixed;
    inset: 0;
    max-width: none;
    margin: 0;
    padding: 12px;
    background: #fff;
  }

  .invoice-paper {
    position: static;
    width: 190mm !important;
    max-width: 190mm !important;
    min-height: 277mm;
    margin: 0 auto !important;
    padding: 0 !important;
    box-shadow: none;
    background: #fff;
    overflow: visible;
    font-size: var(--erp-font-10,10px);
    line-height: 1.18;
    page-break-inside: avoid;
  }

  .invoice-paper h2 {
    font-size: var(--erp-font-22,22px);
  }

  .invoice-paper h3 {
    margin-top: 4px;
    font-size: var(--erp-font-13,13px);
  }

  .invoice-number-box {
    width: 270px;
    margin: 10px 0 8px auto;
    gap: 3px 10px;
  }

  .invoice-parties {
    gap: 8px;
    margin: 8px 0 10px;
  }

  .invoice-party {
    padding: 5px;
    border-radius: 4px;
  }

  .invoice-party div {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 4px;
    line-height: 1.12;
  }

  .invoice-print-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
    font-size: var(--erp-font-9,9px);
    page-break-inside: auto;
  }

  .invoice-print-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .invoice-print-table th,
  .invoice-print-table td {
    padding: 2px 3px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .invoice-print-table th:nth-child(1),
  .invoice-print-table td:nth-child(1) {
    width: 7mm;
  }

  .invoice-print-table th:nth-child(2),
  .invoice-print-table td:nth-child(2) {
    width: 22mm;
  }

  .invoice-print-table th:nth-child(4),
  .invoice-print-table td:nth-child(4) {
    width: 10mm;
  }

  .invoice-print-table th:nth-child(5),
  .invoice-print-table td:nth-child(5) {
    width: 16mm;
  }

  .invoice-print-table th:nth-child(6),
  .invoice-print-table td:nth-child(6),
  .invoice-print-table th:nth-child(7),
  .invoice-print-table td:nth-child(7) {
    width: 15mm;
  }

  .invoice-summary {
    grid-template-columns: 1fr 88px;
    gap: 3px 10px;
    max-width: 300px;
    margin: 8px 0 8px auto;
  }

  .invoice-words {
    margin: 8px 0;
  }

  .invoice-notes {
    margin: 6px 0 8px;
  }

  .invoice-footer-grid {
    margin-top: 6px;
  }

  .invoice-footer-grid > div {
    gap: 2px;
    padding: 5px;
  }

  .invoice-signatures {
    margin: 8px 0 5px;
  }

  .invoice-moon-credit {
    font-size: var(--erp-font-8,8px);
    padding-top: 4px;
  }

  .modal-header,
  .modal-footer {
    display: none !important;
  }

  .invoice-preview {
    overflow: visible !important;
    background: #fff !important;
    padding: 0 !important;
  }
}


/* 20260524 compact orders sales pos fixes */
html { -webkit-text-size-adjust: 100%; }

@media (max-width: 900px) {
  input,
  select,
  textarea {
    font-size: var(--erp-font-16,16px) !important;
  }
}

.orders-overview-details { margin-bottom: 12px; }
.orders-overview-body { display: grid; gap: 10px; }
.orders-overview-body .metrics { margin: 0; }

.orders-table th,
.orders-table td {
  padding: 5px 5px;
  font-size: var(--erp-font-12,12px);
  line-height: 1.2;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-table .orders-col-site-order-number { width: 8%; }
.orders-table .orders-col-channel { width: 3.8%; text-align: center; }
.orders-table .orders-col-customer-name { width: 12%; }
.orders-table .orders-col-payment-method { width: 10%; }
.orders-table .orders-col-fulfillment-location { width: 8.5%; }
.orders-table .orders-col-status { width: 7%; }
.orders-table .orders-col-tracking { width: 6%; }
.orders-table .orders-col-total {
  width: 6.5%;
  white-space: normal;
}
.orders-table .orders-col-products { width: 4%; }
.orders-table .orders-col-phone { width: 8%; }
.orders-table .orders-col-city-normalized { width: 6.5%; }
.orders-table .orders-col-order-date { width: 8.8%; }
.orders-table .orders-col-external-id { width: 3.7%; }
.orders-table .orders-col-actions { width: 3.4%; }

.compact-btn,
.orders-table .orders-col-tracking button,
.orders-table .orders-col-products button {
  width: 100%;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 5px;
  font-size: var(--erp-font-11,11px);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders-table .status {
  min-height: 18px;
  padding: 2px 5px;
  font-size: var(--erp-font-10-5,10.5px);
  white-space: nowrap;
}

.order-total-cell {
  display: grid;
  gap: 2px;
  justify-items: end;
}

.order-total-cell .tiny-text {
  font-size: var(--erp-font-10-5,10.5px);
  line-height: 1.15;
  white-space: normal;
}

.order-finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.order-finance-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 4px;
}

.order-finance-box span {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

.order-finance-box strong {
  font-size: var(--erp-font-18,18px);
}

.order-finance-box.is-primary {
  border-color: #111827;
}

.order-finance-box.is-discount strong {
  color: #047857;
}

.sales-table th,
.sales-table td {
  padding: 5px 6px;
  font-size: var(--erp-font-12,12px);
  line-height: 1.2;
}

.sales-table th:nth-child(1), .sales-table td:nth-child(1) { width: 108px; }
.sales-table th:nth-child(2), .sales-table td:nth-child(2) { width: 68px; }
.sales-table th:nth-child(3), .sales-table td:nth-child(3) { width: 88px; }
.sales-table th:nth-child(6), .sales-table td:nth-child(6) { width: 45px; text-align: right; }
.sales-table th:nth-child(7), .sales-table td:nth-child(7) { width: 74px; text-align: right; }
.sales-table th:nth-child(8), .sales-table td:nth-child(8) { width: 82px; }
.sales-table th:nth-child(9), .sales-table td:nth-child(9) { width: 88px; }
.sales-table th:nth-child(10), .sales-table td:nth-child(10) { width: 94px; }
.sales-table th:nth-child(11), .sales-table td:nth-child(11) { width: 118px; }

.sales-table .status {
  font-size: var(--erp-font-10-5,10.5px);
  padding: 2px 6px;
  white-space: nowrap;
}

.sales-row-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 4px;
}

.sales-row-actions .compact-button {
  min-height: 24px;
  padding: 3px 6px;
  font-size: var(--erp-font-10-5,10.5px);
  line-height: 1.05;
  white-space: nowrap;
}

.sales-metrics.metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.sales-metrics .metric {
  padding: 8px 10px;
  min-height: 58px;
}

.sales-metrics .metric strong {
  font-size: var(--erp-font-20,20px);
}

.sales-top-actions {
  justify-content: flex-start;
}

.sales-operator-wrap {
  width: 100%;
  max-width: none;
  overflow-x: auto;
}

.sales-operator-table {
  width: 100%;
  min-width: 980px;
}

.sales-operator-table th,
.sales-operator-table td {
  padding: 6px 8px;
  font-size: var(--erp-font-12,12px);
}

.invoice-recipient-cell {
  text-transform: uppercase;
}

.products-table th,
.products-table td {
  padding: 5px 6px;
  font-size: var(--erp-font-12,12px);
  line-height: 1.2;
}

.products-table .product-thumb {
  width: 38px;
  height: 38px;
}

.products-table .tiny-button {
  min-height: 24px;
  padding: 4px 6px;
  font-size: var(--erp-font-11,11px);
}

.touch-number-modal {
  max-width: 380px;
  margin: 0 auto;
}

.touch-number-display {
  width: 100%;
  min-height: 54px;
  border: 1px solid #d8dbe0;
  border-radius: 8px;
  padding: 8px 12px;
  text-align: right;
  font-size: var(--erp-font-28,28px);
  font-weight: 900;
  margin: 8px 0 12px;
}

.modal-number-pad {
  position: static;
  transform: none;
  width: 100%;
  box-shadow: none;
}

.discount-touch-modal .touch-keyboard-grid.numeric {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.schedule-toolbar > div:first-child {
  display: grid;
  gap: 4px;
}

.schedule-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.schedule-toolbar-actions input[type="month"] {
  width: 150px;
}

.schedule-metrics.metrics {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.schedule-metrics .metric {
  padding: 10px 12px;
}

.schedule-metrics .metric strong {
  font-size: var(--erp-font-20,20px);
}

.schedule-location,
.schedule-summary {
  margin-top: 18px;
}

.schedule-location-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.schedule-location-head h2 {
  margin: 0;
  font-size: var(--erp-font-18,18px);
}

.schedule-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  background: #ffffff;
}

.schedule-grid {
  min-width: 1180px;
  table-layout: fixed;
}

.schedule-grid th,
.schedule-grid td {
  width: 72px;
  padding: 4px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
}

.schedule-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0d5c95;
  color: #ffffff;
  border-bottom: 1px solid #0b4f80;
}

.schedule-grid thead th.is-today {
  background: #111111;
}

.schedule-grid thead th strong,
.schedule-grid thead th span {
  display: block;
  line-height: 1.15;
}

.schedule-grid thead th strong {
  margin: 2px 0;
  font-size: var(--erp-font-16,16px);
}

.schedule-week {
  font-size: var(--erp-font-10,10px);
  opacity: 0.82;
}

.schedule-time-col {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 78px !important;
  background: #f8f8f8;
  color: #222222;
  font-weight: 800;
}

.schedule-grid thead .schedule-time-col {
  background: #0b4f80;
  color: #ffffff;
}

.schedule-open {
  min-height: 32px;
  background: #ffffff;
  cursor: pointer;
}

.schedule-open:hover {
  background: #f3f8ff;
}

.schedule-closed {
  background: #f1f1f1;
  color: #999999;
}

.schedule-grid td.is-today {
  box-shadow: inset 0 0 0 2px #111111;
}

.schedule-chip-stack {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 22px;
}

.schedule-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--chip-border, #d7d7d7);
  border-radius: 999px;
  background: var(--chip-bg, #eeeeee);
  color: var(--chip-fg, #333333);
  padding: 2px 7px;
  font-size: var(--erp-font-11,11px);
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-modal-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.schedule-shift-list {
  display: grid;
  gap: 10px;
}

.schedule-shift-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(130px, 0.9fr) 90px 90px minmax(140px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfbfb;
}

.schedule-remove-shift {
  min-width: 92px;
}

.schedule-summary-wrap table {
  min-width: 680px;
}

.schedule-summary-table td,
.schedule-summary-table th {
  vertical-align: middle;
}

.schedule-summary-table td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-full-name {
  color: var(--muted);
  font-size: var(--erp-font-12,12px);
}

@media (max-width: 1200px) {
  .sales-metrics.metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sales-analytics-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-analytics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-analytics-block.wide {
    grid-row: auto;
  }

  .schedule-toolbar,
  .schedule-location-head {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-toolbar-actions {
    justify-content: flex-start;
  }

  .schedule-metrics.metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-shift-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .sales-analytics-panel {
    padding: 10px;
  }

  .sales-analytics-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-analytics-card {
    min-height: 72px;
  }

  .sales-analytics-table th,
  .sales-analytics-table td {
    padding: 7px 0;
  }
}
