:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #20242c;
  --muted: #626c7a;
  --accent: #2364aa;
  --accent-dark: #184a80;
  --field: #fbfcfe;
  --row-hover: #e6f1fc;
  --ok: #19734c;
  --warn: #9a5b00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

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

.app-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr) auto;
  min-height: 76px;
  padding: 12px 18px;
}

.app-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-header h1 {
  font-size: 22px;
  line-height: 1.2;
  margin-top: 2px;
}

.app-nav {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.nav-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.nav-item.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.app-status {
  border-left: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding-left: 16px;
  white-space: nowrap;
}

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

.app-status strong {
  color: var(--ok);
  font-size: 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 168px);
}

.subnav,
.table-nav {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  min-height: 46px;
  overflow-x: auto;
  padding: 8px 18px;
}

.table-nav {
  background: var(--panel);
  min-height: 44px;
  padding-left: 42px;
}

.subnav span,
.table-nav span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-right: 6px;
  white-space: nowrap;
}

.subnav-item,
.table-nav-item,
.component-nav-item,
.product-nav-item,
.settings-nav-item,
.sales-nav-item,
.document-nav-item {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  min-height: 30px;
  padding: 5px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.subnav-item.active,
.table-nav-item.active,
.component-nav-item.active,
.product-nav-item.active,
.settings-nav-item.active,
.sales-nav-item.active,
.document-nav-item.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--accent);
  font-weight: 700;
}

.table-nav-item.active,
.component-nav-item.active,
.product-nav-item.active,
.settings-nav-item.active,
.sales-nav-item.active,
.document-nav-item.active {
  background: #eef4fb;
}

.global-status {
  background: #fff8e8;
  border-bottom: 1px solid #eadbbf;
  color: var(--warn);
  display: none;
  font-size: 13px;
  padding: 8px 28px;
}

.global-status.ok {
  background: #eef9f4;
  border-color: #cfe8dc;
  color: var(--ok);
}

.global-status.warn {
  display: block;
}

.global-status.ok {
  display: block;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eef2f6;
  padding: 18px;
  overflow: hidden;
}

.sidebar-head,
.editor-head,
.actions {
  display: flex;
  align-items: center;
}

.sidebar-head,
.editor-head {
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-size: 24px;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

.sidebar-head p,
.eyebrow,
.save-status,
label span,
.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.search {
  width: 100%;
  margin: 18px 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sidebar-filter-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-filter-stack .bulk-filter {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  width: 100%;
}

.quote-bulk-toolbar {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.quote-bulk-row {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.quote-bulk-row .bulk-filter {
  min-width: 0;
  width: 100%;
}

.bulk-selected-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.order-print-history {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px;
}

.order-print-history-head,
.order-print-history-item-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.order-print-history-head strong {
  color: var(--text);
  font-size: 13px;
}

.compact-icon-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.order-print-history-body {
  display: grid;
  gap: 6px;
  max-height: 232px;
  overflow: auto;
}

.order-print-history-item {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #cbd5e1;
  border-radius: 7px;
  display: grid;
  gap: 3px;
  padding: 7px 8px;
}

.order-print-history-printed {
  border-left-color: #15803d;
}

.order-print-history-printing,
.order-print-history-queued {
  border-left-color: #d97706;
}

.order-print-history-failed {
  border-left-color: #b91c1c;
}

.order-print-history-item strong {
  color: var(--text);
  font-size: 12px;
}

.order-print-history-number {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-print-history-item small,
.order-print-history-status,
.order-print-history-empty {
  color: var(--muted);
  font-size: 11px;
}

.order-print-history-item em {
  color: #b91c1c;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.order-print-history-badge {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 6px;
  white-space: nowrap;
}

.order-print-history-badge-printed {
  background: #dcfce7;
  color: #15803d;
}

.order-print-history-badge-queued,
.order-print-history-badge-printing {
  background: #fff7ed;
  color: #9a3412;
}

.order-print-history-badge-failed {
  background: #fee2e2;
  color: #b91c1c;
}

.clear-filters-button {
  white-space: nowrap;
}

.sidebar > .clear-filters-button {
  margin: -4px 0 12px;
  width: 100%;
}

.sidebar-filter-stack + .clear-filters-button {
  margin-top: -4px;
}

#quoteCount {
  color: #15803d;
  font-size: 18px;
  font-weight: 800;
}

#finishedProductsView .material-list {
  height: calc(100vh - 374px);
}

#accessoriesView .material-list,
#compositeAccessoriesView .material-list {
  height: calc(100vh - 424px);
}

.material-list {
  height: calc(100vh - 246px);
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}

.bulk-toolbar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 8px 0 10px;
}

.bulk-select-all {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  white-space: nowrap;
}

.bulk-select-all input {
  margin: 0;
}

.bulk-toolbar select {
  min-height: 32px;
  min-width: 132px;
  padding: 5px 8px;
  font-size: 13px;
}

.material-list-row {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: 18px minmax(0, 1fr);
}

.bulk-check {
  align-self: start;
  cursor: pointer;
  margin-top: 14px;
  min-height: 16px;
  padding: 0;
  width: 16px;
}

.material-item {
  box-sizing: border-box;
  color: var(--text);
  display: block;
  text-decoration: none;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
  cursor: pointer;
}

.material-item.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.material-item:hover:not(.active) {
  background: var(--row-hover);
  border-color: #b9cee3;
}

.material-item strong,
.material-item span {
  display: block;
}

.material-item strong {
  font-size: 14px;
}

.item-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.material-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.checkbox-label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  min-height: 40px;
}

.checkbox-label input {
  width: auto;
}

.editor {
  padding: 28px;
  overflow: auto;
}

.editor-head {
  margin-bottom: 24px;
}

.actions {
  gap: 12px;
}

.primary {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  cursor: pointer;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary,
.danger {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
}

.danger {
  border-color: #d8a2a2;
  color: #9c2929;
}

.secondary:hover {
  border-color: var(--accent);
}

.danger:hover {
  background: #fff4f4;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.finished-code-barcode-group {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(110px, 0.8fr) minmax(150px, 1.2fr);
  min-width: 0;
}

.finished-code-barcode-group label {
  min-width: 0;
}

.finished-physical-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  grid-column: 1 / -1;
  margin: 2px 0 0;
  min-width: 0;
  padding: 14px;
}

.finished-physical-section legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 0 7px;
}

.finished-physical-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(250px, 1fr));
}

.finished-measurement-field {
  min-width: 0;
}

.finished-measurement-inputs {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finished-weight-field .finished-measurement-inputs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.finished-measurement-inputs > span {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.finished-measurement-inputs input {
  border-radius: 8px 0 0 8px;
  min-width: 0;
}

.finished-measurement-inputs input[readonly] {
  background: #f2f5f8;
  color: var(--muted);
}

.finished-measurement-inputs small {
  align-items: center;
  background: #eef3f7;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  min-width: 34px;
  padding: 0 7px;
}

label {
  display: grid;
  gap: 6px;
}

label.wide {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

.customer-form-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.customer-vat-field .field-with-add input {
  min-width: 0;
}

.vies-check-button {
  min-width: 128px;
  white-space: nowrap;
}

.vies-panel {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1.3fr) minmax(260px, 1.8fr) minmax(170px, 0.8fr);
  margin-top: 18px;
}

.vies-panel > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 13px;
}

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

.vies-panel strong {
  display: block;
  font-size: 14px;
  margin-top: 6px;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.vies-panel.valid > div:first-child {
  background: #eef9f4;
  border-color: #a9d8c3;
}

.vies-panel.valid > div:first-child strong {
  color: var(--ok);
}

.vies-panel.invalid > div:first-child,
.vies-panel.unavailable > div:first-child {
  background: #fff8e8;
  border-color: #eadbbf;
}

.vies-panel.invalid > div:first-child strong,
.vies-panel.unavailable > div:first-child strong {
  color: var(--warn);
}

.customer-address-table {
  min-width: 1420px;
}

.customer-address-table th:nth-child(1),
.customer-address-table td:nth-child(1) {
  width: 105px;
}

.customer-address-table th:nth-child(2),
.customer-address-table td:nth-child(2),
.customer-address-table th:nth-child(3),
.customer-address-table td:nth-child(3) {
  width: 155px;
}

.customer-address-table th:nth-child(4),
.customer-address-table td:nth-child(4) {
  width: 95px;
}

.customer-address-table th:nth-child(5),
.customer-address-table td:nth-child(5) {
  width: 300px;
}

.customer-address-table th:nth-child(6),
.customer-address-table td:nth-child(6) {
  width: 90px;
}

.customer-address-table th:nth-child(7),
.customer-address-table td:nth-child(7) {
  width: 150px;
}

.customer-address-table th:nth-child(8),
.customer-address-table td:nth-child(8) {
  width: 140px;
}

.customer-address-table th:nth-child(9),
.customer-address-table td:nth-child(9),
.customer-address-table th:nth-child(10),
.customer-address-table td:nth-child(10) {
  text-align: center;
  width: 78px;
}

.customer-contact-table {
  min-width: 1050px;
}

.customer-contact-table th:nth-child(1),
.customer-contact-table td:nth-child(1) {
  width: 220px;
}

.customer-contact-table th:nth-child(2),
.customer-contact-table td:nth-child(2) {
  width: 180px;
}

.customer-contact-table th:nth-child(3),
.customer-contact-table td:nth-child(3),
.customer-contact-table th:nth-child(4),
.customer-contact-table td:nth-child(4) {
  width: 145px;
}

.customer-contact-table th:nth-child(5),
.customer-contact-table td:nth-child(5) {
  width: 240px;
}

.customer-contact-table th:nth-child(6),
.customer-contact-table td:nth-child(6),
.customer-contact-table th:nth-child(7),
.customer-contact-table td:nth-child(7) {
  text-align: center;
  width: 78px;
}

.customer-vies-history-table {
  min-width: 900px;
}

.customer-vies-history-table th:nth-child(1),
.customer-vies-history-table td:nth-child(1) {
  width: 170px;
}

.customer-vies-history-table th:nth-child(2),
.customer-vies-history-table td:nth-child(2) {
  width: 125px;
}

.customer-vies-history-table th:nth-child(3),
.customer-vies-history-table td:nth-child(3) {
  width: 170px;
}

.customer-vies-history-table th:nth-child(5),
.customer-vies-history-table td:nth-child(5) {
  width: 220px;
}

.customer-vies-history-table .vies-result-valid {
  color: var(--ok);
  font-weight: 700;
}

.customer-vies-history-table .vies-result-invalid,
.customer-vies-history-table .vies-result-unavailable {
  color: var(--warn);
  font-weight: 700;
}

.quote-form-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.quote-recipient-section {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
  grid-column: 1 / -1;
  margin: 0;
  min-width: 0;
  padding: 14px;
}

.quote-recipient-section legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 0 7px;
}

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

.compact-select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 36px;
  min-width: 180px;
  padding: 7px 30px 7px 10px;
}

.document-relations {
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 10px 18px;
}

.document-relations > div {
  align-items: center;
  display: flex;
  gap: 8px;
}

.document-relations span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.document-relations a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  margin-right: 10px;
  text-decoration: none;
}

.document-relations a:hover {
  text-decoration: underline;
}

.document-settings-view {
  background: #f5f7fa;
  min-height: calc(100vh - 122px);
}

.document-series-section {
  margin-bottom: 12px;
}

.document-series-table-wrap {
  max-height: 320px;
}

.document-series-table {
  min-width: 1480px;
  table-layout: fixed;
}

.document-series-table th:nth-child(1),
.document-series-table td:nth-child(1) { width: 150px; }
.document-series-table th:nth-child(2),
.document-series-table td:nth-child(2) { width: 290px; }
.document-series-table th:nth-child(3),
.document-series-table td:nth-child(3) { width: 150px; }
.document-series-table th:nth-child(4),
.document-series-table td:nth-child(4) { width: 90px; }
.document-series-table th:nth-child(5),
.document-series-table td:nth-child(5),
.document-series-table th:nth-child(6),
.document-series-table td:nth-child(6) { width: 100px; }
.document-series-table th:nth-child(7),
.document-series-table td:nth-child(7) { width: 70px; }
.document-series-table th:nth-child(8),
.document-series-table td:nth-child(8),
.document-series-table th:nth-child(9),
.document-series-table td:nth-child(9),
.document-series-table th:nth-child(10),
.document-series-table td:nth-child(10),
.document-series-table th:nth-child(11),
.document-series-table td:nth-child(11) {
  text-align: center;
  width: 94px;
}
.document-series-table th:nth-child(12),
.document-series-table td:nth-child(12) { width: 170px; }
.document-series-table th:nth-child(13),
.document-series-table td:nth-child(13) { width: 44px; }

.document-series-table input:not([type="checkbox"]),
.document-series-table select {
  min-width: 0;
  width: 100%;
}

.document-series-table input[type="checkbox"] {
  margin: 0;
}

.document-series-preview {
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-help {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.email-settings-section {
  margin-bottom: 18px;
}

.email-settings-grid {
  background: transparent;
  border: 0;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  padding: 0;
}

.email-settings-grid .checkbox-label {
  align-self: end;
}

.email-password-state {
  align-self: end;
  background: #eef4fb;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 40px;
  padding: 8px 10px;
}

.email-password-state span {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.email-password-state strong {
  font-size: 13px;
}

.email-template-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
}

.email-template-sidebar {
  border-right: 1px solid var(--line);
  padding: 16px;
}

.email-template-sidebar .material-list {
  height: 520px;
}

.email-template-editor {
  min-width: 0;
  overflow: auto;
  padding: 20px;
}

.email-template-form {
  background: transparent;
  border: 0;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  padding: 0;
}

.email-template-form .full {
  grid-column: 1 / -1;
}

.email-design-settings {
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
}

.email-design-settings label,
.email-image-controls label {
  display: grid;
  gap: 5px;
}

.email-design-settings label > span,
.email-image-controls label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.email-design-settings input[type="color"] {
  cursor: pointer;
  height: 40px;
  padding: 4px;
}

.email-rich-section {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.email-rich-head {
  align-items: center;
  background: #f5f8fb;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 42px;
  padding: 5px 8px 5px 12px;
}

.email-rich-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.email-rich-toolbar {
  display: flex;
  gap: 3px;
}

.email-rich-toolbar button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  display: inline-flex;
  height: 30px;
  justify-content: center;
  min-width: 31px;
  padding: 0 7px;
}

.email-rich-toolbar button:hover:not(:disabled) {
  background: #eaf2fa;
}

.email-rich-editor {
  background: #fff;
  color: #1f2937;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 240px;
  outline: none;
  overflow-wrap: anywhere;
  padding: 14px;
  text-align: left;
}

.email-rich-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(52, 115, 176, 0.22);
}

.email-rich-editor.signature-editor {
  min-height: 120px;
}

.email-rich-editor[contenteditable="false"] {
  background: #f5f7fa;
  color: #586675;
}

.email-rich-editor img,
.email-template-preview-frame img,
.document-email-body-editor img {
  height: auto;
  max-width: 100%;
}

.email-rich-editor[contenteditable="true"] img,
.document-email-body-editor img {
  cursor: default;
}

.email-rich-editor p:first-child,
.email-template-preview-frame p:first-child {
  margin-top: 0;
}

.email-rich-editor p:last-child,
.email-template-preview-frame p:last-child {
  margin-bottom: 0;
}

.email-image-settings {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 260px;
  padding-top: 16px;
}

.email-image-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.email-image-controls .wide {
  grid-column: span 2;
}

.email-image-actions {
  align-items: end;
  display: flex;
  gap: 8px;
}

.email-image-current {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: 150px;
  padding: 12px;
}

.email-image-current span {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.email-image-current img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
}

.template-variables {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
  padding-top: 12px;
}

.template-variables > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
}

.template-variables code {
  background: #eef4fb;
  border: 1px solid #d7e2ef;
  border-radius: 4px;
  color: #285b8f;
  cursor: default;
  font-size: 11px;
  padding: 4px 6px;
}

.email-template-preview {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.email-template-preview > div {
  display: grid;
  gap: 4px;
}

.email-template-preview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.email-template-preview-frame {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 12px 0 0;
  min-height: 220px;
  overflow-wrap: anywhere;
  padding: 20px;
}

.document-email-modal-card {
  max-height: calc(100vh - 40px);
  max-width: 980px;
  overflow: auto;
}

.document-email-configuration {
  background: #eef8f2;
  border: 1px solid #b9ddc7;
  border-radius: 6px;
  color: #21633c;
  font-size: 13px;
  margin-bottom: 14px;
  padding: 9px 11px;
}

.document-email-configuration.warn {
  background: #fff7e7;
  border-color: #ead39b;
  color: #8a5a00;
}

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

.document-email-form label {
  display: grid;
  gap: 5px;
}

.document-email-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.document-email-form .full {
  grid-column: 1 / -1;
}

.document-email-form textarea {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  min-height: 245px;
  resize: vertical;
}

.document-email-body-editor {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 245px;
}

.document-email-form .document-email-attachment-toggle {
  align-items: center;
  align-self: end;
  display: flex;
  min-height: 40px;
}

.document-email-form .document-email-attachment-toggle > span {
  color: var(--text);
  font-size: 13px;
}

.document-email-summary {
  align-items: baseline;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  margin-top: 15px;
  padding-top: 12px;
}

.document-email-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.document-email-summary strong {
  font-size: 13px;
}

@media (max-width: 720px) {
  .document-email-form {
    grid-template-columns: 1fr;
  }

  .document-email-form .full {
    grid-column: auto;
  }

  .email-design-settings,
  .email-image-settings,
  .email-image-controls {
    grid-template-columns: 1fr;
  }

  .email-image-controls .wide {
    grid-column: auto;
  }
}

.quote-editor {
  min-width: 0;
}

.quote-lines-section {
  padding: 14px;
}

.quote-lines-table {
  min-width: 1380px;
}

.quote-lines-table th:first-child,
.quote-lines-table td:first-child {
  width: 280px;
}

.quote-lines-table th:nth-child(2),
.quote-lines-table td:nth-child(2) {
  width: 350px;
}

.quote-lines-table th:nth-child(3),
.quote-lines-table td:nth-child(3) {
  width: 90px;
}

.quote-lines-table th:nth-child(4),
.quote-lines-table td:nth-child(4) {
  width: 125px;
}

.quote-lines-table th:nth-child(5),
.quote-lines-table td:nth-child(5) {
  width: 125px;
}

.quote-lines-table th:nth-child(6),
.quote-lines-table td:nth-child(6),
.quote-lines-table th:nth-child(7),
.quote-lines-table td:nth-child(7) {
  width: 90px;
}

.quote-lines-table th:nth-child(8),
.quote-lines-table td:nth-child(8) {
  width: 135px;
}

.quote-lines-table th:last-child,
.quote-lines-table td:last-child {
  text-align: center;
  width: 54px;
}

.quote-lines-table .select-combo {
  min-width: 0;
}

.quote-line-net {
  background: #eef4fb;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.quote-footer {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 380px);
  margin-top: 18px;
}

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

.quote-totals {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
}

.quote-totals > div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 38px;
}

.quote-totals > div:last-child {
  border-bottom: 0;
}

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

.quote-totals strong {
  font-size: 15px;
}

.quote-totals .quote-grand-total {
  color: var(--accent);
  min-height: 52px;
}

.quote-totals .quote-grand-total span {
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
}

.quote-totals .quote-grand-total strong {
  font-size: 24px;
}

.quote-list-item {
  flex: 1;
}

.quote-status-accepted {
  background: #dcfce7;
  color: #166534;
}

.quote-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.quote-status-shipping {
  background: #dbeafe;
  color: #1d4ed8;
}

.quote-status-executed {
  background: #dcfce7;
  color: #166534;
}

.quote-status-rejected,
.quote-status-cancelled,
.quote-status-expired {
  background: #fee2e2;
  color: #991b1b;
}

.quote-status-sent {
  background: #dbeafe;
  color: #1d4ed8;
}

.quote-status-transformed {
  background: #e0f2fe;
  color: #075985;
}

.quote-status-draft {
  background: #f1f5f9;
  color: #475569;
}

.quote-print-status {
  margin-left: 4px;
}

.quote-print-status-queued,
.quote-print-status-printing {
  background: #fff7ed;
  color: #9a3412;
}

.quote-print-status-printed {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 900;
}

.quote-print-status-failed {
  background: #7f1d1d;
  color: #fff;
}

.quote-product-print-status {
  margin-left: 4px;
}

.quote-product-print-status-printed {
  background: #fef3c7;
  color: #92400e;
  font-weight: 900;
}

.field-with-add {
  align-items: stretch;
  display: flex;
  gap: 8px;
}

.field-with-add .select-combo {
  flex: 1 1 auto;
  min-width: 0;
}

.mini-add,
.mini-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 40px;
  font-size: 22px;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  text-decoration: none;
}

.mini-link {
  color: var(--muted);
  font-size: 0;
}

.mini-link::before {
  content: "\2197";
  font-size: 18px;
}

.mini-add:hover,
.mini-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

input:focus,
select:focus {
  outline: 2px solid rgba(35, 100, 170, 0.2);
  border-color: var(--accent);
}

.field-error span {
  color: #b91c1c;
  font-weight: 700;
}

.field-error input,
.field-error select,
.field-error .combo-input {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

label.disabled-field span {
  color: #8c96a3;
}

input:disabled {
  background: #eef1f5;
  color: #8c96a3;
  cursor: not-allowed;
}

.select-combo {
  position: relative;
}

.native-select-hidden {
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.combo-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(32, 36, 44, 0.12);
  display: none;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  position: fixed;
  z-index: 1000;
}

.select-combo.open .combo-list {
  display: grid;
  gap: 4px;
}

.combo-option {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.combo-option:hover,
.combo-option.active {
  background: #eef2f6;
}

.composite-parts-table th:first-child,
.composite-parts-table td:first-child {
  min-width: 360px;
}

.compatible-models-table th:first-child,
.compatible-models-table td:first-child {
  min-width: 360px;
}

.compatible-models-table th:last-child,
.compatible-models-table td:last-child {
  width: 110px;
}

.composite-parts-table th:nth-child(2),
.composite-parts-table td:nth-child(2),
.composite-parts-table th:nth-child(3),
.composite-parts-table td:nth-child(3) {
  width: 140px;
}

#finishedProductsView .composite-parts-table,
#finishedSpecsView .composite-parts-table {
  min-width: 1080px;
}

#finishedProductsView .composite-parts-table th:first-child,
#finishedProductsView .composite-parts-table td:first-child,
#finishedSpecsView .composite-parts-table th:first-child,
#finishedSpecsView .composite-parts-table td:first-child {
  min-width: 0;
  width: 120px;
}

#finishedProductsView .composite-parts-table th:nth-child(2),
#finishedProductsView .composite-parts-table td:nth-child(2),
#finishedSpecsView .composite-parts-table th:nth-child(2),
#finishedSpecsView .composite-parts-table td:nth-child(2) {
  min-width: 520px;
  width: auto;
}

#finishedProductsView .composite-parts-table th:nth-child(3),
#finishedProductsView .composite-parts-table td:nth-child(3),
#finishedSpecsView .composite-parts-table th:nth-child(3),
#finishedSpecsView .composite-parts-table td:nth-child(3) {
  width: 90px;
}

#finishedProductsView .composite-parts-table th:nth-child(4),
#finishedProductsView .composite-parts-table td:nth-child(4),
#finishedSpecsView .composite-parts-table th:nth-child(4),
#finishedSpecsView .composite-parts-table td:nth-child(4) {
  width: 90px;
}

#finishedProductsView .composite-parts-table th:last-child,
#finishedProductsView .composite-parts-table td:last-child,
#finishedSpecsView .composite-parts-table th:last-child,
#finishedSpecsView .composite-parts-table td:last-child {
  width: 42px;
}

.combo-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 10px;
}

.lookup-search {
  min-width: 180px;
  max-width: 280px;
}

.grid-search {
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  min-height: 34px;
  min-width: 160px;
  padding: 6px 10px;
}

.bulk-filter {
  min-height: 34px;
  min-width: 150px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.metrics div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.metrics .base-price-metric {
  background: #f0fdf4;
  border-color: #86efac;
}

.metrics .base-price-metric span,
.metrics .base-price-metric strong {
  color: #15803d;
}

.calculator {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  padding: 18px;
}

.calculator-head {
  margin-bottom: 16px;
}

.calculator h3 {
  font-size: 18px;
  margin: 3px 0 0;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 16px;
  align-items: end;
}

.calculator-grid div {
  border-left: 1px solid var(--line);
  min-height: 62px;
  padding-left: 14px;
}

.calculator-grid div span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.calculator-grid div strong {
  display: block;
  font-size: 22px;
  margin-top: 8px;
}

.lookup-view {
  padding: 18px;
}

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

.lookup-toolbar {
  align-items: center;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.column-picker {
  position: relative;
}

.column-picker summary {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  min-height: 34px;
  padding: 6px 28px 6px 10px;
  position: relative;
  user-select: none;
}

.column-picker summary::after {
  content: "▾";
  position: absolute;
  right: 9px;
}

.column-picker[open] summary::after {
  transform: rotate(180deg);
}

.column-picker summary::-webkit-details-marker {
  display: none;
}

.column-picker-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 14px 34px rgba(32, 36, 44, 0.18);
  display: grid;
  gap: 5px;
  min-width: 220px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 45;
}

.column-picker-panel label {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 8px;
  min-height: 28px;
  white-space: nowrap;
}

.column-picker-panel input[type="checkbox"] {
  min-height: 16px;
  width: 16px;
}

.column-picker-panel button {
  margin-top: 5px;
  width: 100%;
}

.lookup-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.lookup-table {
  border-collapse: collapse;
  min-width: 720px;
  table-layout: fixed;
  width: 100%;
}

.coding-rules-view {
  display: grid;
  gap: 12px;
}

.coding-rules-view.hidden {
  display: none;
}

.coding-rules-toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(150px, 220px) minmax(170px, auto) minmax(280px, 1.4fr);
}

.coding-rules-toolbar label span,
.coding-rule-preview span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
}

.coding-rule-preview {
  background: #eef6ff;
  border: 1px solid #cbdced;
  border-radius: 7px;
  min-height: 34px;
  padding: 7px 10px;
}

.coding-rule-preview strong {
  display: block;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.coding-rule-checkbox {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 34px;
}

.coding-rule-checkbox input {
  min-height: 16px;
  width: 16px;
}

.coding-rule-checkbox span {
  margin: 0;
}

.coding-rule-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.coding-rule-table {
  min-width: 1040px;
}

.coding-description-table {
  min-width: 900px;
}

.coding-rule-table th:first-child,
.coding-rule-table td:first-child,
.coding-description-table th:first-child,
.coding-description-table td:first-child {
  text-align: center;
  width: 78px;
}

.coding-rule-table th:nth-child(2),
.coding-rule-table td:nth-child(2),
.coding-description-table th:nth-child(2),
.coding-description-table td:nth-child(2) {
  width: 270px;
}

.coding-rule-table th:nth-child(3),
.coding-rule-table td:nth-child(3) {
  width: 150px;
}

.coding-rule-table th:nth-child(4),
.coding-rule-table td:nth-child(4) {
  width: 80px;
}

.coding-rule-table th:nth-child(5),
.coding-rule-table td:nth-child(5) {
  width: 95px;
}

.coding-rule-table th:nth-child(7),
.coding-rule-table td:nth-child(7) {
  text-align: center;
  width: 105px;
}

.coding-rule-table th:last-child,
.coding-rule-table td:last-child,
.coding-description-table th:last-child,
.coding-description-table td:last-child {
  width: 105px;
}

.coding-rule-order {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.coding-rule-order button {
  height: 27px;
  min-height: 27px;
  padding: 2px 7px;
}

.wide-lookup-table {
  min-width: 1240px;
}

.lookup-table th,
.lookup-table td {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  padding: 3px 4px;
  text-align: left;
  vertical-align: middle;
}

.lookup-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.lookup-table th:first-child,
.lookup-table td:first-child {
  width: 72px;
}

.lookup-table th:last-child,
.lookup-table td:last-child {
  width: 42px;
}

.lookup-table tr:last-child td {
  border-bottom: 0;
}

.lookup-table.quote-lines-table {
  min-width: 1120px;
}

.lookup-table.quote-lines-table th:first-child,
.lookup-table.quote-lines-table td:first-child {
  width: 230px;
}

.lookup-table.quote-lines-table th:nth-child(2),
.lookup-table.quote-lines-table td:nth-child(2) {
  width: 300px;
}

.lookup-table.quote-lines-table th:nth-child(3),
.lookup-table.quote-lines-table td:nth-child(3) {
  width: 75px;
}

.lookup-table.quote-lines-table th:nth-child(4),
.lookup-table.quote-lines-table td:nth-child(4) {
  width: 90px;
}

.lookup-table.quote-lines-table th:nth-child(5),
.lookup-table.quote-lines-table td:nth-child(5) {
  width: 100px;
}

.lookup-table.quote-lines-table th:nth-child(6),
.lookup-table.quote-lines-table td:nth-child(6),
.lookup-table.quote-lines-table th:nth-child(7),
.lookup-table.quote-lines-table td:nth-child(7) {
  width: 75px;
}

.lookup-table.quote-lines-table th:nth-child(8),
.lookup-table.quote-lines-table td:nth-child(8) {
  width: 120px;
}

.lookup-table.quote-lines-table th:last-child,
.lookup-table.quote-lines-table td:last-child {
  text-align: center;
  width: 45px;
}

.lookup-table input {
  font-size: 12px;
  min-height: 26px;
  padding: 3px 5px;
}

.lookup-table select {
  font-size: 12px;
  min-height: 26px;
  padding: 3px 5px;
}

.accessory-phases-table {
  min-width: 900px;
}

.accessory-phases-table th:first-child,
.accessory-phases-table td:first-child {
  width: 36%;
}

.accessory-phases-table th:nth-child(2),
.accessory-phases-table td:nth-child(2) {
  width: 34%;
}

.accessory-phases-table th:nth-child(3),
.accessory-phases-table td:nth-child(3),
.accessory-phases-table th:nth-child(4),
.accessory-phases-table td:nth-child(4) {
  width: 100px;
}

.accessory-phases-table th:last-child,
.accessory-phases-table td:last-child {
  width: 42px;
}

.accessory-outsourcing-table {
  min-width: 720px;
}

.accessory-outsourcing-table th:first-child,
.accessory-outsourcing-table td:first-child {
  width: auto;
}

.accessory-outsourcing-table th:nth-child(2),
.accessory-outsourcing-table td:nth-child(2) {
  width: 140px;
}

.accessory-outsourcing-table th:last-child,
.accessory-outsourcing-table td:last-child {
  width: 42px;
}

.lookup-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  white-space: nowrap;
}

.composite-parts-table th:last-child,
.composite-parts-table td:last-child,
.accessory-phases-table th:last-child,
.accessory-phases-table td:last-child {
  min-width: 124px !important;
  width: 124px !important;
}

.finished-charges-table th:last-child,
.finished-charges-table td:last-child {
  min-width: 78px !important;
  width: 78px !important;
}

.compact-button {
  min-height: 30px;
  padding: 6px 9px;
}

.row-delete {
  align-items: center;
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #b91c1c;
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 24px;
}

.row-open {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  display: inline-flex;
  font-size: 15px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
  width: 24px;
}

.row-move {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 24px;
}

.row-move:hover:not(:disabled) {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.row-open.disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.35;
  pointer-events: none;
}

.lookup-row-focus td {
  background: #e0f2fe !important;
  box-shadow: inset 3px 0 0 var(--accent);
}

.row-delete:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.price-list-table {
  min-width: 1100px;
}

.price-list-table th[data-price-sort] {
  cursor: pointer;
  user-select: none;
}

.price-list-table th[data-price-sort]::after {
  color: #94a3b8;
  content: "↕";
  font-size: 10px;
  margin-left: 5px;
}

.price-list-table th[data-price-sort].sorted {
  color: var(--text);
}

.price-list-table th[data-price-sort].sorted::after {
  color: var(--accent);
  content: "↑";
}

.price-list-table th[data-price-sort].sorted[data-sort-direction="desc"]::after {
  content: "↓";
}

.price-list-table th:first-child,
.price-list-table td:first-child {
  width: 160px;
}

.price-list-table th:nth-child(2),
.price-list-table td:nth-child(2) {
  width: 360px;
}

.price-list-table th:nth-child(3),
.price-list-table td:nth-child(3),
.price-list-table th:nth-child(4),
.price-list-table td:nth-child(4),
.price-list-table th:nth-child(5),
.price-list-table td:nth-child(5),
.price-list-table th:nth-child(6),
.price-list-table td:nth-child(6),
.price-list-table th:nth-child(7),
.price-list-table td:nth-child(7) {
  width: 120px;
}

.price-list-table th:last-child,
.price-list-table td:last-child {
  width: 48px;
}

.price-list-table td.selected-cell {
  background: #dbeafe;
  box-shadow: inset 0 0 0 2px #2563eb;
}

.price-list-table td {
  cursor: cell;
}

.price-list-table td:last-child {
  cursor: default;
}

.finished-bulk-table {
  min-width: 1450px;
  table-layout: fixed;
}

.finished-bulk-table .bulk-column-hidden,
.accessory-bulk-table .bulk-column-hidden {
  display: none;
}

.accessory-bulk-table {
  min-width: 1370px;
  table-layout: fixed;
}

.accessory-bulk-table th,
.accessory-bulk-table td {
  line-height: 1.25;
  padding: 5px 6px;
  vertical-align: middle;
}

.accessory-bulk-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}

.accessory-bulk-table tbody tr:nth-child(even) td {
  background: #f2f8ff;
}

.accessory-bulk-table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accessory-bulk-table th:first-child,
.accessory-bulk-table td:first-child {
  text-align: center;
  width: 34px;
}

.accessory-bulk-table th:nth-child(2),
.accessory-bulk-table td:nth-child(2) {
  font-weight: 700;
  width: 130px;
}

.accessory-bulk-table th:nth-child(3),
.accessory-bulk-table td:nth-child(3) {
  white-space: normal;
  width: 245px;
}

.accessory-bulk-table th:nth-child(4),
.accessory-bulk-table td:nth-child(4) {
  width: 125px;
}

.accessory-bulk-table th:nth-child(5),
.accessory-bulk-table td:nth-child(5) {
  width: 180px;
}

.accessory-bulk-table th:nth-child(6),
.accessory-bulk-table td:nth-child(6) {
  width: 210px;
}

.accessory-bulk-table th:nth-child(7),
.accessory-bulk-table td:nth-child(7) {
  width: 155px;
}

.accessory-bulk-table th:nth-child(n+8):nth-child(-n+11),
.accessory-bulk-table td:nth-child(n+8):nth-child(-n+11) {
  text-align: right;
  width: 110px;
}

.accessory-bulk-table th:last-child,
.accessory-bulk-table td:last-child {
  text-align: center;
  width: 76px;
}

.finished-bulk-table th,
.finished-bulk-table td {
  line-height: 1.25;
  padding: 5px 6px;
  vertical-align: middle;
}

.finished-bulk-table th {
  white-space: normal;
}

.finished-bulk-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}

.finished-bulk-table tbody tr:nth-child(even) td {
  background: #f2f8ff;
}

.finished-bulk-table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finished-bulk-table th:first-child,
.finished-bulk-table td:first-child {
  text-align: center;
  width: 34px;
}

.finished-bulk-table th:nth-child(2),
.finished-bulk-table td:nth-child(2) {
  color: var(--text);
  font-weight: 700;
  width: 126px;
}

.finished-bulk-table th:nth-child(3),
.finished-bulk-table td:nth-child(3) {
  width: 200px;
  white-space: normal;
}

.finished-bulk-table th:nth-child(4),
.finished-bulk-table td:nth-child(4) {
  width: 76px;
}

.finished-bulk-table th:nth-child(5),
.finished-bulk-table td:nth-child(5) {
  width: 118px;
}

.finished-bulk-table th:nth-child(6),
.finished-bulk-table td:nth-child(6) {
  width: 210px;
}

.finished-bulk-table th:nth-child(7),
.finished-bulk-table td:nth-child(7) {
  width: 180px;
}

.finished-bulk-table th:nth-child(8),
.finished-bulk-table td:nth-child(8) {
  width: 110px;
}

.finished-bulk-table th:nth-child(n+9):nth-child(-n+13),
.finished-bulk-table td:nth-child(n+9):nth-child(-n+13) {
  text-align: right;
  width: 108px;
}

.finished-bulk-table th:nth-child(14),
.finished-bulk-table td:nth-child(14) {
  text-align: center;
  width: 54px;
}

.finished-bulk-row-selected td {
  background: #e3f1ff !important;
  box-shadow: inset 0 -1px 0 #c8ddf3;
}

.lookup-table > tbody > tr:hover > td {
  background-color: var(--row-hover) !important;
}

.finished-bulk-row-selected:hover td {
  background: #d7eaff !important;
}

.price-list-table tbody tr:hover td.selected-cell {
  background: #dbeafe !important;
}

.lookup-table.price-list-table > tbody > tr > td.price-below-suggested,
.lookup-table.price-list-table > tbody > tr:hover > td.price-below-suggested,
.lookup-table.price-list-table > tbody > tr > td.price-below-suggested.selected-cell {
  background: #fee2e2 !important;
  box-shadow: inset 0 0 0 2px #dc2626 !important;
}

.price-list-table td.price-below-suggested input,
.price-list-table td.price-below-suggested input:disabled {
  background: #fff1f2 !important;
  border-color: #dc2626 !important;
  color: #b91c1c !important;
  font-weight: 700;
  opacity: 1;
  -webkit-text-fill-color: #b91c1c;
}

.picker-row:hover {
  background: var(--row-hover);
}

.finished-bulk-row-menu-button {
  height: 28px;
  min-height: 28px;
  width: 30px;
}

.finished-bulk-row-menu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(32, 36, 44, 0.2);
  display: grid;
  min-width: 245px;
  padding: 5px;
  position: fixed;
  z-index: 80;
}

.finished-bulk-row-menu button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.finished-bulk-row-menu button:hover {
  background: #eef4fb;
}

.finished-bulk-modal-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: min(72vh, 720px);
  max-height: calc(100vh - 40px);
  max-width: calc(100vw - 4px);
  min-height: min(520px, calc(100vh - 24px));
  min-width: min(900px, calc(100vw - 4px));
  overflow: auto;
  padding: 12px;
  position: relative;
  resize: none;
  width: min(1600px, calc(100vw - 48px));
}

#finishedBulkModal {
  padding: 2px;
}

.finished-bulk-modal-card .modal-head,
.finished-bulk-modal-card .modal-actions {
  flex: 0 0 auto;
}

.finished-bulk-modal-card #finishedBulkModalBody,
.finished-bulk-modal-card #accessoryBulkModalBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

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

.bulk-form-section-title {
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  grid-column: 1 / -1;
  padding: 2px 0 10px;
}

.bulk-dimensions-form {
  align-content: start;
}

.bulk-csv-actions,
.bulk-dimension-import-preview,
.bulk-general-import-preview {
  grid-column: 1 / -1;
}

.bulk-csv-actions {
  justify-content: flex-end;
}

.bulk-parts-csv-actions {
  display: contents;
}

.bulk-parts-import-preview {
  width: 100%;
}

.bulk-parts-import-table table {
  min-width: 920px;
}

.bulk-dimension-import-table,
.bulk-csv-preview-table {
  margin-top: 4px;
  max-height: 260px;
}

.bulk-dimension-import-table table,
.bulk-csv-preview-table table {
  min-width: 720px;
}

.bulk-dimension-import-table th:first-child,
.bulk-dimension-import-table td:first-child,
.bulk-csv-preview-table th:first-child,
.bulk-csv-preview-table td:first-child {
  width: 170px;
}

.bulk-dimension-row {
  align-items: center;
}

.bulk-dimension-row > input[type="checkbox"] {
  margin-bottom: 0;
}

.bulk-dimension-field {
  min-width: 0;
}

.bulk-dimension-field .finished-measurement-inputs {
  grid-template-columns: minmax(0, 1fr);
}

.bulk-field-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: 22px minmax(0, 1fr);
}

.bulk-field-row > input[type="checkbox"] {
  margin-bottom: 11px;
  min-height: 16px;
  width: 16px;
}

.single-record-form .bulk-field-row {
  grid-template-columns: minmax(0, 1fr);
}

.single-record-form .bulk-field-row > input[type="checkbox"] {
  display: none;
}

.bulk-modal-table {
  margin-top: 12px;
  max-height: none;
}

.finished-bulk-modal-card .composite-parts-table,
.finished-bulk-modal-card .accessory-phases-table,
.finished-bulk-modal-card .finished-charges-table,
.finished-bulk-modal-card .accessory-outsourcing-table {
  min-width: 980px;
}

.finished-bulk-modal-card .accessory-outsourcing-table th:first-child,
.finished-bulk-modal-card .accessory-outsourcing-table td:first-child {
  width: auto;
}

.finished-bulk-modal-card .accessory-outsourcing-table th:nth-child(2),
.finished-bulk-modal-card .accessory-outsourcing-table td:nth-child(2) {
  width: 180px;
}

.finished-bulk-modal-card .accessory-outsourcing-table th:last-child,
.finished-bulk-modal-card .accessory-outsourcing-table td:last-child {
  width: 48px;
}

.finished-bulk-modal-card .composite-parts-table th:first-child,
.finished-bulk-modal-card .composite-parts-table td:first-child {
  min-width: 0;
  width: 110px;
}

.finished-bulk-modal-card .composite-parts-table th:nth-child(2),
.finished-bulk-modal-card .composite-parts-table td:nth-child(2) {
  min-width: 300px;
  width: 300px;
}

.finished-bulk-modal-card .composite-parts-table th:nth-child(3),
.finished-bulk-modal-card .composite-parts-table td:nth-child(3),
.finished-bulk-modal-card .composite-parts-table th:nth-child(4),
.finished-bulk-modal-card .composite-parts-table td:nth-child(4) {
  width: 88px;
}

.finished-bulk-modal-card .composite-parts-table th:last-child,
.finished-bulk-modal-card .composite-parts-table td:last-child {
  width: 44px;
}

.finished-bulk-modal-card .accessory-phases-table th:first-child,
.finished-bulk-modal-card .accessory-phases-table td:first-child {
  width: 32%;
}

.finished-bulk-modal-card .accessory-phases-table th:nth-child(2),
.finished-bulk-modal-card .accessory-phases-table td:nth-child(2) {
  width: 24%;
}

.finished-bulk-modal-card .accessory-phases-table th:nth-child(3),
.finished-bulk-modal-card .accessory-phases-table td:nth-child(3),
.finished-bulk-modal-card .accessory-phases-table th:nth-child(4),
.finished-bulk-modal-card .accessory-phases-table td:nth-child(4) {
  width: 130px;
}

.finished-bulk-modal-card .finished-charges-table th:first-child,
.finished-bulk-modal-card .finished-charges-table td:first-child {
  width: 260px;
}

.finished-bulk-modal-card .finished-charges-table th:nth-child(2),
.finished-bulk-modal-card .finished-charges-table td:nth-child(2) {
  width: 55%;
}

.finished-bulk-modal-card .finished-charges-table th:nth-child(3),
.finished-bulk-modal-card .finished-charges-table td:nth-child(3) {
  width: 130px;
}

.finished-bulk-modal-card .finished-charges-table th:last-child,
.finished-bulk-modal-card .finished-charges-table td:last-child {
  width: 48px;
}

.finished-bulk-modal-total {
  align-items: baseline;
  border-top: 2px solid #9db7d3;
  color: var(--text);
  display: flex;
  font-size: 21px;
  font-weight: 800;
  gap: 18px;
  justify-content: flex-end;
  margin-top: 14px;
  padding: 14px 6px 4px;
}

.finished-bulk-modal-total strong {
  color: #1764a8;
  font-size: 30px;
  font-weight: 800;
}

.modal-resize-grip {
  position: absolute;
  z-index: 5;
}

.modal-resize-grip-e {
  bottom: 10px;
  cursor: ew-resize;
  right: 0;
  top: 10px;
  width: 10px;
}

.modal-resize-grip-s {
  bottom: 0;
  cursor: ns-resize;
  height: 10px;
  left: 10px;
  right: 10px;
}

.modal-resize-grip-se {
  bottom: 0;
  cursor: nwse-resize;
  height: 18px;
  right: 0;
  width: 18px;
}

.resizing-modal {
  user-select: none;
}

.modal-card.wide-modal {
  max-width: 920px;
  width: min(920px, calc(100vw - 40px));
}

.child-generator-card {
  max-height: calc(100vh - 48px);
  max-width: 980px;
  overflow: auto;
}

.child-generator-summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.child-generator-progress {
  background: #f0f7ff;
  border: 1px solid #b9d9ff;
  border-radius: 8px;
  color: #164f8f;
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.child-generator-progress strong {
  font-size: 15px;
}

.child-generator-progress progress {
  accent-color: #2563eb;
  height: 14px;
  width: 100%;
}

.child-generator-progress-warning {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.child-generator-progress-warning progress {
  accent-color: #f97316;
}

.child-generator-section h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

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

.check-pill {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  padding: 7px 9px;
}

.child-preview-wrap {
  margin-top: 16px;
  max-height: 260px;
}

.child-preview-table {
  min-width: 760px;
}

.child-preview-new td:last-child {
  color: var(--ok);
  font-weight: 700;
}

.child-preview-created td:last-child {
  color: var(--ok);
  font-weight: 700;
}

.child-preview-exists td:last-child,
.child-preview-duplicate td:last-child,
.child-preview-failed td:last-child {
  color: var(--danger);
  font-weight: 700;
}

.picker-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 420px;
  margin-top: 12px;
  overflow: auto;
}

.picker-toolbar {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: max-content minmax(180px, 1fr) repeat(4, minmax(110px, 145px));
}

.picker-toolbar .search {
  margin: 0;
  min-width: 0;
}

.picker-toolbar .bulk-filter {
  min-width: 0;
  width: 100%;
}

.picker-select-all {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  white-space: nowrap;
}

.picker-select-all input {
  margin: 0;
}

.picker-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 9px 10px;
}

.picker-row:last-child {
  border-bottom: 0;
}

.picker-row span {
  align-items: center;
  display: grid;
  gap: 2px;
  grid-template-columns: 140px 120px 1fr;
  width: 100%;
}

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

.picker-row em {
  color: var(--text);
  font-style: normal;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-empty {
  color: var(--muted);
  font-weight: 700;
  padding: 14px 12px;
}

.modal {
  align-items: center;
  background: rgba(32, 36, 44, 0.35);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 50;
}

.modal.front-modal {
  z-index: 70;
}

.modal.save-progress-modal {
  background: rgba(15, 23, 42, 0.42);
  cursor: wait;
  z-index: 120;
}

.modal-card {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(32, 36, 44, 0.25);
  max-width: 520px;
  padding: 18px;
  width: 100%;
}

.save-progress-card {
  align-items: center;
  display: flex;
  gap: 16px;
  max-width: 440px;
  pointer-events: auto;
}

.save-progress-card h2 {
  font-size: 20px;
  margin: 0 0 6px;
}

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

.save-progress-card > div {
  min-width: 0;
  width: 100%;
}

.save-progress-details {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) auto;
  margin-top: 12px;
}

.save-progress-details progress {
  accent-color: var(--accent);
  height: 10px;
  width: 100%;
}

.save-progress-details strong {
  color: var(--accent);
  font-size: 14px;
  min-width: 52px;
  text-align: right;
}

.save-progress-cancel {
  margin-top: 14px;
}

.save-progress-spinner {
  animation: save-progress-spin 0.8s linear infinite;
  border: 4px solid #dbeafe;
  border-top-color: var(--accent);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 42px;
  width: 42px;
}

@keyframes save-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

.marketplace-orders-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100vh - 116px);
  padding: 16px;
}

.marketplace-orders-view.hidden {
  display: none;
}

.marketplace-orders-head {
  margin: 0;
}

.marketplace-import-actions {
  align-items: center;
}

.marketplace-import-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.marketplace-folder-panel {
  background: #f8fbff;
}

.marketplace-import-source {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.marketplace-import-source h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.marketplace-file-state {
  display: grid;
  gap: 3px;
  min-width: min(420px, 45vw);
  text-align: right;
}

.marketplace-source-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 14px;
  min-width: min(760px, 62vw);
}

.marketplace-source-controls .marketplace-file-state {
  min-width: min(360px, 32vw);
}

.tracking-export-options {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: flex-end;
}

.inline-check {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  white-space: nowrap;
}

.inline-check input {
  margin: 0;
}

.marketplace-file-state span,
.marketplace-import-result span {
  color: var(--muted);
  font-size: 12px;
}

.marketplace-file-state strong {
  overflow-wrap: anywhere;
}

.marketplace-import-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--line);
}

.marketplace-import-result.hidden {
  display: none;
}

.marketplace-import-result > div {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 10px 12px;
  background: var(--panel);
}

.marketplace-import-result strong {
  color: var(--accent-dark);
  font-size: 18px;
}

.marketplace-import-panel > .save-status {
  display: block;
  min-height: 18px;
  margin-top: 10px;
}

.tracking-import-row-updated {
  background: #eefaf3;
}

.tracking-import-row-not_found {
  background: #fff2f2;
}

.tracking-import-row-skipped {
  background: #fff8e7;
}

.orders-folder-table-wrap {
  margin-top: 12px;
}

.orders-folder-table {
  table-layout: fixed;
  min-width: 760px;
}

.orders-folder-table th:nth-child(1) { width: 170px; }
.orders-folder-table th:nth-child(2) { width: 120px; }
.orders-folder-table th:nth-child(3) { width: 160px; }
.orders-folder-table th:nth-child(4) { width: auto; }

.orders-folder-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.orders-folder-file-ready td:last-child {
  color: #166534;
  font-weight: 700;
}

.orders-folder-file-missing td:last-child,
.orders-folder-file-error td:last-child {
  color: #b45309;
  font-weight: 700;
}

.orders-folder-file-loading td:last-child {
  color: var(--accent);
}

.marketplace-import-history-wrap {
  flex: 1;
  margin: 0;
}

.marketplace-history-title {
  margin: 4px 0 -4px;
  font-size: 15px;
}

.marketplace-import-history {
  table-layout: fixed;
  min-width: 980px;
}

.marketplace-import-history th:nth-child(1) { width: 150px; }
.marketplace-import-history th:nth-child(2) { width: 240px; }
.marketplace-import-history th:nth-child(3),
.marketplace-import-history th:nth-child(4) { width: 90px; }
.marketplace-import-history th:nth-child(5),
.marketplace-import-history th:nth-child(6) { width: 160px; }
.marketplace-import-history th:nth-child(7) { width: auto; }

.marketplace-import-history td {
  vertical-align: top;
}

.marketplace-import-history td:nth-child(2),
.marketplace-import-history td:nth-child(7) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.selro-import-history th:nth-child(1) { width: 150px; }
.selro-import-history th:nth-child(2) { width: 300px; }
.selro-import-history th:nth-child(3),
.selro-import-history th:nth-child(4) { width: 90px; }
.selro-import-history th:nth-child(5) { width: 180px; }
.selro-import-history th:nth-child(6) { width: auto; }

.marketplace-preview-panel {
  display: grid;
  gap: 12px;
}

.marketplace-candidate-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  border: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.marketplace-candidate-summary > div {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  background: var(--panel);
}

.marketplace-candidate-summary > div[role="button"] {
  cursor: pointer;
}

.marketplace-candidate-summary > div[role="button"]:hover,
.marketplace-candidate-summary > div[role="button"]:focus-visible,
.marketplace-candidate-summary > div.is-active {
  background: #e8f1fb;
  outline: none;
}

.marketplace-candidate-summary span {
  color: var(--muted);
  font-size: 11px;
}

.marketplace-candidate-summary strong {
  color: var(--accent-dark);
  font-size: 17px;
}

.marketplace-candidate-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 240px) minmax(150px, 220px);
  gap: 8px;
}

.marketplace-candidate-table-wrap {
  max-height: 430px;
  margin: 0;
}

.marketplace-candidate-table {
  min-width: 1580px;
  table-layout: fixed;
}

.marketplace-candidate-table th:nth-child(1) { width: 34px; }
.marketplace-candidate-table th:nth-child(2) { width: 145px; }
.marketplace-candidate-table th:nth-child(3) { width: 92px; }
.marketplace-candidate-table th:nth-child(4) { width: 170px; }
.marketplace-candidate-table th:nth-child(5) { width: 130px; }
.marketplace-candidate-table th:nth-child(6) { width: 54px; }
.marketplace-candidate-table th:nth-child(7) { width: 250px; }
.marketplace-candidate-table th:nth-child(8) { width: 160px; }
.marketplace-candidate-table th:nth-child(9) { width: 74px; }
.marketplace-candidate-table th:nth-child(10) { width: 110px; }
.marketplace-candidate-table th:nth-child(11) { width: 120px; }
.marketplace-candidate-table th:nth-child(12) { width: 115px; }
.marketplace-candidate-table th:nth-child(13) { width: auto; }

.marketplace-candidate-table td {
  height: 34px;
  vertical-align: middle;
}

.marketplace-candidate-row {
  cursor: pointer;
}

.marketplace-candidate-row:focus-visible td {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.marketplace-candidate-table td:nth-child(7),
.marketplace-candidate-table td:nth-child(13) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.marketplace-candidate-checks {
  align-items: center;
  display: flex;
  gap: 8px;
  width: 100%;
}

.marketplace-document-link {
  background: #e8f1fb;
  border: 1px solid #bfd5ef;
  border-radius: 5px;
  color: var(--accent-dark);
  flex: 0 0 auto;
  font-weight: 700;
  padding: 3px 8px;
  text-decoration: none;
  white-space: nowrap;
}

.marketplace-document-link:hover {
  background: #dbeaf9;
  text-decoration: underline;
}

.marketplace-vies-check {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 9px;
  white-space: nowrap;
}

.marketplace-candidate-status-cell {
  align-items: center;
  display: flex;
  gap: 8px;
}

.marketplace-candidate-status {
  font-weight: 700;
}

.marketplace-candidate-status.is-ready { color: #18794e; }
.marketplace-candidate-status.is-waiting { color: #075985; }
.marketplace-candidate-status.is-pending { color: #9a6700; }
.marketplace-candidate-status.is-blocked,
.marketplace-candidate-status.is-canceled { color: #b42318; }
.marketplace-candidate-status.is-linked { color: var(--accent-dark); }

.marketplace-candidate-row.is-ready td { background: #f3fbf7; }
.marketplace-candidate-row.is-waiting td { background: #eaf6ff; }
.marketplace-candidate-row.is-pending td { background: #fff9e8; }
.marketplace-candidate-row.is-blocked td,
.marketplace-candidate-row.is-canceled td { background: #fff5f4; }

.marketplace-candidate-empty {
  padding: 20px !important;
  color: var(--muted);
  text-align: center;
}

.marketplace-preview-modal-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  max-width: min(940px, calc(100vw - 40px));
  overflow: hidden;
}

.marketplace-preview-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.marketplace-preview-section {
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.marketplace-preview-section h3 {
  color: var(--text);
  font-size: 15px;
  margin: 0;
}

.marketplace-preview-pairs {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.marketplace-preview-pair {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.marketplace-preview-pair dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.marketplace-preview-pair dd {
  color: var(--text);
  font-size: 13px;
  margin: 0;
  overflow-wrap: anywhere;
}

.marketplace-preview-address {
  white-space: pre-wrap;
}

.marketplace-preview-checks-list {
  color: var(--text);
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.marketplace-preview-ok {
  color: #18794e;
  font-weight: 700;
  margin: 0;
}

.marketplace-preview-lines-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.marketplace-preview-lines {
  border-collapse: collapse;
  min-width: 780px;
  width: 100%;
}

.marketplace-preview-lines th,
.marketplace-preview-lines td {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.marketplace-preview-lines th {
  background: #eef4fb;
  color: var(--muted);
  font-weight: 700;
}

.marketplace-preview-lines td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.marketplace-preview-lines tr.is-missing td {
  background: #fff5f4;
}

.marketplace-preview-empty-lines {
  color: var(--muted);
  text-align: center !important;
}

@media (max-width: 760px) {
  .marketplace-preview-pairs {
    grid-template-columns: 1fr;
  }
}

.marketplace-settings-section {
  display: grid;
  gap: 12px;
}

.document-settings-tabs {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  overflow-x: auto;
  padding: 6px;
}

.document-settings-tab {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  min-height: 32px;
  padding: 6px 12px;
  white-space: nowrap;
}

.document-settings-tab.active {
  background: #eaf2fb;
  border-color: #c8dbf3;
  color: var(--accent-dark);
  font-weight: 700;
}

.marketplace-settings-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.label-print-settings-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.settings-divider {
  border-top: 1px solid var(--line);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  margin-top: 4px;
  padding-top: 12px;
}

.product-sketch-upload {
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.2fr) auto minmax(120px, auto);
  padding: 10px;
}

.product-sketch-upload .field-caption {
  color: var(--text);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
}

.product-sketch-list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}

.product-sketch-list-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.product-sketch-list-head .field-caption {
  color: var(--text);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 3px;
}

.product-sketch-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.product-sketch-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  padding: 6px;
}

.product-sketch-thumb {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
  width: 52px;
}

.product-sketch-thumb img {
  display: block;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.product-sketch-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-sketch-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-sketch-meta span {
  color: var(--muted);
  font-size: 11px;
}

.product-sketch-delete {
  border-color: #f2b8b5;
  color: #b42318;
}

.product-label-print-table {
  min-width: 960px;
  table-layout: auto;
  width: 100%;
}

.product-label-print-table th:nth-child(1),
.product-label-print-table td:nth-child(1) {
  min-width: 680px;
  width: auto;
}

.product-label-print-table th:nth-child(2),
.product-label-print-table td:nth-child(2) {
  width: 110px;
  white-space: nowrap;
}

.product-label-print-table th:nth-child(3),
.product-label-print-table td:nth-child(3) {
  text-align: center;
  width: 60px;
}

.product-label-print-table td:nth-child(1) .select-combo,
.product-label-print-table td:nth-child(1) .combo-input {
  width: 100%;
}

.product-label-print-table td:nth-child(2) input {
  max-width: 82px;
  min-width: 70px;
  text-align: right;
  width: 82px;
}

.marketplace-mapping-head {
  margin-top: 4px;
}

.marketplace-mapping-table-wrap {
  margin: 0;
}

.marketplace-mapping-table {
  table-layout: fixed;
  min-width: 900px;
}

.marketplace-mapping-table th:nth-child(1) { width: 160px; }
.marketplace-mapping-table th:nth-child(2) { width: 120px; }
.marketplace-mapping-table th:nth-child(3) { width: 330px; }
.marketplace-mapping-table th:nth-child(4) { width: auto; }
.marketplace-mapping-table th:nth-child(5) { width: 38px; }

@media (max-width: 840px) {
  .marketplace-orders-view {
    padding: 10px;
  }

  .marketplace-orders-head,
  .marketplace-import-source {
    align-items: stretch;
    flex-direction: column;
  }

  .marketplace-import-actions {
    width: 100%;
  }

  .marketplace-import-actions button {
    flex: 1;
  }

  .marketplace-file-state {
    min-width: 0;
    text-align: left;
  }

  .marketplace-source-controls {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .marketplace-source-controls .marketplace-file-state {
    min-width: 0;
  }

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

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

  .marketplace-candidate-filters {
    grid-template-columns: 1fr;
  }

  .marketplace-settings-grid {
    grid-template-columns: 1fr;
  }

  .label-print-settings-grid {
    grid-template-columns: 1fr;
  }

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

  .product-sketch-list-head {
    align-items: stretch;
    flex-direction: column;
  }
}

.modal-head,
.modal-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-head {
  margin-bottom: 16px;
}

.modal-head h2 {
  font-size: 20px;
}

.quick-form {
  display: grid;
  gap: 14px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.save-status.ok {
  color: var(--ok);
}

.save-status.warn {
  color: var(--warn);
}

.exchange-rate-date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.exchange-rates-table-wrap {
  max-height: 260px;
  overflow: auto;
}

.exchange-rates-table {
  min-width: 560px;
}

.exchange-rates-table th:first-child,
.exchange-rates-table td:first-child {
  font-weight: 800;
  width: 110px;
}

.exchange-rates-table th:nth-child(2),
.exchange-rates-table td:nth-child(2),
.exchange-rates-table th:nth-child(3),
.exchange-rates-table td:nth-child(3) {
  text-align: right;
  width: 180px;
}

@media (max-width: 860px) {
  .app-header {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .app-status {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 10px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .material-list {
    height: 240px;
  }

  .form-grid,
  .metrics,
  .calculator-grid,
  .customer-form-grid,
  .quote-form-grid,
  .quote-recipient-grid,
  .email-settings-grid,
  .email-template-form,
  .vies-panel,
  .picker-toolbar,
  .finished-physical-grid {
    grid-template-columns: 1fr;
  }

  .finished-weight-field .finished-measurement-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finished-weight-field .finished-measurement-inputs > span:first-child {
    grid-column: 1 / -1;
  }

  .email-template-section {
    grid-template-columns: 1fr;
  }

  .email-template-sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  .email-template-sidebar .material-list {
    height: 240px;
  }

  .quote-footer,
  .quote-notes {
    grid-template-columns: 1fr;
  }

  .calculator-grid div {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }

  label.wide {
    grid-column: auto;
  }

  .email-template-form .full {
    grid-column: auto;
  }

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

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

  .coding-rules-toolbar {
    grid-template-columns: 1fr;
  }
}

.payment-terms-table th:nth-child(1),
.payment-terms-table td:nth-child(1) {
  width: 72px;
}

.payment-terms-table th:nth-child(2),
.payment-terms-table td:nth-child(2),
.payment-terms-table th:nth-child(3),
.payment-terms-table td:nth-child(3) {
  min-width: 360px;
}

.payment-terms-table th:nth-child(4),
.payment-terms-table td:nth-child(4),
.payment-terms-table th:nth-child(5),
.payment-terms-table td:nth-child(5) {
  text-align: center;
  width: 82px;
}

.payment-terms-table th:nth-child(6),
.payment-terms-table td:nth-child(6) {
  width: 76px;
}

.payment-terms-table input[type="checkbox"] {
  height: 17px;
  width: 17px;
}

.incoterms-table th:nth-child(1),
.incoterms-table td:nth-child(1) {
  width: 78px;
}

.incoterms-table th:nth-child(2),
.incoterms-table td:nth-child(2),
.incoterms-table th:nth-child(3),
.incoterms-table td:nth-child(3) {
  min-width: 300px;
}

.incoterms-table th:nth-child(4),
.incoterms-table td:nth-child(4) {
  width: 170px;
}

.incoterms-table th:nth-child(5),
.incoterms-table td:nth-child(5),
.incoterms-table th:nth-child(7),
.incoterms-table td:nth-child(7) {
  width: 84px;
}

.incoterms-table th:nth-child(6),
.incoterms-table td:nth-child(6) {
  width: 72px;
  text-align: center;
}

.incoterms-table input[type="checkbox"] {
  height: 17px;
  width: 17px;
}

.sales-bulk-controls {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr) auto minmax(190px, 0.8fr) auto auto;
}

.sales-bulk-table {
  min-width: 1210px;
  table-layout: fixed;
}

.sales-bulk-table th,
.sales-bulk-table td {
  line-height: 1.18;
  overflow-wrap: anywhere;
  padding: 4px 5px;
  vertical-align: top;
  white-space: normal;
}

.sales-bulk-table th {
  white-space: nowrap;
}

.sales-bulk-table th:nth-child(1),
.sales-bulk-table td.sales-bulk-check-cell {
  text-align: center;
  width: 28px;
}

.sales-bulk-table th:nth-child(2),
.sales-bulk-table td.sales-bulk-order-cell {
  width: 145px;
}

.sales-bulk-table th:nth-child(3),
.sales-bulk-table td.sales-bulk-status-cell {
  width: 78px;
}

.sales-bulk-table th:nth-child(4),
.sales-bulk-table th:nth-child(5),
.sales-bulk-table th:nth-child(6),
.sales-bulk-table td.sales-bulk-date-cell {
  width: 82px;
}

.sales-bulk-table th:nth-child(7),
.sales-bulk-table td.sales-bulk-source-cell {
  width: 64px;
}

.sales-bulk-table th:nth-child(8),
.sales-bulk-table td.sales-bulk-customer-cell {
  width: 140px;
}

.sales-bulk-table th:nth-child(9),
.sales-bulk-table td.sales-bulk-money {
  width: 72px;
}

.sales-bulk-table th:nth-child(10),
.sales-bulk-table td.sales-bulk-invoice-cell {
  width: 150px;
}

.sales-bulk-table th:nth-child(11),
.sales-bulk-table td.sales-bulk-tracking-cell {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  width: 88px;
}

.sales-bulk-table th:nth-child(12),
.sales-bulk-table td.sales-bulk-labels-cell {
  width: 104px;
}

.sales-bulk-table th:nth-child(13),
.sales-bulk-table td.sales-bulk-actions-cell {
  width: 90px;
}

.sales-bulk-table .sales-row-action {
  min-width: 0;
  width: 84px;
}

.sales-bulk-row {
  cursor: pointer;
}

.sales-bulk-row:hover td {
  background: #f6fafe;
}

.sales-bulk-row:focus-visible td {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.sales-bulk-row input,
.sales-bulk-row select,
.sales-bulk-row button {
  cursor: auto;
}

.sales-bulk-muted {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  margin-top: 2px;
}

.sales-bulk-marketplace-number {
  color: #15803d;
  font-size: 12px;
  font-weight: 500;
}

.warn-text {
  color: #b45309;
  font-weight: 700;
}

.ok-text {
  color: #047857;
  font-weight: 700;
}

.sales-bulk-money {
  font-weight: 700;
  text-align: right;
}

.quote-invoice-attachment {
  margin-top: 14px;
}

.quote-invoice-attachment .calculator-head {
  align-items: center;
}

.quote-picked-status,
.sales-bulk-picked-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-top: 2px;
  padding: 1px 6px;
  border: 1px solid #86efac;
  border-radius: 4px;
  background: #dcfce7;
  color: #047857;
  font-style: normal;
  font-weight: 700;
}

.sales-bulk-picked-badge {
  margin-left: 0;
  margin-right: 4px;
}

.pick-list-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.pick-list-preview-dialog {
  width: min(1120px, calc(100vw - 48px));
  height: min(88vh, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.pick-list-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #dbe4ef;
}

.pick-list-preview-head h2 {
  margin: 0;
  font-size: 18px;
}

.pick-list-preview-frame {
  width: 100%;
  flex: 1;
  border: 0;
  background: #fff;
}

@media (max-width: 900px) {
  .sales-bulk-controls {
    grid-template-columns: 1fr;
  }
}
