:root {
  --navy: #142338;
  --navy2: #1b304a;
  --ink: #202d3f;
  --muted: #738196;
  --line: #e4e9ef;
  --soft: #f5f7fa;
  --bg: #f6f8fb;
  --orange: #ed8b37;
  --orange2: #fff4e9;
  --blue: #2d72c7;
  --green: #17845b;
  --red: #c64d4d;
  --shadow: 0 14px 40px rgba(25, 42, 65, 0.08);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 18% 18%, #253d5b 0, #172b43 38%, #101b2b 100%);
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 38px 40px 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
}
.brand b {
  font:
    800 13px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  letter-spacing: 1.5px;
  display: block;
}
.brand small {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: #9fb1c5;
  display: block;
  margin-top: 3px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--orange);
  display: grid;
  place-items: center;
  color: #182b42;
  font:
    800 20px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
}
.brand-login {
  color: var(--ink);
  margin-bottom: 34px;
}
.brand-login small {
  color: #8a97a7;
}
.login-card h1 {
  font:
    800 28px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  margin: 0 0 7px;
  letter-spacing: -0.7px;
}
.login-card > p {
  font-size: 13px;
  margin: 0 0 28px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stack label,
.settings-form label {
  font-size: 12px;
  font-weight: 700;
  color: #45546a;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #dce3eb;
  border-radius: 7px;
  padding: 10px 11px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  transition:
    border 0.15s,
    box-shadow 0.15s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #7aa8d9;
  box-shadow: 0 0 0 3px rgba(45, 114, 199, 0.1);
}
input::placeholder,
textarea::placeholder {
  color: #a9b3c0;
}
.login-card input {
  padding: 13px;
}
.login-foot {
  border-top: 1px solid var(--line);
  margin-top: 26px;
  padding-top: 18px;
  text-align: center;
  color: #9aa5b3;
  font-size: 11px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}
.sidebar {
  width: 238px;
  min-width: 238px;
  background: var(--navy);
  padding: 25px 16px 18px;
  display: flex;
  flex-direction: column;
  color: #fff;
  min-height: 100vh;
}
.sidebar .brand {
  padding: 0 9px 36px;
}
.workspace-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #7e91a9;
  padding: 0 12px 12px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nav-link {
  border: 0;
  background: transparent;
  color: #aab7c8;
  border-radius: 8px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
}
.nav-link:hover {
  background: #203852;
  color: #fff;
}
.nav-link.active {
  background: #294563;
  color: #fff;
  box-shadow: inset 3px 0 var(--orange);
}
.nav-icon {
  font-size: 18px;
  width: 18px;
  text-align: center;
}
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 10px 4px;
  color: #8093a9;
  font-size: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.online-dot {
  height: 7px;
  width: 7px;
  border-radius: 50%;
  background: #51c998;
  box-shadow: 0 0 0 3px rgba(81, 201, 152, 0.12);
}
.main-area {
  flex: 1;
  min-width: 0;
}
.topbar {
  height: 82px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 38px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.6px;
  font-weight: 800;
  color: #a0aaba;
  margin-bottom: 4px;
}
.topbar h2 {
  font:
    800 20px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  margin: 0;
  letter-spacing: -0.4px;
}
.top-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9f1fa;
  color: #326ca9;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
}
.avatar.large {
  width: 48px;
  height: 48px;
  font-size: 16px;
}
.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 100px;
}
.user-meta b {
  font-size: 12px;
}
.user-meta span {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.icon-btn {
  border: 0;
  background: transparent;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #78869a;
  font-size: 22px;
  border-radius: 8px;
}
.icon-btn:hover {
  background: var(--soft);
  color: var(--ink);
}
.page {
  padding: 29px 38px 50px;
  max-width: 1600px;
  margin: 0 auto;
}
.page-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-intro h3 {
  font:
    800 19px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  margin: 0 0 5px;
  letter-spacing: -0.4px;
}
.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn.primary {
  background: var(--navy);
  color: #fff;
}
.btn.primary:hover {
  background: #25415f;
  transform: translateY(-1px);
}
.btn.primary span {
  font-size: 17px;
  line-height: 10px;
}
.btn.subtle {
  background: #fff;
  border-color: #dfe5ec;
  color: #56667b;
}
.btn.subtle:hover {
  background: #f4f7fa;
}
.btn.dashed {
  background: #fff;
  border: 1px dashed #c5d0dc;
  color: #426b94;
}
.btn.dashed:hover {
  border-color: #6e9bc7;
  background: #f6faff;
}
.btn.full {
  width: 100%;
  padding: 13px;
}
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 21px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px 17px;
  min-width: 0;
}
.stat-card span {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8d9aab;
}
.stat-card strong {
  font:
    800 23px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  display: block;
  margin-top: 5px;
}
.stat-card.new-order-stat {
  background: linear-gradient(135deg, #fff5dc 0%, #ffe5a8 100%);
  border: 2px solid #ffb52e;
  box-shadow: 0 5px 18px rgba(245, 158, 11, 0.2);
  position: relative;
  overflow: hidden;
}
.new-order-stat:before {
  content: "";
  position: absolute;
  right: -15px;
  top: -23px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 184, 48, 0.23);
}
.new-order-stat span {
  color: #99530b;
}
.new-order-stat strong {
  color: #9a4e00;
  font-size: 21px;
  white-space: nowrap;
}
.new-order-stat small {
  display: block;
  margin-top: 5px;
  color: #a66a1c;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.search-wrap {
  width: min(390px, 100%);
  position: relative;
}
.search-wrap span {
  position: absolute;
  left: 12px;
  top: 7px;
  font-size: 21px;
  color: #91a0b2;
}
.search-wrap input {
  padding: 10px 12px 10px 36px;
  background: #fff;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sort-note {
  font-size: 10px;
  color: #8996a7;
}
.group-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: #2d6eac;
  font-weight: 800;
  font-size: 11px;
}
.group-link:hover {
  text-decoration: underline;
}
.status-pill,
.priority-pill {
  display: inline-block;
  border-radius: 20px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.status-place-order {
  background: #fff1df;
  color: #ad6b20;
}
.status-in-production {
  background: #eaf3ff;
  color: #316fae;
}
.status-on-hold {
  background: #fff0f0;
  color: #bb4c4c;
}
.status-shipped {
  background: #e7f7ef;
  color: #16815a;
}
.priority-very-urgent {
  background: #ffe9e8;
  color: #bd3c3c;
}
.priority-rush {
  background: #fff1df;
  color: #a9681d;
}
.priority-stock {
  background: #edf1f5;
  color: #65768b;
}
.action-cell {
  overflow: visible !important;
}
.table-action {
  border: 1px solid #e1e6ed;
  background: #fff;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 700;
  color: #52647a;
  margin-right: 4px;
}
.table-action:hover {
  background: #f3f7fb;
}
.table-action.done {
  color: #137c56;
  border-color: #b8dfce;
}
.table-foot {
  display: flex;
  justify-content: space-between;
  color: #99a4b2;
  font-size: 10px;
  padding: 11px 2px;
}

/* order-entry cards */
.item-cards {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.item-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 4px 15px rgba(27, 45, 68, 0.035);
  overflow: hidden;
}
.item-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid #edf0f4;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.item-index {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #fff1e4;
  color: #bd742e;
  display: grid;
  place-items: center;
  font:
    800 11px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
}
.item-card-title b {
  font:
    800 12px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
}
.item-card-title small {
  display: block;
  color: #98a4b3;
  font-size: 10px;
  margin-top: 2px;
}
.item-card-body {
  padding: 17px 18px 19px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 13px;
}
.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 10px;
  font-weight: 800;
  color: #526176;
  letter-spacing: 0.15px;
}
.field .hint {
  font-weight: 400;
  color: #9aa5b3;
  margin-left: 3px;
}
.field input,
.field select,
.field textarea {
  padding: 9px 10px;
  font-size: 12px;
  height: 36px;
}
.field textarea {
  height: auto;
  min-height: 58px;
  resize: vertical;
}
.span-1 {
  grid-column: span 1;
}
.span-2 {
  grid-column: span 2;
}
.span-3 {
  grid-column: span 3;
}
.span-4 {
  grid-column: span 4;
}
.span-5 {
  grid-column: span 5;
}
.span-6 {
  grid-column: span 6;
}
.span-7 {
  grid-column: span 7;
}
.span-8 {
  grid-column: span 8;
}
.span-12 {
  grid-column: span 12;
}
.catalog-preview {
  height: 88px;
  border: 1px dashed #d6dee8;
  border-radius: 7px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  color: #9ba8b6;
  font-size: 10px;
  overflow: hidden;
}
.catalog-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.entry-divider {
  grid-column: span 12;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 0 -3px;
  color: #8795a6;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}
.entry-divider:after {
  content: "";
  height: 1px;
  background: #edf0f4;
  flex: 1;
}
.optional-spec {
  margin-top: 15px;
  border: 1px solid #e8edf2;
  border-radius: 8px;
  overflow: hidden;
}
.optional-spec summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 11px 13px;
  font-size: 10px;
  font-weight: 800;
  color: #586a80;
}
.optional-spec summary::-webkit-details-marker {
  display: none;
}
.optional-spec summary:after {
  content: "＋";
  font-size: 15px;
  color: #8a9aad;
}
.optional-spec[open] summary:after {
  content: "−";
}
.optional-spec-body {
  padding: 14px 13px 16px;
}
.form-bottom-grid {
  margin-top: 16px;
}
.file-picker {
  border: 1px dashed #cbd6e2;
  border-radius: 7px;
  padding: 11px;
  background: #fafbfd;
}
.file-picker input {
  height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}
.file-list {
  font-size: 10px;
  color: #78889b;
  margin-top: 5px;
}
.card-tools {
  display: flex;
  align-items: center;
  gap: 7px;
}
.text-button {
  border: 0;
  background: none;
  color: #73839a;
  font-size: 10px;
  font-weight: 700;
  padding: 5px;
}
.text-button:hover {
  color: #c45555;
}
.add-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 15px 0 18px;
}
.submit-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.submit-bar b {
  display: block;
  font-size: 12px;
}
.submit-bar small {
  display: block;
  color: #96a1af;
  font-size: 10px;
  margin-top: 4px;
}
.submit-buttons {
  display: flex;
  gap: 8px;
}
.form-actions-top {
  display: flex;
  gap: 8px;
}

/* dialogs and details */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 24, 39, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  backdrop-filter: blur(3px);
}
.modal {
  width: min(100%, 570px);
  max-height: 90vh;
  background: #fff;
  border-radius: 13px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.large-modal {
  width: min(1080px, 100%);
}
.password-modal {
  width: min(460px, 100%);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 23px 15px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  font:
    800 17px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  margin: 0 0 4px;
}
.modal-head p {
  margin: 0;
}
.modal-body {
  padding: 18px 23px;
  overflow: auto;
}
.modal-foot {
  padding: 13px 23px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.detail-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 13px;
  overflow: hidden;
}
.detail-head {
  padding: 11px 14px;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.detail-head b {
  font-size: 11px;
}
.detail-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.detail-field span {
  display: block;
  color: #94a0af;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}
.detail-field b {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.detail-wide {
  grid-column: span 2;
}
.detail-note {
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 500 !important;
  line-height: 1.5;
}
.modal-form-card {
  padding: 0;
  border: 0;
  box-shadow: none;
}
.modal-form-card .item-card-body {
  padding: 0;
}
.modal-form-card .item-card-head {
  display: none;
}
.modal-form-card .optional-spec {
  margin-top: 12px;
}
.inline-edit-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  margin-top: 14px;
}
.settings-card {
  max-width: 700px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 23px;
  box-shadow: 0 4px 15px rgba(27, 45, 68, 0.035);
}
.settings-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.settings-heading h3 {
  font:
    800 15px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  margin: 0 0 3px;
}
.settings-heading p {
  font-size: 11px;
  margin: 0;
}
.settings-form {
  max-width: 420px;
  padding-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-form h4 {
  font:
    800 12px Manrope,
    "Segoe UI",
    Arial,
    sans-serif;
  margin: 0 0 2px;
}
.settings-form button {
  align-self: flex-start;
}
.toast {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 40;
  background: #1e334b;
  color: #fff;
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.error {
  background: #9e3939;
}
.status-select {
  border: 1px solid #dce3eb;
  border-radius: 20px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 800;
  background: white;
  max-width: 130px;
}
.status-select.status-place-order {
  background: #fff1df;
  color: #ad6b20;
}
.status-select.status-in-production {
  background: #eaf3ff;
  color: #316fae;
}
.status-select.status-on-hold {
  background: #fff0f0;
  color: #bb4c4c;
}
.status-select.status-shipped {
  background: #e7f7ef;
  color: #16815a;
}
.factory-note {
  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.5;
  min-width: 130px;
}
.badge-count {
  background: #f1f4f8;
  color: #728197;
  border-radius: 20px;
  padding: 4px 7px;
  font-size: 9px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .sidebar {
    width: 205px;
    min-width: 205px;
  }
  .page {
    padding: 25px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .span-1 {
    grid-column: span 2;
  }
  .span-5 {
    grid-column: span 6;
  }
  .span-7 {
    grid-column: span 6;
  }
  .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    min-height: 0;
    width: 100%;
    padding: 12px 14px;
    display: block;
  }
  .sidebar .brand {
    padding: 0 4px 12px;
  }
  .workspace-label,
  .sidebar-bottom {
    display: none;
  }
  .sidebar nav {
    flex-direction: row;
  }
  .nav-link {
    flex: 1;
    justify-content: center;
    padding: 9px 6px;
    font-size: 11px;
  }
  .main-area {
    width: 100%;
  }
  .topbar {
    height: 70px;
    padding: 0 15px;
  }
  .page {
    padding: 21px 14px 36px;
  }
  .page-intro {
    align-items: flex-start;
    gap: 10px;
  }
  .page-intro .btn {
    font-size: 10px;
    padding: 9px;
  }
  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .stat-card {
    padding: 11px;
  }
  .stat-card span {
    font-size: 8px;
  }
  .stat-card strong {
    font-size: 19px;
  }
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .toolbar-right {
    justify-content: space-between;
  }
  .sort-note {
    font-size: 9px;
  }
  .form-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }
  .span-1,
  .span-2,
  .span-3,
  .span-4,
  .span-5,
  .span-6 {
    grid-column: span 3;
  }
  .span-7,
  .span-8,
  .span-12 {
    grid-column: span 6;
  }
  .catalog-preview {
    height: 80px;
  }
  .item-card-body {
    padding: 13px;
  }
  .item-card-head {
    padding: 12px 13px;
  }
  .submit-bar {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }
  .submit-buttons {
    width: 100%;
  }
  .submit-buttons .btn {
    flex: 1;
  }
  .modal-backdrop {
    padding: 8px;
  }
  .modal {
    max-height: 96vh;
  }
  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 14px;
    padding-right: 14px;
  }
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 11px;
    gap: 10px;
  }
  .detail-wide {
    grid-column: span 2;
  }
  .top-user .user-meta {
    display: none;
  }
  .login-card {
    padding: 30px 25px;
  }
  .form-actions-top {
    display: none;
  }
}

.unit-input {
  display: flex;
  align-items: stretch;
  position: relative;
}
.unit-input input {
  border-radius: 7px 0 0 7px;
  flex: 1;
  min-width: 0;
}
.unit-input > span {
  height: 36px;
  min-width: 30px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border: 1px solid #dce3eb;
  border-left: 0;
  border-radius: 0 7px 7px 0;
  background: #f5f7fa;
  color: #7d8b9d;
  font-size: 11px;
  font-weight: 700;
}
.field textarea {
  line-height: 1.45;
  min-height: 55px;
}

.qty-control {
  height: 36px;
  display: flex;
  border: 1px solid #dce3eb;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}
.qty-control button {
  width: 29px;
  flex: 0 0 29px;
  border: 0;
  background: #f4f7fa;
  color: #61748a;
  font-size: 15px;
  font-weight: 700;
}
.qty-control button:hover {
  background: #e8eff6;
}
.qty-control input {
  height: 34px;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: center;
  padding: 5px 2px;
  min-width: 0;
}
.qty-control input::-webkit-inner-spin-button,
.qty-control input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-control input {
  -moz-appearance: textfield;
}

/* Shared multi-user editing and pessimistic-lock feedback */
.group-lock-banner {
  margin: 0 0 13px;
  padding: 10px 13px;
  border: 1px solid #f0d6a8;
  border-radius: 8px;
  background: #fff8eb;
  color: #8a5a17;
  font-size: 11px;
  line-height: 1.5;
}

.group-lock-banner.mine {
  border-color: #b8dfce;
  background: #effaf4;
  color: #16714f;
}

.table-action:disabled,
.status-select:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.table-action:disabled:hover,
.status-select:disabled:hover {
  background: #fff;
}

/* Visual order-entry refresh: warmer grouping, strong cues, and a large square item image. */
.item-cards {
  gap: 18px;
}

.item-card {
  border: 1px solid #e7d9c7;
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(82, 58, 31, 0.06);
}

.item-card-head {
  background: linear-gradient(100deg, #fff1df 0%, #fff8ee 58%, #f4f8fd 100%);
  border-bottom: 1px solid #f0dfca;
  padding: 13px 18px;
}

.item-index {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #e58b33;
  color: #fff;
  font:
    800 12px "Segoe UI",
    Arial,
    sans-serif;
  box-shadow: 0 2px 6px rgba(201, 119, 37, 0.2);
}

.item-card-title b {
  font-size: 13px;
  color: #473a2d;
}

.item-card-title small {
  font-size: 10px;
  color: #9a805f;
}

.item-card-body {
  padding: 18px;
}

.primary-entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 19px;
  align-items: stretch;
}

.primary-fields {
  min-width: 0;
}

.primary-fields .form-grid {
  gap: 12px;
}

.primary-fields .field label,
.optional-spec .field label,
.notes-entry-grid .field label {
  color: #53647a;
  font-size: 10px;
}

.primary-fields input,
.primary-fields select,
.optional-spec input,
.optional-spec select,
.notes-entry-grid input,
.notes-entry-grid textarea {
  height: 39px;
  border-color: #d8e1eb;
  border-radius: 7px;
}

.primary-fields input:focus,
.primary-fields select:focus,
.optional-spec input:focus,
.optional-spec select:focus {
  border-color: #e1a04c;
  box-shadow: 0 0 0 3px rgba(225, 160, 76, 0.13);
}

.preview-side {
  background: #f4f8fd;
  border: 1px solid #dce7f2;
  border-radius: 11px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #426a91;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  margin: 1px 2px 9px;
}

.preview-title small {
  font-size: 9px;
  color: #8fa2b6;
  letter-spacing: 0;
  font-weight: 600;
  text-transform: none;
}

.catalog-preview {
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  min-height: 0;
  max-height: none;
  border: 1px solid #d7e1eb;
  border-radius: 9px;
  background: #fff;
  display: grid;
  place-items: center;
  color: #98a7b7;
  font-size: 11px;
  overflow: hidden;
}

.catalog-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: #93a4b7;
}

.preview-placeholder b {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff5e8;
  color: #d58b3d;
  font-size: 30px;
  font-weight: 400;
}

.preview-placeholder span {
  font-size: 12px;
  font-weight: 800;
  color: #71859b;
}

.preview-placeholder small {
  font-size: 10px;
  color: #a4b1bf;
}

.preview-caption {
  text-align: center;
  font-size: 9px;
  color: #92a1b1;
  margin: 8px 0 0;
  line-height: 1.35;
}

.entry-divider.colored-divider {
  color: #b27731;
  margin-top: 4px;
}

.entry-divider.colored-divider:after {
  background: #f2e3d2;
}

.color-spec {
  border: 1px solid #e5d7c6;
  border-radius: 9px;
  background: #fffdfa;
  margin-top: 18px;
}

.color-spec summary {
  background: linear-gradient(90deg, #fff2e1, #fffaf3);
  padding: 12px 14px;
  gap: 10px;
  color: #76552c;
}

.color-spec summary > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.color-spec summary b {
  font-size: 10px;
  letter-spacing: 0.65px;
}

.color-spec summary small {
  font-size: 10px;
  color: #a18b70;
  font-weight: 500;
  letter-spacing: 0;
}

.spec-summary-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f4dfc3;
  color: #bb762d;
  display: grid;
  place-items: center;
  font-size: 17px;
}

.spec-toggle {
  font-size: 17px;
  color: #b77a39;
}

.color-spec[open] .spec-toggle {
  transform: rotate(45deg);
}

.optional-spec-body {
  padding: 15px;
  background: #fffdfa;
}

.gem-help {
  font-size: 10px;
  color: #9b8a73;
  padding-top: 8px;
}

.field select:disabled,
.field input:disabled,
.unit-input input:disabled {
  background: #f1f3f6;
  color: #a7b0bc;
  cursor: not-allowed;
  opacity: 0.75;
}

.color-file-picker {
  background: #fbfcff;
  border-color: #bfcfe0;
}

.color-file-picker input {
  height: auto;
  border: 0;
}

.notes-entry-grid {
  align-items: end;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid #edf0f4;
}

.notes-entry-grid .field:last-child {
  background: #fff8ec;
  border: 1px solid #efdfc8;
  border-radius: 8px;
  padding: 9px;
}

.notes-entry-grid .field:last-child input {
  border-color: #e6cda8;
  text-align: center;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.remove-item-btn {
  color: #b95648;
}
.clear-item-btn {
  color: #9a6a2f;
}

.clear-item-btn:hover {
  background: #fff0dc;
  border-radius: 6px;
}
.remove-item-btn:hover {
  background: #fff0ee;
  border-radius: 6px;
}

/* Compact, color-coded order group list. Each order item is its own single-line row. */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
}

.list-empty {
  min-height: 145px;
  border: 1px dashed #d6dee8;
  border-radius: 11px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #91a0b1;
  font-size: 12px;
  text-align: center;
  padding: 24px;
}

.list-empty b {
  font-size: 14px;
  color: #52657b;
}
.list-empty span {
  font-size: 11px;
}
.error-text {
  color: #b94b4b;
}

.order-column-head,
.order-item-row {
  display: grid;
  align-items: center;
  gap: 0;
}

.vendor-layout,
.customer-layout {
  grid-template-columns: minmax(105px, 1.04fr) 62px minmax(168px, 1.7fr) minmax(94px, 0.95fr) minmax(
      78px,
      0.78fr
    ) minmax(82px, 0.82fr) 55px minmax(82px, 0.85fr) 78px minmax(104px, 1.05fr) minmax(125px, 1.28fr);
}

.factory-layout {
  grid-template-columns: minmax(105px, 1.04fr) 62px minmax(185px, 1.75fr) minmax(98px, 0.98fr) minmax(
      78px,
      0.78fr
    ) minmax(82px, 0.82fr) 55px 78px minmax(125px, 1.25fr) minmax(95px, 0.95fr);
}

.order-column-head {
  min-width: 1250px;
  padding: 9px 12px;
  background: #eaf0f7;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  color: #6d7d92;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.65px;
  text-transform: uppercase;
}

.order-column-head.factory-layout {
  min-width: 1110px;
}

.order-group-card {
  background: #fff;
  border: 1px solid #e0e6ed;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 4px 13px rgba(28, 47, 71, 0.035);
}

.order-group-head {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  background: #f6f8fb;
  border-bottom: 1px solid #e8edf3;
}

.order-group-head.vendor-ffd {
  background: linear-gradient(90deg, #fff2e4, #fffaf5);
}

.order-group-head.vendor-xs {
  background: linear-gradient(90deg, #eaf5ff, #f8fbff);
}

.order-group-head.vendor-cvd {
  background: linear-gradient(90deg, #f3edff, #fcfaff);
}

.group-ident {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 210px;
}

.group-mark {
  height: 27px;
  width: 27px;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #e7d5bf;
  color: #c17b33;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.vendor-xs .group-mark {
  color: #347dbb;
  border-color: #c9dff1;
}
.vendor-cvd .group-mark {
  color: #8461b9;
  border-color: #ddd0ef;
}

.group-ident > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.group-ident .group-link {
  font-size: 11px;
  text-align: left;
}

.group-ident small {
  font-size: 9px;
  color: #8b98a9;
}

.group-head-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8492a3;
  font-size: 9px;
  white-space: nowrap;
  min-width: 0;
}

.group-due b {
  color: #465b73;
  font-size: 10px;
  margin-left: 3px;
}

.group-progress {
  padding: 4px 7px;
  border-radius: 20px;
  background: #edf4ef;
  color: #438061;
  font-weight: 800;
}

.group-lock-chip {
  color: #9a681e;
  background: #fff4dd;
  border-radius: 20px;
  padding: 4px 7px;
  font-weight: 800;
}

.group-head-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.mini-action {
  border: 1px solid #dce3eb;
  border-radius: 6px;
  background: #fff;
  color: #53657b;
  padding: 5px 7px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
}

.mini-action:hover {
  background: #edf4fb;
  border-color: #bdd0e2;
  color: #315f8a;
}

.mini-action.edit {
  color: #2f6ea9;
  border-color: #ccdeee;
}
.mini-action.delete {
  color: #a84f4c;
  border-color: #ecd0ce;
}
.mini-action.done {
  color: #167b55;
  border-color: #bddfcf;
  background: #f5fcf8;
}

.mini-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.group-item-rows {
  min-width: 1250px;
}

.order-group-card.factory-layout .group-item-rows {
  min-width: 1110px;
}

.order-item-wrap + .order-item-wrap {
  border-top: 1px solid #edf0f4;
}

.order-item-row {
  min-height: 76px;
  padding: 8px 12px;
  background: #fff;
}

.order-item-wrap:nth-child(odd) .order-item-row {
  background: #fff;
}

.order-item-wrap:nth-child(even) .order-item-row {
  background: #fcfdff;
}

.item-cell {
  min-width: 0;
  padding: 0 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.list-image {
  width: 54px;
  height: 54px;
  border-radius: 7px;
  border: 1px solid #e3e8ee;
  background: #f8fafc;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.list-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.image-placeholder {
  font-size: 23px;
  color: #c2ccd7;
}

.specs-cell {
  overflow: hidden;
}

.spec-chip-list {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.spec-chip-list > span,
.spec-chip-list > b {
  display: inline-flex;
  align-items: center;
  background: #f0f3f7;
  color: #627187;
  border-radius: 4px;
  padding: 4px 5px;
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
  flex: 0 0 auto;
}

.spec-chip-list .spec-qty {
  background: #fff0df;
  color: #b66d23;
}
.spec-chip-list .spec-gold {
  background: #fff5d8;
  color: #9b792c;
}

.gold-w {
  background: #f2f6fb !important;
  color: #718199 !important;
}
.gold-yw {
  background: #fff3d9 !important;
  color: #9d7c35 !important;
}
.gold-r {
  background: #ffe9e6 !important;
  color: #bb5b53 !important;
}
.gold-b {
  background: #eaf3fb !important;
  color: #477eac !important;
}

.client-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.client-cell > b {
  font-size: 10px;
  color: #34475e;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alias-chip {
  display: inline-block;
  border-radius: 10px;
  background: #f3efff;
  color: #7758a7;
  padding: 2px 6px;
  font-size: 8px;
  font-weight: 900;
}

.client-sub {
  font-size: 8px;
  color: #a5afbb;
}

.gem-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.gem-token {
  width: 100%;
  display: grid;
  grid-template-columns: 17px 1fr;
  align-items: center;
  column-gap: 4px;
  border-radius: 6px;
  padding: 5px 4px;
  background: #f5f7fa;
  color: #607086;
  min-width: 0;
}

.gem-token > b {
  grid-row: span 3;
  font-size: 16px;
  text-align: center;
  color: #8a9caf;
}

.gem-token > span {
  font-size: 8px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gem-token > small {
  font-size: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gem-token > .gem-color-label {
  font-weight: 800;
  opacity: 0.9;
}

.gem-empty {
  color: #b5bfca;
  font-size: 13px;
}

.date-cell b,
.due-cell b {
  font-size: 9px;
  color: #65758a;
}

.factory-tag {
  display: inline-block;
  min-width: 31px;
  text-align: center;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 900;
  background: #edf2f7;
  color: #65778d;
}

.fac-gn {
  background: #e9f5ed;
  color: #38845a;
}
.fac-ab {
  background: #eaf3ff;
  color: #3976b7;
}
.fac-dr {
  background: #fff0e4;
  color: #b56c2c;
}
.fac-oth {
  background: #f0edf7;
  color: #786597;
}

.pic-cell {
  text-align: center;
}
.pic-chip {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 23px;
  padding: 0 5px;
  border-radius: 6px;
  background: #eaf0f7;
  color: #435d79;
  font-size: 9px;
  letter-spacing: 0.5px;
}

.note-flags {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 4px;
}
.note-flag {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 19px;
  height: 15px;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 7px;
  font-weight: 900;
}
.note-flag.cn {
  background: #fff1dc;
  color: #a86c22;
}
.note-flag.fd {
  background: #e8f1ff;
  color: #3f70ad;
}
.note-flag.empty {
  background: #f2f4f6;
  color: #a6b0bd;
}

.status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.status-cell .status-pill {
  font-size: 8px;
  padding: 4px 6px;
}
.status-cell .status-select {
  max-width: 120px;
  font-size: 8px;
  padding: 5px 7px;
}

.action-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: visible !important;
  white-space: normal;
}

.factory-notes-line {
  display: flex;
  gap: 16px;
  padding: 6px 16px 8px 14px;
  background: #fffaf2;
  border-top: 1px dashed #eee1d2;
  color: #6c7989;
  font-size: 10px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.factory-notes-line > span {
  flex: 1;
  min-width: 0;
}
.factory-notes-line b {
  font-size: 8px;
  color: #a36d2b;
  margin-right: 4px;
}

.order-item-wrap:hover .order-item-row {
  background: #f8fbff;
}

@media (max-width: 1050px) {
  .primary-entry-layout {
    grid-template-columns: minmax(0, 1fr) 205px;
  }
  .vendor-layout,
  .customer-layout {
    grid-template-columns: minmax(100px, 1fr) 58px minmax(150px, 1.5fr) minmax(
        85px,
        0.85fr
      ) 72px 78px 50px 78px 70px 100px 120px;
  }
  .factory-layout {
    grid-template-columns: minmax(100px, 1fr) 58px minmax(165px, 1.6fr) minmax(
        85px,
        0.85fr
      ) 72px 78px 50px 70px 120px 95px;
  }
}

@media (max-width: 760px) {
  .primary-entry-layout {
    grid-template-columns: 1fr;
  }
  .preview-side {
    max-width: 270px;
    margin: 0 auto;
    width: 100%;
    grid-row: 1;
  }
  .primary-fields .form-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .primary-fields .span-5 {
    grid-column: span 4;
  }
  .primary-fields .span-3,
  .primary-fields .span-2 {
    grid-column: span 3;
  }
  .primary-fields .span-12 {
    grid-column: span 6;
  }
  .notes-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .notes-entry-grid .span-5 {
    grid-column: span 1;
  }
  .notes-entry-grid .span-2 {
    grid-column: span 2;
  }
  .item-card-body {
    padding: 13px;
  }
  .item-card-head {
    padding: 12px 13px;
  }
  .order-group-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .group-head-meta {
    order: 3;
    width: 100%;
    padding-left: 36px;
  }
  .group-head-actions {
    margin-left: auto;
  }
  .order-column-head {
    display: none;
  }
  .group-item-rows,
  .order-group-card.factory-layout .group-item-rows {
    min-width: 1100px;
  }
  .factory-notes-line {
    flex-direction: column;
    gap: 5px;
  }
}

#ordersList {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 3px;
}

#ordersList.vendor-layout,
#ordersList.customer-layout {
  scrollbar-color: #b9c9d9 #eef2f6;
  scrollbar-width: thin;
}

#ordersList.factory-layout {
  scrollbar-color: #b9c9d9 #eef2f6;
  scrollbar-width: thin;
}

.order-group-card {
  min-width: 1250px;
}

.order-group-card.factory-layout {
  min-width: 1110px;
}

.order-column-head.factory-layout {
  min-width: 1110px;
}

.order-column-head.vendor-layout,
.order-column-head.customer-layout {
  min-width: 1250px;
}

@media (max-width: 760px) {
  .order-group-card {
    min-width: 1250px;
  }
  .order-group-card.factory-layout {
    min-width: 1110px;
  }
  .order-column-head {
    display: grid !important;
  }
}

/* Larger catalog photo in factory group detail view */
.factory-detail-image {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 14px 4px;
  background: #fff;
}

.factory-detail-image img {
  display: block;
  width: min(100%, 240px);
  height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

@media (max-width: 600px) {
  .factory-detail-image img {
    width: 190px;
    height: 190px;
  }
}

/* XS and factory queues include a dedicated second-gem column. */
.xs-layout {
  grid-template-columns: minmax(105px, 1.02fr) 62px minmax(168px, 1.65fr) minmax(94px, 0.92fr) minmax(
      78px,
      0.76fr
    ) minmax(82px, 0.8fr) minmax(82px, 0.8fr) 55px minmax(82px, 0.82fr) 78px minmax(104px, 1.02fr) minmax(
      125px,
      1.22fr
    );
}

.order-column-head.factory-layout.xs-layout {
  min-width: 1190px;
}

.order-group-card.factory-layout.xs-layout .group-item-rows {
  min-width: 1190px;
}

.order-column-head.vendor-layout.xs-layout,
.order-group-card.vendor-layout.xs-layout .group-item-rows {
  min-width: 1330px;
}

.gem2-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

@media (max-width: 1050px) {
  .xs-layout {
    grid-template-columns: minmax(100px, 1fr) 58px minmax(165px, 1.6fr) minmax(
        85px,
        0.85fr
      ) 72px 78px 78px 50px 78px 70px 100px 120px;
  }
}

@media (max-width: 760px) {
  .order-group-card.factory-layout.xs-layout .group-item-rows {
    min-width: 1190px;
  }
  .order-column-head.vendor-layout.xs-layout,
  .order-group-card.vendor-layout.xs-layout .group-item-rows {
    min-width: 1330px;
  }
}

/* Factory queues omit the due-date column, so their XS-capable grid has 11 tracks. */
.factory-layout.xs-layout {
  grid-template-columns: minmax(105px, 1.02fr) 62px minmax(168px, 1.65fr) minmax(94px, 0.92fr) minmax(
      78px,
      0.76fr
    ) minmax(82px, 0.8fr) minmax(82px, 0.8fr) 55px minmax(104px, 1.02fr) 78px minmax(125px, 1.22fr);
}

.order-column-head.factory-layout.xs-layout,
.order-group-card.factory-layout.xs-layout .group-item-rows {
  min-width: 1190px;
}

@media (max-width: 1050px) {
  .factory-layout.xs-layout {
    grid-template-columns: minmax(100px, 1fr) 58px minmax(165px, 1.6fr) minmax(
        85px,
        0.85fr
      ) 72px 78px 78px 50px 100px 70px 120px;
  }
}

/* Clickable date headers: Order date = newest first; Due date = earliest first. */
.order-column-head .sort-header {
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: center;
  cursor: pointer;
}

.order-column-head .sort-header:hover,
.order-column-head .sort-header.active {
  color: #245f99;
}

.order-column-head .sort-header span {
  padding-left: 3px;
  font-size: 12px;
}

/* Factory queues now show Due date between Factory and PIC / Notes. */
.factory-layout.xs-layout {
  grid-template-columns: minmax(105px, 1.02fr) 62px minmax(168px, 1.65fr) minmax(94px, 0.92fr) minmax(
      78px,
      0.76fr
    ) minmax(82px, 0.8fr) minmax(82px, 0.8fr) 55px minmax(82px, 0.82fr) minmax(104px, 1.02fr) 78px minmax(
      125px,
      1.22fr
    );
}

.order-column-head.factory-layout.xs-layout,
.order-group-card.factory-layout.xs-layout .group-item-rows {
  min-width: 1300px;
}

@media (max-width: 1050px) {
  .factory-layout.xs-layout {
    grid-template-columns: minmax(100px, 1fr) 58px minmax(165px, 1.6fr) minmax(
        85px,
        0.85fr
      ) 72px 78px 78px 50px 78px 100px 70px 120px;
  }
}

.status-select {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 108px;
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid #d3dfeb;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
}

.status-select .status-current {
  font-size: 10px;
}

.status-select .status-action {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  opacity: 0.85;
}

.status-select.status-in-transit {
  background: #f0edff;
  color: #6846a5;
  border-color: #d9cff5;
}

.status-select:not(:disabled):hover {
  outline: 2px solid rgba(45, 114, 199, 0.18);
}

.status-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.image-open-link {
  display: inline-flex;
  cursor: zoom-in;
}

.image-open-link img {
  display: block;
}

.catalog-preview .image-open-link {
  max-width: 100%;
  max-height: 100%;
}

/* Enlarged image preview with pointer-following magnification. */
.image-open-link.image-preview-trigger {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  overflow: hidden;
}

.image-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(12, 22, 35, 0.78);
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-preview-card {
  position: relative;
  width: min(900px, 94vw);
  max-height: 94vh;
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-preview-heading {
  font-size: 13px;
  font-weight: 800;
  color: #33475f;
  padding-right: 42px;
}

.image-preview-close {
  position: absolute;
  right: 12px;
  top: 8px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f0f3f7;
  color: #33475f;
  font-size: 25px;
  line-height: 1;
}

.image-preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 180px;
  max-height: 78vh;
  overflow: hidden;
  background: #f6f8fb;
  border-radius: 8px;
}

.image-preview-main {
  display: block;
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.image-preview-zoom {
  display: none;
  position: absolute;
  width: 240px;
  height: 240px;
  border: 3px solid #fff;
  border-radius: 12px;
  box-shadow: 0 7px 28px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 700% 700%;
}

.image-preview-hint {
  text-align: center;
  color: #8492a3;
  font-size: 10px;
}

@media (max-width: 600px) {
  .image-preview-backdrop {
    padding: 8px;
  }
  .image-preview-card {
    padding: 12px;
  }
  .image-preview-zoom {
    width: 180px;
    height: 180px;
    background-size: 700% 700%;
  }
}

.status-placed-order {
  background: #fff1df;
  color: #ad6b20;
  border-color: #f0d8b8;
}

.status-pill.status-placed-order {
  background: #fff1df;
  color: #ad6b20;
}
.status-pill.status-in-transit {
  background: #f0edff;
  color: #6846a5;
}

/* Order list visual refresh: compact pinned column headings, larger readable item cards. */
#ordersList {
  overflow: visible !important;
  padding-bottom: 8px;
}

.order-column-head {
  position: sticky !important;
  top: 0;
  z-index: 30;
  min-width: 1420px !important;
  padding: 11px 14px !important;
  background: #eaf0f7;
  box-shadow: 0 5px 12px rgba(25, 42, 65, 0.12);
  border-radius: 8px 8px 0 0;
  font-size: 11px !important;
}

.order-column-head.vendor-layout,
.order-column-head.customer-layout,
.order-column-head.factory-layout {
  min-width: 1420px !important;
}

.order-group-card,
.order-group-card.factory-layout {
  min-width: 1420px !important;
}

.order-column-head.vendor-layout,
.order-item-row.vendor-layout,
.order-column-head.customer-layout,
.order-item-row.customer-layout,
.order-column-head.factory-layout,
.order-item-row.factory-layout {
  grid-template-columns: minmax(150px, 1.18fr) minmax(220px, 1.7fr) minmax(130px, 1fr) minmax(110px, 0.9fr) minmax(
      105px,
      0.86fr
    ) 76px minmax(105px, 0.86fr) minmax(105px, 0.86fr) minmax(135px, 1.08fr) minmax(120px, 0.98fr) !important;
}

.order-column-head.vendor-layout.xs-layout,
.order-item-row.vendor-layout.xs-layout {
  grid-template-columns: minmax(150px, 1.18fr) minmax(220px, 1.7fr) minmax(130px, 1fr) minmax(110px, 0.9fr) minmax(
      105px,
      0.86fr
    ) minmax(105px, 0.86fr) 76px minmax(105px, 0.86fr) minmax(105px, 0.86fr) minmax(135px, 1.08fr) minmax(
      120px,
      0.98fr
    ) !important;
  min-width: 1540px !important;
}

.order-column-head.vendor-layout.xs-layout {
  min-width: 1540px !important;
}

.order-group-card.vendor-layout.xs-layout,
.order-group-card.vendor-layout.xs-layout .group-item-rows {
  min-width: 1540px !important;
}

.order-item-row {
  min-height: 126px !important;
  padding: 12px 14px !important;
}

.item-cell {
  padding: 0 9px !important;
}

.item-photo-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: visible;
}

.item-photo-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.catalog-id {
  color: #263b53;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 900;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-photo-meta .priority-pill {
  font-size: 10px;
  padding: 4px 8px;
}

.list-image {
  width: 86px !important;
  height: 86px !important;
  border-radius: 9px;
  box-shadow: 0 2px 7px rgba(24, 43, 66, 0.08);
}

.list-image img {
  object-fit: contain;
}

.specs-cell {
  overflow: visible !important;
  white-space: normal !important;
}

.spec-chip-list {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  white-space: normal;
  min-width: 0;
}

.spec-chip-list > span,
.spec-chip-list > b {
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 6px;
}

.spec-chip-list .spec-qty {
  font-size: 12px;
}

.client-cell > b {
  font-size: 12px;
}

.alias-chip {
  font-size: 10px;
  padding: 3px 7px;
}

.client-sub {
  font-size: 10px;
}

.gem-token {
  padding: 7px 6px;
  grid-template-columns: 20px 1fr;
}

.gem-token > b {
  font-size: 18px;
}

.gem-token > span,
.gem-token > small {
  font-size: 10px;
}

.date-cell b,
.due-cell b {
  font-size: 11px;
}

.factory-tag {
  font-size: 11px;
  padding: 6px 8px;
}

.pic-chip {
  font-size: 11px;
  min-width: 34px;
  height: 27px;
}

.note-flag {
  font-size: 9px;
  min-width: 23px;
  height: 18px;
}

.status-cell .status-pill {
  font-size: 10px;
  padding: 6px 9px;
}

.status-cell .status-select {
  max-width: 145px;
  min-width: 120px;
  font-size: 10px;
}

.status-select .status-current {
  font-size: 11px;
}

.status-select .status-action {
  font-size: 9px;
}

.action-cell .mini-action {
  font-size: 10px;
  padding: 7px 9px;
}

.factory-notes-line {
  font-size: 11px;
  padding: 8px 18px;
}

.factory-notes-line b {
  font-size: 10px;
}

.order-group-head {
  padding: 12px 16px;
}

.group-link {
  font-size: 13px;
}

.group-ident small,
.group-head-meta {
  font-size: 11px;
}

.group-due b {
  font-size: 12px;
}

.mini-action {
  font-size: 10px;
  padding: 6px 9px;
}

/* Allow the sticky list heading to stick to the page viewport during vertical scrolling. */
.main-area,
.page {
  overflow: visible;
}

@media (max-width: 760px) {
  #ordersList {
    overflow: visible !important;
  }

  .order-column-head {
    display: grid !important;
  }

  .order-group-card,
  .order-column-head {
    min-width: 1420px !important;
  }

  .order-group-card.vendor-layout.xs-layout,
  .order-column-head.vendor-layout.xs-layout {
    min-width: 1540px !important;
  }

  .order-item-row {
    min-height: 126px !important;
  }
}

/* Compact left navigation and clearer specification tokens */
.sidebar {
  width: 82px;
  min-width: 82px;
  padding: 20px 9px 16px;
  align-items: center;
}

.sidebar .brand {
  padding: 0 0 28px;
  justify-content: center;
  width: 100%;
}

.sidebar .brand > div,
.workspace-label,
.sidebar-bottom span {
  display: none;
}

.sidebar nav {
  width: 100%;
  gap: 8px;
}

.nav-link {
  justify-content: center;
  padding: 12px 6px;
  gap: 0;
  font-size: 0;
  border-radius: 9px;
}

.nav-link .nav-icon {
  font-size: 20px;
  line-height: 1;
}

.sidebar-bottom {
  justify-content: center;
  width: 100%;
  padding: 12px 0;
}

.main-area {
  min-width: 0;
}

.spec-chip-list {
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
  gap: 6px;
  align-content: center;
}

.spec-chip-list > span,
.spec-chip-list > b {
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 6px;
}

.spec-chip-list .spec-qty {
  font-size: 11px;
}

.spec-chip-list .spec-karat {
  background: #fff4cf;
  color: #8b6414;
  border: 1px solid #f0d98b;
}

.spec-chip-list .gold-b {
  background: #171717 !important;
  color: #fff !important;
  border: 1px solid #050505;
}

.spec-chip-list .gold-yw {
  background: linear-gradient(90deg, #f5cc45 0 50%, #e8edf2 50% 100%) !important;
  color: #374151 !important;
  border: 1px solid #d6dce4;
}

.order-item-row {
  min-height: 84px;
}

.item-photo-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.item-photo-meta .catalog-id {
  font-size: 12px;
  line-height: 1.25;
}

.item-photo-meta .priority-pill {
  font-size: 10px;
  padding: 4px 7px;
}

.list-image {
  width: 68px;
  height: 68px;
}

.modal {
  min-height: 0;
}

.modal-head {
  position: relative;
  top: auto;
  z-index: 3;
  flex: 0 0 auto;
  background: #fff;
  align-items: flex-start;
  min-height: 76px;
  overflow: visible;
}

.modal-head > div {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.modal-head h3,
.modal-head p {
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
}

.modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

#modalBody .modal-form-card {
  max-width: 100%;
  overflow: visible;
}

#modalBody .inline-edit-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 10px 0 2px;
  z-index: 2;
}

@media (max-width: 760px) {
  .sidebar {
    width: 100%;
    min-width: 0;
    align-items: stretch;
  }
  .sidebar .brand {
    justify-content: flex-start;
    padding: 0 4px 12px;
  }
  .sidebar .brand > div {
    display: block;
  }
  .sidebar nav {
    width: 100%;
  }
  .nav-link {
    font-size: 11px;
    gap: 7px;
    justify-content: center;
  }
  .nav-link .nav-icon {
    font-size: 16px;
  }
  .sidebar-bottom {
    display: none;
  }
  .list-image {
    width: 60px;
    height: 60px;
  }
}

.priority-list-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 16px 0 22px;
}

.priority-list-section > h3 {
  margin: 0;
  padding: 9px 12px;
  border-left: 4px solid #d28b3e;
  background: #f3f6fa;
  border-radius: 6px;
  color: #30445c;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.4px;
}

/* List navigation and search updates */
.global-search {
  margin: 0 0 12px !important;
}

.global-search .search-wrap {
  width: 100%;
  max-width: none;
}

.global-search input {
  font-size: 14px;
  min-height: 42px;
}

.list-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  border-bottom: 1px solid #dce4ee;
  padding-bottom: 8px;
}

.list-tab {
  border: 1px solid #dce4ee;
  background: #fff;
  color: #607187;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.list-tab:hover {
  background: #f3f6fa;
  color: #34475e;
}

.list-tab.active {
  background: #243b55;
  color: #fff;
  border-color: #243b55;
}

.order-column-head {
  font-size: 11px !important;
  padding: 11px 14px !important;
}

.group-due b {
  font-size: 12px !important;
}

.date-cell b,
.due-cell b {
  font-size: 13px !important;
}

.client-cell > b {
  font-size: 13px !important;
}

.spec-chip-list > span,
.spec-chip-list > b {
  font-size: 12px !important;
}

.pic-chip {
  font-size: 12px !important;
}

@media (max-width: 760px) {
  .list-tabs {
    gap: 5px;
  }
  .list-tab {
    flex: 1;
    padding: 9px 5px;
    font-size: 11px;
  }
  .global-search input {
    font-size: 13px;
  }
}

/* Factory Note: dedicated final column for instructions from FFD / XS / CVD */
.factory-note-cell {
  white-space: normal !important;
  overflow: visible !important;
  overflow-wrap: anywhere;
  line-height: 1.4;
  color: #465b73;
  font-size: 11px;
  min-width: 0;
  padding: 8px 10px !important;
  border-left: 1px solid #edf0f4;
  background: #fbfcfe;
}

.order-column-head.vendor-layout,
.order-item-row.vendor-layout,
.order-column-head.customer-layout,
.order-item-row.customer-layout,
.order-column-head.factory-layout,
.order-item-row.factory-layout {
  grid-template-columns:
    minmax(145px, 1.12fr) minmax(205px, 1.55fr) minmax(120px, 0.95fr)
    minmax(100px, 0.82fr) minmax(92px, 0.75fr) 72px minmax(92px, 0.75fr)
    minmax(95px, 0.78fr) minmax(105px, 0.82fr) minmax(105px, 0.82fr)
    minmax(185px, 1.25fr) !important;
}

.order-column-head.vendor-layout.xs-layout,
.order-item-row.vendor-layout.xs-layout {
  grid-template-columns:
    minmax(145px, 1.12fr) minmax(205px, 1.55fr) minmax(120px, 0.95fr)
    minmax(100px, 0.82fr) minmax(100px, 0.82fr) minmax(92px, 0.75fr)
    72px minmax(92px, 0.75fr) minmax(95px, 0.78fr) minmax(105px, 0.82fr)
    minmax(105px, 0.82fr) minmax(185px, 1.25fr) !important;
}

.order-group-card,
.order-column-head {
  min-width: 1650px !important;
}

.order-group-card.vendor-layout.xs-layout,
.order-column-head.vendor-layout.xs-layout {
  min-width: 1800px !important;
}

@media (max-width: 760px) {
  .order-group-card,
  .order-column-head {
    min-width: 1650px !important;
  }

  .order-group-card.vendor-layout.xs-layout,
  .order-column-head.vendor-layout.xs-layout {
    min-width: 1800px !important;
  }
}

/* Shared editable Factory Note column (invoice notes and production/update issues). */
.factory-note-editor {
  display: block;
  width: 100%;
  min-height: 48px;
  resize: vertical;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #fff;
  color: #34465c;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.factory-note-editor[readonly] {
  cursor: text;
  background: #f8fafc;
  border-color: transparent;
}

.factory-note-editor.is-editing {
  background: #fffef7;
  border-color: #d69a37;
  box-shadow: 0 0 0 2px rgba(214, 154, 55, 0.12);
}

.factory-note-editor::placeholder {
  color: #9aa7b6;
  font-size: 10px;
}

.factory-note-hint {
  display: block;
  margin-top: 3px;
  color: #97a3b1;
  font-size: 9px;
  line-height: 1.2;
}

.factory-note-read {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #465b73;
  line-height: 1.45;
}

.item-photo-meta .priority-pill.priority-rush {
  font-size: 13px !important;
  padding: 6px 11px !important;
  font-weight: 950;
  letter-spacing: 0.35px;
  box-shadow: 0 2px 7px rgba(169, 104, 29, 0.18);
}

.item-photo-meta .priority-pill.priority-very-urgent {
  font-size: 15px !important;
  padding: 7px 12px !important;
  font-weight: 950;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  box-shadow: 0 3px 9px rgba(189, 60, 60, 0.2);
}

/* Larger and bolder Factory CN / FD Notes */
.factory-notes-line {
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.6 !important;
  color: #343f4c !important;
  padding: 10px 18px !important;
  gap: 22px !important;
}

.factory-notes-line > span {
  font-weight: 600 !important;
}

.factory-notes-line b {
  font-size: 12px !important;
  font-weight: 900 !important;
  color: #8a5720 !important;
  margin-right: 6px !important;
}

/* ---------------------------------------------------------------------------
   2026-11 cleanup
   --------------------------------------------------------------------------- */

/* Group header: keep the group's actions next to its name so they are visible
   without scrolling sideways on wide order rows. */
.order-group-head {
  justify-content: flex-start;
  gap: 18px;
}
.order-group-head .group-head-meta {
  order: 2;
}
.order-group-head .group-head-actions {
  order: 3;
}

/* Status is now a dropdown listing only the moves this account may make. */
.status-cell .status-select,
select.status-select {
  appearance: auto;
  display: inline-block;
  width: 100%;
  min-width: 0 !important;
  max-width: 150px;
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
select.status-select option {
  background: #fff;
  color: #26374d;
}
.status-pill {
  border-radius: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.status-in-production {
  border-color: #cfe0f5;
}
.status-on-hold {
  border-color: #f2cccc;
}
.status-shipped {
  border-color: #c3e8d5;
}

/* Second gemstone shown under the first for accounts without a Gemstone 2 column. */
.gem-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.gem-stack .gem-token {
  padding: 4px 6px;
}
.item-cell.status-cell {
  padding: 0 4px !important;
}
.status-cell .status-select {
  padding: 4px 2px 4px 6px;
  font-size: 10px;
}

/* ---------------------------------------------------------------------------
   Factory Gemstone 2 column, custom designs, form feedback
   --------------------------------------------------------------------------- */

/* Factories get the same 12-column grid as XS (extra Gemstone 2 column). */
.order-column-head.factory-layout.xs-layout,
.order-item-row.factory-layout.xs-layout {
  grid-template-columns:
    minmax(145px, 1.12fr) minmax(205px, 1.55fr) minmax(120px, 0.95fr)
    minmax(100px, 0.82fr) minmax(100px, 0.82fr) minmax(92px, 0.75fr)
    72px minmax(92px, 0.75fr) minmax(95px, 0.78fr) minmax(105px, 0.82fr)
    minmax(105px, 0.82fr) minmax(185px, 1.25fr) !important;
  min-width: 1800px !important;
}
.order-group-card.factory-layout.xs-layout,
.order-group-card.factory-layout.xs-layout .group-item-rows {
  min-width: 1800px !important;
}

/* List tab counts */
.list-tab .tab-count {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #eef2f7;
  color: #55677d;
  font-size: 11px;
  text-align: center;
}
.list-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Custom design markers */
.custom-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: #ede7fb;
  color: #5b3aa6;
  border: 1px solid #d8ccf4;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-left: 6px;
}
.custom-desc {
  margin: 0 0 6px;
  padding: 6px 8px;
  border-left: 3px solid #8a6ad1;
  background: #f7f3ff;
  border-radius: 4px;
  color: #3f2f6b;
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}
.custom-desc-detail {
  color: #3f2f6b;
  font-weight: 600;
}
.edited-chip {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 6px;
  background: #fff4d6;
  color: #8a5a00;
  border: 1px solid #f1d68d;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

/* Catalog / Custom switch on the order form */
.order-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.order-type-toggle label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid #dbe3ec;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.order-type-toggle input {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 16px;
  height: 16px;
  margin: 0;
}
.order-type-toggle b {
  font-size: 13px;
  color: #26374d;
}
.order-type-toggle small {
  font-size: 11px;
  color: #7d8a9b;
}
.order-type-toggle label.active {
  border-color: #243b55;
  background: #f4f7fb;
  box-shadow: 0 0 0 2px rgba(36, 59, 85, 0.08);
}
.item-card.is-custom .order-type-toggle label.active {
  border-color: #7552c4;
  background: #f7f3ff;
  box-shadow: 0 0 0 2px rgba(117, 82, 196, 0.12);
}
.item-card.is-custom {
  border-color: #cdbcf0;
}
.custom-brief {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f3ff;
  border: 1px dashed #c8b6ee;
}
.custom-brief .form-grid,
.custom-brief .field {
  margin: 0;
}
.custom-brief textarea {
  width: 100%;
  min-height: 70px;
}
.hidden.custom-brief {
  display: none;
}

/* Existing attachments with remove buttons */
.attachment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 10px;
  border: 1px solid #dbe3ec;
  border-radius: 14px;
  background: #fff;
  font-size: 11px;
}
.attachment-chip a {
  color: #2d5f93;
  text-decoration: none;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #f1f4f8;
  color: #9a3434;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.attachment-chip button:hover {
  background: #fde2e2;
}

/* Field validation */
.invalid,
input.invalid,
select.invalid,
textarea.invalid {
  border-color: #d64545 !important;
  box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.15) !important;
}
input:disabled::placeholder {
  color: #a7b2bf;
}
.inline-edit-actions .btn:disabled,
.submit-buttons .btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.detail-field .custom-desc-detail {
  display: block;
  margin-top: 4px;
  padding: 8px 10px;
  border-left: 3px solid #8a6ad1;
  border-radius: 4px;
  background: #f7f3ff;
  color: #3f2f6b;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------------------
   Updates feed, history, shipping, factory accounts
   --------------------------------------------------------------------------- */
.nav-link {
  position: relative;
}
.nav-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e5484d;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--navy);
}
.nav-badge.hidden {
  display: none;
}
.updates-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.updates-filters {
  display: flex;
  gap: 6px;
}
.updates-filter {
  border: 1px solid #dce4ee;
  background: #fff;
  color: #607187;
  border-radius: 18px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.updates-filter.active {
  background: #243b55;
  border-color: #243b55;
  color: #fff;
}
.updates-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 18px 12px;
}
.update-day {
  margin: 16px 0 6px;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #8a97a8;
}
.update-day-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.update-row {
  display: grid;
  grid-template-columns: 74px 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 8px;
  border-bottom: 1px solid #eef2f6;
  border-radius: 6px;
}
.update-row:last-child {
  border-bottom: 0;
}
.update-row.unread {
  background: #fff8e6;
  box-shadow: inset 3px 0 #f0a92e;
}
.update-time {
  color: #8a97a8;
  font-size: 11px;
  padding-top: 6px;
  font-variant-numeric: tabular-nums;
}
.update-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: #eef2f7;
}
.update-icon.kind-company {
  background: #e7effa;
  color: #245f99;
}
.update-icon.kind-factory {
  background: #e8f6ee;
  color: #1c7a4d;
}
.update-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.update-who.kind-company {
  color: #245f99;
}
.update-who.kind-factory {
  color: #1c7a4d;
}
.update-action {
  padding: 2px 7px;
  border-radius: 5px;
  background: #f1f4f8;
  color: #4d5f75;
  font-size: 11px;
  font-weight: 700;
}
.update-group {
  border: 0;
  background: none;
  padding: 0;
  color: #2d6aa6;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}
.update-group.closed {
  color: #97a3b1;
  text-decoration: none;
  cursor: default;
}
.update-mine {
  font-size: 10px;
  color: #97a3b1;
}
.update-detail {
  margin-top: 3px;
  color: #34465c;
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.updates-more {
  text-align: center;
  margin-top: 14px;
}
.group-history {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.group-history h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.group-history .update-row {
  grid-template-columns: 140px 30px 1fr;
}

/* Shipping details */
.status-cell {
  gap: 5px !important;
}
.ship-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
  line-height: 1.3;
  color: #34465c;
  max-width: 100%;
  overflow: hidden;
}
.ship-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ship-carrier {
  font-weight: 800;
}
.ship-track a {
  color: #2d6aa6;
}
.ship-invoice {
  color: #7a5a12;
  font-weight: 700;
}
.ship-btn {
  font-size: 10px !important;
  padding: 5px 7px !important;
  white-space: nowrap;
}
.detail-ship {
  padding: 0 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-ship .ship-info {
  flex-direction: row;
  gap: 12px;
  font-size: 12px;
}
.shipping-modal {
  width: min(460px, 94vw);
}
.shipping-modal .stack label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}
.shipping-modal .checkbox-line {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 600 !important;
}
.shipping-modal .checkbox-line input {
  width: auto;
}
.shipping-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.hidden.checkbox-line,
label.hidden {
  display: none !important;
}

/* Factory accounts (Account page, company only) */
.factory-accounts-card {
  margin-top: 18px;
}
.factory-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px 6px;
}
.factory-account-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.2fr) minmax(220px, 1.5fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e3e9f0;
  border-radius: 9px;
  background: #fbfcfe;
}
.fa-who {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
}
.fa-who small {
  grid-column: 1 / -1;
  color: #8a97a8;
  font-size: 11px;
}
.factory-account-row input[name="password"] {
  font-family: ui-monospace, Consolas, monospace;
}
@media (max-width: 760px) {
  .factory-account-row {
    grid-template-columns: 1fr;
  }
  .update-row {
    grid-template-columns: 56px 26px 1fr;
  }
}
.settings-card.factory-accounts-card {
  max-width: 1000px;
  width: 100%;
  box-sizing: border-box;
}
.factory-account-row {
  grid-template-columns: minmax(190px, 1fr) minmax(180px, 1.3fr) auto auto;
}

/* ---------------------------------------------------------------------------
   New-order alerts and receipt confirmation
   --------------------------------------------------------------------------- */
.new-orders-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff1e6 0%, #ffe1c7 100%);
  border: 2px solid #f08a24;
  box-shadow: 0 6px 18px rgba(240, 138, 36, 0.18);
}
.new-orders-banner.hidden {
  display: none;
}
.nob-icon {
  font-size: 26px;
}
.nob-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nob-text > b {
  font-size: 15px;
  color: #8a3d00;
}
.nob-text small {
  color: #8a5a2a;
  font-size: 12px;
}
.new-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #e8590c;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.6px;
  animation: newPulse 1.6s ease-in-out infinite;
}
.new-pill.big {
  margin-top: 0;
  font-size: 11px;
  padding: 4px 8px;
}
@keyframes newPulse {
  50% {
    box-shadow: 0 0 0 4px rgba(232, 89, 12, 0.18);
  }
}
@media (prefers-reduced-motion: reduce) {
  .new-pill {
    animation: none;
  }
}
.mini-action.confirm,
.btn.confirm-btn {
  background: #e8590c !important;
  border-color: #e8590c !important;
  color: #fff !important;
  font-weight: 800;
}
.mini-action.confirm:hover,
.btn.confirm-btn:hover {
  background: #c94a06 !important;
}
.factory-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ack-chip {
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  padding: 2px 4px;
  border-radius: 4px;
  text-align: center;
  white-space: normal;
}
.ack-chip.ok {
  color: #1c7a4d;
  background: #e8f6ee;
}
.ack-chip.wait {
  color: #9a5b00;
  background: #fff3d6;
}
.ack-summary {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}
.ack-summary.ok {
  color: #1c7a4d;
  background: #e8f6ee;
}
.ack-summary.wait {
  color: #9a5b00;
  background: #fff3d6;
  border: 1px solid #f1d68d;
}

/* Factory email settings (Account page) */
.email-setup-note {
  margin: 0 4px 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f7fb;
  color: #3d5068;
  font-size: 12px;
}
.fa-email {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px 10px;
  align-items: end;
  padding-top: 8px;
  border-top: 1px dashed #e0e6ee;
}
.fa-email label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #55677d;
}
.fa-email-status {
  grid-column: 1 / -1;
  color: #6b7b8f;
  font-size: 11px;
}
.fa-email-status.bad {
  color: #b42318;
  font-weight: 700;
}

/* ---------------------------------------------------------------------------
   View controls, status grouping, partner (read-only) orders
   --------------------------------------------------------------------------- */
.view-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: -2px 0 14px;
}
.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #55677d;
}
.sort-control select {
  width: auto;
  min-width: 120px;
  padding: 7px 8px;
}
.sort-dir {
  padding: 7px 10px !important;
}
.chip-toggle {
  border: 1px solid #d6dfe9;
  background: #fff;
  color: #4d5f75;
  border-radius: 18px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chip-toggle.active {
  background: #243b55;
  border-color: #243b55;
  color: #fff;
}
.chip-toggle.hidden,
.division-filters.hidden {
  display: none;
}
.division-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.status-section {
  margin: 0 0 18px;
}
.status-section-head {
  position: sticky;
  top: 44px;
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 14px 0 8px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid transparent;
}
.status-section-head small {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.8;
}
.order-column-head .sort-header[data-sort="status"] {
  text-align: center;
}
.partner-order {
  opacity: 0.93;
}
.partner-order .order-group-head {
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, rgba(36, 59, 85, 0.035) 10px 20px);
}
.readonly-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef2f7;
  color: #55677d;
  font-size: 11px;
  font-weight: 700;
}
.optional-spec.always-open > summary {
  cursor: default;
  list-style: none;
}
.optional-spec.always-open > summary::-webkit-details-marker {
  display: none;
}
.optional-spec.always-open .spec-toggle {
  display: none;
}

/* ===========================================================================
   PHONE LAYOUT (≤ 760px wide)
   Order rows become stacked cards with small labels, the sidebar becomes a
   bottom navigation bar, and the order sheet / dialogs become full screen.
   =========================================================================== */
@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }
  body {
    -webkit-text-size-adjust: 100%;
  }
  input,
  select,
  textarea {
    font-size: 16px !important; /* stops iPhone zooming in on focus */
  }

  /* App frame: bottom navigation */
  .app-shell {
    display: block;
    min-height: 100vh;
  }
  .sidebar {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 300;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto;
    flex-direction: row !important;
    align-items: stretch !important;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -4px 16px rgba(16, 27, 43, 0.25);
  }
  .sidebar .brand,
  .sidebar .workspace-label,
  .sidebar .sidebar-bottom {
    display: none !important;
  }
  .sidebar nav {
    flex-direction: row !important;
    justify-content: space-around;
    width: 100%;
    gap: 2px !important;
  }
  .nav-link {
    flex: 1 1 0;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 2px !important;
    padding: 6px 2px !important;
    font-size: 10px !important;
    min-height: 52px;
  }
  .nav-link.hidden {
    display: none !important;
  }
  .nav-link .nav-icon {
    font-size: 19px !important;
  }
  .nav-link.active {
    box-shadow: inset 0 3px var(--orange) !important;
  }
  .nav-badge {
    top: 2px;
    right: calc(50% - 22px);
  }
  .main-area {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
    min-width: 0;
  }
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 8px 14px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .topbar h2 {
    font-size: 17px;
  }
  .topbar .eyebrow {
    display: none;
  }
  .user-meta {
    min-width: 0;
  }
  .page {
    padding: 14px 12px 24px !important;
  }
  .page-intro {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  .page-intro .btn {
    width: 100%;
  }

  /* Toolbars and filters */
  .global-search input {
    min-height: 44px;
  }
  .list-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 12px;
  }
  .list-tab {
    flex: 0 0 auto !important;
    padding: 9px 12px !important;
    font-size: 12px !important;
  }
  .new-orders-banner {
    flex-wrap: wrap;
    padding: 12px;
  }
  .new-orders-banner .btn {
    flex: 1 1 auto;
  }
  .stat-strip {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 11px 12px;
  }
  .stat-card strong {
    font-size: 19px;
  }
  .new-order-stat strong {
    font-size: 16px !important;
  }
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .toolbar .search-wrap {
    width: 100%;
  }
  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .view-controls {
    gap: 8px;
  }
  .sort-control select {
    min-width: 0;
  }

  /* Order list: cards instead of a wide table */
  #ordersList {
    overflow: visible !important;
  }
  .order-column-head {
    display: none !important;
  }
  .order-group-card,
  .order-group-card.factory-layout,
  .order-group-card.vendor-layout,
  .order-group-card.customer-layout,
  .order-group-card.vendor-layout.xs-layout,
  .order-group-card.factory-layout.xs-layout,
  .order-group-card .group-item-rows,
  .order-group-card.factory-layout .group-item-rows,
  .order-group-card.vendor-layout.xs-layout .group-item-rows,
  .order-group-card.factory-layout.xs-layout .group-item-rows {
    min-width: 0 !important;
    width: 100% !important;
  }
  .order-group-head {
    flex-wrap: wrap;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }
  .order-group-head .group-ident {
    min-width: 0;
    width: 100%;
  }
  .order-group-head .group-head-meta {
    order: 2 !important;
    width: 100%;
    padding-left: 0 !important;
    flex-wrap: wrap;
    white-space: normal;
    gap: 6px 10px;
  }
  .order-group-head .group-head-actions {
    order: 3 !important;
    width: 100%;
    flex-wrap: wrap;
    margin-left: 0 !important;
  }
  .order-group-head .mini-action {
    padding: 8px 11px !important;
    font-size: 12px !important;
  }
  .order-item-row,
  .order-item-row.vendor-layout,
  .order-item-row.customer-layout,
  .order-item-row.factory-layout,
  .order-item-row.vendor-layout.xs-layout,
  .order-item-row.factory-layout.xs-layout {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px 12px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 12px !important;
  }
  .order-item-row .item-cell {
    padding: 0 !important;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    text-align: left !important;
    white-space: normal !important;
    border-left: 0 !important;
    background: none;
  }
  .order-item-row .item-cell[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #8a97a8;
  }
  /* Photo + catalog ID on top, side by side */
  .order-item-row .item-photo-cell {
    grid-column: 1 / -1;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
  }
  .order-item-row .item-photo-cell .list-image {
    order: -1;
    width: 72px !important;
    height: 72px !important;
    flex: 0 0 72px;
  }
  .order-item-row .item-photo-meta {
    justify-content: flex-start !important;
    margin: 0;
  }
  .order-item-row .catalog-id {
    font-size: 15px !important;
    white-space: normal;
  }
  .order-item-row .specs-cell,
  .order-item-row .status-cell,
  .order-item-row .action-cell,
  .order-item-row .factory-note-cell {
    grid-column: 1 / -1;
  }
  .order-item-row .status-cell {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center !important;
    gap: 8px !important;
  }
  .order-item-row .status-cell::before {
    width: 100%;
  }
  .order-item-row .status-cell .status-select {
    width: auto !important;
    max-width: none !important;
    min-width: 170px !important;
    min-height: 40px;
    font-size: 14px !important;
  }
  .order-item-row .ship-info {
    font-size: 12px;
  }
  .order-item-row .factory-cell {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center !important;
    gap: 6px;
  }
  .order-item-row .factory-cell::before {
    width: 100%;
  }
  .order-item-row .gem-token {
    width: auto;
    min-width: 110px;
  }
  .order-item-row .action-cell {
    flex-direction: row !important;
    gap: 8px;
  }
  .order-item-row .action-cell .mini-action {
    flex: 1 1 0;
    min-height: 40px;
    font-size: 13px !important;
  }
  .order-item-row .factory-note-editor {
    min-height: 60px;
  }
  .factory-notes-line {
    flex-direction: column;
    gap: 4px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
  .status-section-head {
    top: 56px;
  }
  .table-foot {
    flex-direction: column;
    gap: 4px;
  }

  /* Order sheet and dialogs: full screen */
  .modal-backdrop {
    padding: 0 !important;
    align-items: stretch !important;
  }
  .modal,
  .large-modal,
  .shipping-modal,
  .password-modal {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  .modal-head {
    padding: 12px 14px !important;
  }
  .modal-body {
    padding: 12px !important;
  }
  .modal-foot {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
  }
  .modal-foot .btn {
    flex: 1 1 auto;
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .detail-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .detail-head .card-tools {
    flex-wrap: wrap;
  }
  .group-history .update-row {
    grid-template-columns: 1fr !important;
    gap: 4px;
  }
  .group-history .update-icon {
    display: none;
  }

  /* Order form */
  .item-card-body {
    padding: 12px !important;
  }
  .order-type-toggle {
    grid-template-columns: 1fr;
  }
  .primary-entry-layout {
    grid-template-columns: 1fr !important;
  }
  .primary-fields .form-grid,
  .optional-spec-body .form-grid,
  .notes-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .form-grid > .field {
    grid-column: span 1 !important;
  }
  .form-grid > .field.span-5,
  .form-grid > .field.span-12,
  .form-grid > .field.span-4,
  .form-grid > .entry-divider,
  .notes-entry-grid > .field {
    grid-column: 1 / -1 !important;
  }
  .submit-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: sticky;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 50;
  }
  .submit-buttons {
    display: flex;
    gap: 8px;
  }
  .submit-buttons .btn {
    flex: 1 1 0;
  }
  .add-row {
    flex-wrap: wrap;
  }

  /* Updates and account pages */
  .updates-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .updates-filters {
    flex-wrap: wrap;
  }
  .updates-list {
    padding: 4px 8px 8px;
  }
  .update-row {
    grid-template-columns: 52px 26px 1fr !important;
    gap: 8px;
    padding: 9px 4px;
  }
  .settings-card {
    padding: 14px !important;
  }
  .factory-account-row,
  .fa-email {
    grid-template-columns: 1fr !important;
  }
  .toast {
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    max-width: none !important;
  }
}
.optional-spec.always-open > summary::after,
.optional-spec.always-open > summary::before {
  display: none !important;
  content: none !important;
}
@media (max-width: 760px) {
  .preview-side {
    max-width: 200px !important;
    padding: 8px !important;
  }
  .preview-side .preview-caption {
    display: none;
  }
  .catalog-preview {
    min-height: 0 !important;
    aspect-ratio: 1 / 1;
  }
  .topbar .user-meta {
    display: flex !important;
    min-width: 0;
    max-width: 120px;
  }
  .topbar .user-meta b,
  .topbar .user-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Demo copy banner */
.demo-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 6px 12px;
  background: repeating-linear-gradient(135deg, #7c3aed 0 14px, #6d28d9 14px 28px);
  color: #fff;
  font-size: 12px;
  text-align: center;
}
@media (max-width: 760px) {
  .new-orders-banner .nob-text {
    flex: 1 1 calc(100% - 48px);
    min-width: 0;
  }
  .new-orders-banner .nob-text > b {
    font-size: 15px;
  }
  .new-orders-banner .btn {
    flex: 1 1 100%;
  }
  .demo-bar .demo-long {
    display: none;
  }
}
@media (min-width: 761px) {
  .demo-bar .demo-short {
    display: none;
  }
}

/* Completed (Done) orders */
.list-tab.completed-tab {
  margin-left: auto;
}
.completed-note {
  margin: -8px 0 14px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #eef6f1;
  color: #1c6b45;
  font-size: 12px;
}
.completed-note.hidden {
  display: none;
}
.done-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e8f6ee;
  color: #1c7a4d;
  font-size: 11px;
  font-weight: 700;
}
@media (max-width: 760px) {
  .list-tab.completed-tab {
    margin-left: 0;
  }
}
