:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #687385;
  --line: #d9dee7;
  --primary: #1265d8;
  --primary-dark: #0e4ea7;
  --danger-bg: #fff2f0;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  color: var(--text);
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 14px;
  flex: 1;
}

.logout {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.auth-panel,
.panel,
.table-wrap,
.filters,
.summary-grid > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-panel {
  max-width: 420px;
  margin: 56px auto;
  padding: 28px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

p {
  margin: 8px 0 0;
}

.section-head p,
.hint,
.empty {
  color: var(--muted);
}

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

.grid-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

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

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 600;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

input,
select,
textarea,
button,
.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

button:hover,
.button:hover {
  border-color: #a8b1c2;
  text-decoration: none;
}

button:disabled {
  border-color: #d0d5dd;
  background: #e4e7ec;
  color: #667085;
  cursor: not-allowed;
}

.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

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

.filters,
.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.filters input,
.filters select,
.inline-form input,
.inline-form select {
  max-width: 220px;
}

.upload input[type="file"] {
  max-width: 360px;
}

.upload-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

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

.upload-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) minmax(110px, 140px);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.upload-file-row span {
  overflow-wrap: anywhere;
}

.upload-page-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.upload-page-field[hidden] {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f0f3f7;
  color: #344054;
  font-weight: 700;
}

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

.panel {
  margin-top: 18px;
  padding: 18px;
}

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

.summary-grid div {
  padding: 14px;
}

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

.summary-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef5ff;
  color: #174ea6;
}

.alert {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #ffd0cc;
  border-radius: 6px;
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-success {
  border-color: #9bd3ae;
  background: #edf9f1;
  color: #176336;
}

.actions {
  display: flex;
  gap: 10px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-delete {
  display: inline;
  margin: 0;
}

.link-danger {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
}

.link-danger:hover {
  color: #7a271a;
  text-decoration: underline;
}

@media (max-width: 760px) {
  .topbar,
  .section-head,
  .filters,
  .inline-form,
  .logout {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
    padding: 14px 16px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .grid-form,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters select,
  .inline-form input,
  .inline-form select,
  .upload input[type="file"] {
    max-width: none;
  }

  .upload-row,
  .upload-file-row {
    grid-template-columns: 1fr;
  }
}

.custom-placeholder {
  max-width: 720px;
}

.custom-orders-table tr[data-href] {
  cursor: pointer;
}

.custom-orders-table tr[data-href]:hover td {
  background: #f7faff;
}

/* V1.6.1-b.3 designer modular order board */
.designer-board-page,
.designer-stage-board,
.designer-stage,
.designer-stage-list,
.designer-order-row {
  min-width: 0;
  max-width: 100%;
}

.designer-board-heading {
  align-items: center;
}

.designer-board-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .7fr) auto;
  align-items: end;
  padding: 14px;
}

.designer-board-filters input,
.designer-board-filters select {
  max-width: none;
}

.designer-stage-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.designer-stage-overview a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.designer-stage-overview a:hover {
  border-color: #9bb7de;
  background: #f7fbff;
  text-decoration: none;
}

.designer-stage-overview span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.designer-stage-overview strong,
.designer-stage > summary strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 28px;
  min-height: 28px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #174ea6;
}

.designer-stage-board {
  display: grid;
  gap: 14px;
}

.designer-stage {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.designer-stage > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: #f5f7fa;
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
  list-style-position: inside;
}

.designer-stage > summary span {
  margin-right: auto;
}

.designer-stage-list {
  border-top: 1px solid var(--line);
}

.designer-order-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) minmax(90px, .55fr) minmax(92px, .55fr) minmax(190px, 1.25fr) minmax(145px, .85fr);
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 11px 14px;
  border-bottom: 1px solid #e6eaf0;
  color: var(--text);
  text-decoration: none;
}

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

.designer-order-row:hover {
  background: #f7fbff;
  text-decoration: none;
}

.designer-order-row > span,
.designer-order-row b,
.designer-order-row strong,
.designer-order-row small,
.designer-order-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.designer-order-row > span {
  display: grid;
  gap: 4px;
}

.designer-order-main strong {
  color: var(--primary-dark);
  font-size: 16px;
}

.designer-order-main b,
.designer-order-task b,
.designer-order-delivery b {
  font-weight: 700;
}

.designer-order-row small,
.designer-order-delivery em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.designer-order-state .status {
  justify-self: start;
  white-space: nowrap;
}

.designer-order-delivery.today b,
.designer-order-delivery.overdue b,
.designer-order-delivery.today em,
.designer-order-delivery.overdue em {
  color: var(--danger);
}

.designer-stage-empty {
  margin: 0;
  padding: 18px 14px;
}

@media (max-width: 900px) {
  .designer-order-row {
    grid-template-columns: minmax(160px, 1.1fr) 80px 90px minmax(160px, 1fr) minmax(135px, .8fr);
    gap: 9px;
    font-size: 13px;
  }
}

@media (max-width: 760px) {
  .designer-board-filters {
    grid-template-columns: 1fr 1fr;
  }

  .designer-board-filters .actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .designer-stage-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .designer-order-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main delivery"
      "kind state"
      "task task";
    gap: 8px 12px;
    min-height: 0;
    padding: 13px 14px;
    font-size: 14px;
  }

  .designer-order-main { grid-area: main; }
  .designer-order-kind { grid-area: kind; }
  .designer-order-state { grid-area: state; justify-items: end; }
  .designer-order-task { grid-area: task; padding-top: 7px; border-top: 1px dashed #dce2ea; }
  .designer-order-delivery { grid-area: delivery; justify-items: end; text-align: right; }
}

@media (max-width: 390px) {
  .designer-board-page {
    width: 100%;
    overflow-x: clip;
  }

  .designer-board-heading {
    align-items: stretch;
  }

  .designer-board-filters,
  .designer-stage-overview {
    grid-template-columns: 1fr;
  }

  .designer-board-filters .actions {
    grid-column: 1;
  }

  .designer-stage-overview a {
    min-height: 42px;
  }

  .designer-order-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-right: 12px;
    padding-left: 12px;
  }

  .designer-order-main strong {
    font-size: 15px;
  }
}

.custom-form-panel {
  padding: 20px;
}

.custom-intermediary {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.custom-intermediary[hidden] {
  display: none;
}

.custom-intermediary .check {
  flex: 0 0 180px;
}

.custom-intermediary-details {
  display: grid;
  flex: 1 1 320px;
  min-width: 0;
  gap: 6px;
}

.custom-intermediary-details[hidden] {
  display: none;
}

.custom-intermediary .check input {
  width: auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.custom-detail-section {
  padding: 20px;
}

.custom-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 24px;
  margin: 0;
}

.custom-facts div {
  min-width: 0;
}

.custom-facts dt {
  color: var(--muted);
  font-size: 13px;
}

.custom-facts dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.custom-progress {
  display: grid;
  grid-template-columns: repeat(8, minmax(94px, 1fr));
  min-width: 752px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  list-style: none;
}

.custom-progress-section {
  overflow-x: auto;
}

.custom-progress li {
  position: relative;
  padding: 12px 8px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.custom-progress li:first-child {
  border-left: 0;
}

.custom-progress li.done {
  background: #eef8f1;
  color: #176336;
}

.custom-progress li.current {
  background: #eaf2ff;
  color: #174ea6;
  font-weight: 800;
}

.custom-task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px;
  border-left: 4px solid var(--primary);
  background: #f7faff;
}

.custom-task span {
  color: var(--muted);
}

.custom-quote-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
}

.custom-files {
  display: grid;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.custom-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.custom-file-row > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.custom-file-row span,
.custom-file-row small {
  overflow-wrap: anywhere;
}

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

.custom-next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e7c76f;
  border-radius: 6px;
  background: #fff9e8;
  color: #694b00;
}

.quote-board {
  display: grid;
  gap: 18px;
}

.quote-board-group {
  overflow: hidden;
}

.quote-board-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f0f3f7;
}

.quote-board-group h2 {
  margin: 0;
  font-size: 18px;
}

.quote-board-group > header > span {
  min-width: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  text-align: center;
  font-weight: 800;
}

.quote-order-list {
  display: grid;
}

.quote-order-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

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

.quote-order-row:hover {
  background: #f7faff;
  text-decoration: none;
}

.quote-order-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.quote-order-row span,
.quote-order-row small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.quote-return-text,
.quote-inline-note {
  color: #9b2c2c !important;
}

.boss-quote-row {
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.quote-status {
  white-space: nowrap;
}

.custom-formal-upload {
  margin-top: 16px;
}

.quote-version-row.is-latest {
  background: #f7faff;
}

.quote-return-note {
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 4px solid #b42318;
  background: #fff3f2;
  color: #7a271a;
}

.quote-return-note p,
.quote-inline-note {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}

.quote-review-actions {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.quote-return-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.quote-return-form textarea {
  min-height: 84px;
}

.collection-board {
  margin-bottom: 18px;
}

.collection-order-row {
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
}

.finance-facts {
  margin-top: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.finance-facts dd {
  font-size: 18px;
}

.status-success {
  border-color: #8fc9a3;
  background: #eef8f1;
  color: #176336;
}

.release-fact,
.manual-release,
.deal-review {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.release-fact {
  display: grid;
  gap: 6px;
  border-left: 4px solid #23814b;
}

.release-fact span,
.release-fact small {
  color: var(--muted);
}

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

.deal-action-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.deal-action-block h3,
.deal-review h3,
.payment-area h3,
.manual-release h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.inline-money-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  min-width: min(100%, 360px);
}

.finance-history {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.finance-history summary,
.payment-correction summary {
  padding: 13px 0;
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.payment-area {
  margin-top: 22px;
}

.payment-form {
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.payment-ledger {
  display: grid;
}

.payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.payment-row > div:first-child {
  display: grid;
  gap: 4px;
}

.payment-row small,
.payment-row span {
  color: var(--muted);
}

.payment-row p {
  grid-column: 1 / -1;
  margin: 3px 0 0;
}

.payment-row.is-corrected {
  opacity: 0.68;
}

.payment-row.is-corrected strong {
  text-decoration: line-through;
}

.payment-correction {
  grid-column: 1 / -1;
}

.payment-exception {
  border-left-color: #b42318;
}

.custom-history {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.custom-history li {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.custom-history li:last-child {
  border-bottom: 0;
}

.custom-history time,
.custom-history span {
  color: var(--muted);
}

.custom-history div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 760px) {
  .custom-facts,
  .custom-quote-upload,
  .custom-file-row,
  .custom-history li {
    grid-template-columns: 1fr;
  }

  .custom-intermediary .check,
  .custom-intermediary-details {
    flex-basis: 100%;
  }

  .custom-task,
  .custom-next-step,
  .custom-history div {
    align-items: flex-start;
    flex-direction: column;
  }

  .custom-file-row .actions,
  .custom-file-row .button,
  .custom-quote-upload button {
    width: 100%;
  }

  .quote-order-row,
  .boss-quote-row,
  .collection-order-row,
  .quote-review-actions,
  .quote-return-form,
  .deal-actions,
  .inline-money-form,
  .payment-row {
    grid-template-columns: 1fr;
  }

  .quote-review-actions form,
  .quote-review-actions button,
  .quote-return-form button {
    width: 100%;
  }
}

.production-upload-panel {
  max-width: 680px;
}

.production-warning {
  border-color: #e7c76f;
  background: #fff9e8;
  color: #694b00;
  line-height: 1.55;
}

.production-section {
  padding: 20px;
}

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

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

.production-section-head h2 {
  margin-bottom: 0;
}

.production-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
}

.production-materials-table {
  min-width: 1620px;
  table-layout: fixed;
}

.production-materials-table th,
.production-materials-table td {
  padding: 7px 6px;
}

.production-materials-table th:nth-child(1) { width: 110px; }
.production-materials-table th:nth-child(2) { width: 240px; }
.production-materials-table th:nth-child(3) { width: 240px; }
.production-materials-table th:nth-child(4) { width: 150px; }
.production-materials-table th:nth-child(5) { width: 330px; }
.production-materials-table th:nth-child(6),
.production-materials-table th:nth-child(7) { width: 90px; }
.production-materials-table th:nth-child(8),
.production-materials-table th:nth-child(9) { width: 120px; }
.production-materials-table th:last-child { width: 54px; }

.source-material-name {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.calculated-count {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  white-space: normal;
}

.inventory-ready { color: #126a37; }
.inventory-incomplete { color: #9a4b00; }
.is-inactive-choice { opacity: .55; pointer-events: none; }
.inventory-action-warning { border-color: #d28a00; background: #fff4cf; color: #5b3b00; }
.inventory-completion-table { min-width: 1050px; }
.inventory-completion-table th:first-child { width: 220px; }
.inventory-completion-table th:nth-child(2) { width: 180px; }
.inventory-completion-table th:nth-child(4) { width: 150px; }
.inventory-completion-table th:nth-child(5) { width: 340px; }

.version-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.version-void-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.version-void-form input {
  width: 180px;
  min-height: 34px;
}

.sku-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

/* V1.6-B board stock and cutting confirmation */
.inventory-search {
  display: grid;
  grid-template-columns: repeat(6, minmax(105px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.inventory-search-panel {
  padding-top: 14px;
  padding-bottom: 14px;
}

.inventory-search-panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.inventory-search-actions {
  flex-wrap: nowrap;
}

.inventory-search label,
.stock-action form,
.cutting-primary form,
.cutting-lookup {
  display: grid;
  gap: 6px;
}

.stock-action {
  min-width: 150px;
}

.stock-action summary {
  cursor: pointer;
  color: #075985;
  font-weight: 700;
}

.stock-action form {
  margin-top: 8px;
}

.stock-positive {
  color: #087443;
  font-weight: 700;
}

.stock-negative,
.danger-text {
  color: #b42318;
  font-weight: 700;
}

.cutting-batch-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.cutting-batch-row h2,
.cutting-batch-row p {
  margin: 0 0 6px;
}

.cutting-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  overflow-x: hidden;
}

.cutting-head {
  margin-bottom: 18px;
}

.cutting-head h1 {
  font-size: 28px;
  margin: 10px 0 6px;
}

.cutting-head p {
  color: #475467;
  margin: 0;
}

.cutting-primary form {
  gap: 16px;
}

.cutting-primary input,
.cutting-primary button,
.cutting-lookup input,
.cutting-lookup button,
.cutting-confirm-button,
.cutting-next {
  min-height: 52px;
  font-size: 18px;
}

.cutting-lookup {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.cutting-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cutting-materials {
  display: grid;
  gap: 10px;
}

.cutting-material {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #d0d5dd;
  padding: 12px;
  border-radius: 6px;
  min-width: 0;
}

.cutting-material strong {
  overflow-wrap: anywhere;
}

.cutting-material b {
  color: #087443;
}

.cutting-material.is-shortage {
  border-color: #f04438;
  background: #fff5f5;
}

.cutting-material.is-shortage b {
  color: #b42318;
}

.compact-list {
  display: grid;
}

.compact-list a {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e4e7ec;
  color: inherit;
  text-decoration: none;
}

@media (max-width: 760px) {
  .inventory-search,
  .cutting-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cutting-batch-row,
  .cutting-material {
    display: grid;
    grid-template-columns: 1fr;
  }

  .compact-list a {
    grid-template-columns: 1fr auto;
  }

  .compact-list a span:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .inventory-search,
  .cutting-summary,
  .cutting-lookup {
    grid-template-columns: 1fr;
  }

  .cutting-shell .panel {
    padding: 14px;
  }
}

.sku-table input,
.sku-table select {
  min-width: 110px;
}

.sku-table small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.sku-create-panel {
  padding-top: 0;
  padding-bottom: 0;
}

.sku-create-panel > summary {
  padding: 14px 0;
  cursor: pointer;
  color: #075985;
  font-weight: 750;
}

.sku-create-panel[open] {
  padding-bottom: 16px;
}

.sku-create-panel .sku-form {
  padding-top: 2px;
}

.sku-list-panel {
  min-width: 0;
}

.sku-table-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  isolation: isolate;
}

.sku-management-table {
  min-width: 980px;
}

.sku-management-table th,
.sku-management-table td {
  padding: 9px 10px;
  vertical-align: top;
}

.sku-management-table th:first-child {
  min-width: 138px;
}

.sku-management-table [data-sku-editor],
.sku-edit-actions {
  display: none;
}

.sku-management-table tr.is-editing [data-sku-readonly],
.sku-management-table tr.is-editing [data-sku-actions] {
  display: none;
}

.sku-management-table tr.is-editing [data-sku-editor] {
  display: block;
  width: 100%;
  min-width: 92px;
}

.sku-management-table tr.is-editing .sku-edit-actions {
  display: grid;
  gap: 7px;
}

.sku-color-cell strong {
  overflow-wrap: anywhere;
}

.sku-stock-cell {
  min-width: 125px;
}

.sku-state {
  color: #087443;
  font-weight: 700;
}

.sku-state.is-inactive {
  color: #667085;
}

.sku-management-table .sku-action-column {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: 132px;
  background: #fff;
  box-shadow: -5px 0 9px rgba(31, 41, 55, .09);
}

.sku-management-table thead .sku-action-column {
  z-index: 5;
  background: #f3f5f7;
}

.sku-management-table tbody tr:nth-child(even) .sku-action-column {
  background: #fafbfc;
}

.sku-row-actions > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #98a2b3;
  border-radius: 5px;
  cursor: pointer;
  background: #fff;
  color: #1d2939;
  font-weight: 700;
  list-style: none;
}

.sku-row-actions > summary::-webkit-details-marker {
  display: none;
}

.sku-row-actions > summary::after {
  content: "▾";
  margin-left: 7px;
  color: #667085;
}

.sku-row-actions[open] > summary::after {
  content: "▴";
}

.sku-action-panel {
  display: grid;
  gap: 8px;
  width: 220px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #cfd6de;
  border-radius: 6px;
  background: #fff;
}

.sku-action-panel > button,
.sku-action-panel > form > button {
  width: 100%;
}

.sku-action-panel .stock-action {
  min-width: 0;
  padding: 7px 0;
  border-top: 1px solid #eaecf0;
}

.sku-action-panel .stock-action form {
  width: 100%;
}

.sku-action-panel input {
  width: 100%;
  min-width: 0;
}

.inventory-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 15px;
}

.inventory-pagination .is-disabled {
  cursor: default;
  opacity: .45;
  pointer-events: none;
}

.mapping-panel h2 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.mapping-correction-form {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.mapping-history p {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.5;
}

@media (max-width: 760px) {
  .sku-form,
  .mapping-correction-form {
    grid-template-columns: 1fr;
  }

  .sku-management-table {
    min-width: 900px;
  }

  .sku-management-table .sku-action-column {
    min-width: 116px;
  }

  .version-void-form {
    display: grid;
    margin: 8px 0 0;
  }

  .version-void-form input {
    width: 100%;
  }
}

.production-remove {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--danger);
  font-size: 23px;
  line-height: 1;
}

.production-layout-upload {
  margin-top: 16px;
}

.production-file-list {
  overflow-wrap: anywhere;
}

.production-red-entry {
  color: #d00000;
  font-weight: 700;
}

.production-process-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.production-process-grid > div {
  min-height: 104px;
  border-left: 1px solid var(--line);
}

.production-process-grid > div:first-child {
  border-left: 0;
}

.production-process-grid strong {
  display: block;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f0f3f7;
  text-align: center;
}

.production-action-bar,
.production-confirm-bar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 18px -20px -48px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -5px 18px rgba(0, 0, 0, 0.06);
}

.production-pdf-frame {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 680px;
  border: 1px solid var(--line);
  background: #dfe3e8;
}

.production-confirm-bar {
  margin-top: 12px;
}

.production-confirm-bar form {
  margin: 0;
}

@media (max-width: 760px) {
  .production-header-grid {
    grid-template-columns: 1fr;
  }

  .production-process-grid {
    grid-template-columns: 1fr 1fr;
  }

  .production-process-grid > div {
    border-top: 1px solid var(--line);
  }

  .production-process-grid > div:nth-child(odd) {
    border-left: 0;
  }

  .production-action-bar,
  .production-confirm-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .production-action-bar button,
  .production-confirm-bar form,
  .production-confirm-bar button,
  .production-confirm-bar .button {
    width: 100%;
  }

  .production-pdf-frame {
    min-height: 620px;
  }
}



.dad-hero,
.dad-search,
.dad-status-group,
.dad-card,
.dad-detail-head,
.dad-attachment-group,
.dad-order-list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dad-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 18px;
}

.dad-search {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
}

.dad-search-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.dad-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.dad-status-group {
  overflow: hidden;
}

.dad-status-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f0f3f7;
}

.dad-status-group h2 {
  margin: 0;
  font-size: 16px;
}

.dad-status-group header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.dad-card-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.dad-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  color: var(--text);
}

.dad-card:hover {
  border-color: #9bb7de;
  box-shadow: 0 6px 18px rgba(31, 41, 51, 0.08);
  text-decoration: none;
}

.dad-card-top,
.dad-card-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.dad-card-top strong {
  overflow-wrap: anywhere;
}

.dad-card-main div {
  min-width: 0;
}

.dad-card-main span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.dad-card-main b {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.dad-note {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dad-empty {
  padding: 6px 2px;
}

.dad-detail-head {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
}

.dad-detail-head .button {
  justify-self: start;
}

.dad-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.dad-attachment-group {
  padding: 14px;
}

.dad-attachment-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

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

.dad-file {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.dad-file span {
  overflow-wrap: anywhere;
}

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

.dad-file-view {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 74px;
}

.dad-file-view span {
  font-size: 20px;
  font-weight: 800;
}

.dad-file-view small {
  grid-column: 1;
  font-size: 16px;
}

.dad-file-view b {
  grid-row: 1 / span 2;
  grid-column: 2;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
}

@media (max-width: 980px) {
  .dad-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .dad-hero h1 {
    font-size: 24px;
  }

  .dad-search,
  .dad-board,
  .dad-summary-grid,
  .dad-attachment-sections {
    grid-template-columns: 1fr;
  }

  .dad-search-actions {
    align-items: stretch;
  }

  .dad-card-top,
  .dad-card-main {
    align-items: flex-start;
  }
}

/* Elder-friendly dad board */
.dad-page {
  padding-bottom: 245px;
}

.dad-page .dad-hero {
  margin-bottom: 20px;
  padding: 22px;
}

.dad-page .dad-hero h1 {
  font-size: 28px;
  line-height: 1.2;
}

.dad-page .dad-hero p {
  font-size: 18px;
}

.dad-page .dad-search {
  position: fixed;
  right: max(16px, calc((100vw - 1120px) / 2));
  bottom: 14px;
  left: max(16px, calc((100vw - 1120px) / 2));
  z-index: 20;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 14px;
  margin: 0;
  padding: 16px;
  border-color: #b8c7d9;
  box-shadow: 0 14px 44px rgba(31, 41, 51, 0.18);
}

.dad-page .dad-search label,
.dad-page .dad-search input,
.dad-page .dad-search button,
.dad-page .dad-search .button {
  font-size: 18px;
}

.dad-page .dad-search label {
  gap: 8px;
}

.dad-page .dad-search input,
.dad-page .dad-search button,
.dad-page .dad-search .button {
  min-height: 58px;
  border-radius: 10px;
}

.dad-page .dad-search input {
  padding: 12px 14px;
}

.dad-page .dad-board {
  gap: 20px;
}

.dad-page .dad-status-group {
  border-radius: 10px;
}

.dad-page .dad-status-group > header {
  padding: 16px 18px;
}

.dad-page .dad-status-group h2 {
  font-size: 22px;
}

.dad-page .dad-status-group header span {
  min-width: 36px;
  min-height: 36px;
  font-size: 18px;
}

.dad-page .dad-card-list {
  gap: 18px;
  padding: 16px;
}

.dad-page .dad-card {
  gap: 16px;
  padding: 18px;
  border-radius: 12px;
}

.dad-page .dad-card-top strong {
  font-size: 24px;
  line-height: 1.2;
}

.dad-page .status {
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid #a9c7f5;
  background: #dcebff;
  color: #0f4fa8;
  font-size: 18px;
  font-weight: 800;
}

.dad-page .dad-card-main {
  gap: 18px;
}

.dad-page .dad-card-main span {
  font-size: 16px;
}

.dad-page .dad-card-main b,
.dad-page .dad-note {
  font-size: 18px;
  line-height: 1.45;
}

.dad-detail-head h1 {
  font-size: 28px;
}

.dad-detail-head p,
.dad-summary-grid span,
.dad-summary-grid strong,
.dad-attachment-group,
.dad-file {
  font-size: 18px;
}

/* Warehouse mobile workflow */
.warehouse-page {
  max-width: 760px;
  margin: 0 auto;
}

.warehouse-hero,
.warehouse-search,
.warehouse-card,
.warehouse-detail-head {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.warehouse-hero,
.warehouse-detail-head {
  margin-bottom: 16px;
  padding: 18px;
}

.warehouse-hero h1,
.warehouse-detail-head h1 {
  font-size: 28px;
}

.warehouse-hero p,
.warehouse-detail-head p {
  font-size: 18px;
}

.warehouse-search {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  margin-top: 18px;
  margin-bottom: 0;
  padding: 14px;
}

.warehouse-search label,
.warehouse-search input,
.warehouse-search button,
.warehouse-search .button,
.warehouse-upload input,
.warehouse-upload button,
.warehouse-done {
  font-size: 18px;
}

.warehouse-search input,
.warehouse-search button,
.warehouse-search .button,
.warehouse-upload input,
.warehouse-upload button,
.warehouse-done {
  min-height: 58px;
  border-radius: 10px;
}

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

.warehouse-list {
  display: grid;
  gap: 16px;
}

.warehouse-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  color: var(--text);
}

.warehouse-card:hover {
  border-color: #9bb7de;
  box-shadow: 0 6px 18px rgba(31, 41, 51, 0.08);
  text-decoration: none;
}

.warehouse-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.warehouse-card .status {
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid #a9c7f5;
  background: #dcebff;
  color: #0f4fa8;
  font-size: 18px;
  font-weight: 800;
}

.warehouse-card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 18px;
}

.warehouse-card-row span {
  color: var(--muted);
}

.warehouse-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.warehouse-summary-grid span,
.warehouse-summary-grid strong {
  font-size: 18px;
}

.warehouse-panel h2 {
  font-size: 22px;
}

.warehouse-upload {
  display: grid;
  gap: 12px;
}

.warehouse-file-list {
  display: grid;
  gap: 10px;
}

.warehouse-file {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 18px;
}

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

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

.warehouse-status-actions form {
  margin: 0;
}

.warehouse-status-actions button {
  width: 100%;
}

.pdf-preview-page {
  max-width: min(980px, 100%);
  margin: 0 auto;
}

.pdf-preview-head,
.pdf-toolbar,
.pdf-status,
.pdf-page-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pdf-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
}

.pdf-preview-head h1 {
  font-size: 24px;
}

.pdf-preview-head p {
  color: var(--muted);
  font-size: 18px;
}

.pdf-toolbar {
  position: sticky;
  top: 68px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
}

.pdf-toolbar button,
.pdf-toolbar strong {
  min-width: 80px;
  min-height: 48px;
  font-size: 18px;
}

.pdf-status {
  margin-bottom: 12px;
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 18px;
}

.pdf-pages {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.pdf-page-wrap {
  overflow: auto;
  padding: 10px;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.pdf-page-canvas {
  display: block;
  max-width: none;
  margin: 0 auto;
  background: #fff;
  touch-action: pan-x pan-y pinch-zoom;
}

.order-import-upload {
  max-width: 760px;
}

.order-import-table td {
  vertical-align: middle;
  white-space: normal;
}

.order-import-table td:first-child {
  min-width: 220px;
  overflow-wrap: anywhere;
}

.order-import-table select {
  min-width: 170px;
}

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

.compact-check input {
  width: auto;
}

.import-page-input {
  min-width: 84px;
}

.import-missing {
  color: var(--danger);
}

.import-success {
  max-width: 760px;
  margin: 44px auto;
  text-align: center;
}

.import-success-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 40px;
  margin-bottom: 16px;
  border-radius: 6px;
  background: #edf9f1;
  color: #176336;
  font-weight: 700;
}

.import-success-actions {
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

.clerk-money-notes {
  padding: 0;
}

.clerk-money-notes > summary {
  padding: 18px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}

.clerk-money-notes[open] > summary {
  border-bottom: 1px solid var(--line);
}

.clerk-money-form {
  padding: 18px;
}

@media print {
  body,
  .page,
  .pdf-preview-page,
  .pdf-pages,
  .pdf-page-wrap {
    margin: 0;
    padding: 0;
    max-width: none;
    background: #fff;
  }

  .topbar,
  .pdf-preview-head,
  .pdf-toolbar,
  .pdf-status {
    display: none !important;
  }

  .pdf-pages {
    display: block;
    overflow: visible;
  }

  .pdf-page-wrap {
    break-after: page;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .pdf-page-canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .order-import-table {
    min-width: 900px;
  }

  .import-success-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.sheet-preview-page {
  min-width: 0;
  max-width: min(1180px, 100%);
  margin: 0 auto;
}

.sheet-preview-head,
.sheet-preview-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sheet-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
}

.sheet-preview-head h1,
.sheet-preview-title h2 {
  margin: 0;
}

.sheet-preview-head p,
.sheet-preview-title span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.sheet-preview-section {
  min-width: 0;
  margin-bottom: 16px;
  padding: 14px;
  overflow: hidden;
}

.sheet-preview-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sheet-preview-scroll {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.sheet-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 15px;
}

.sheet-preview-table th,
.sheet-preview-table td {
  max-width: 360px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
}

.sheet-preview-table thead th,
.sheet-preview-table .sheet-row-number {
  background: #f3f5f7;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.sheet-preview-table .sheet-row-number {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 46px;
}

@media (max-width: 760px) {
  .sheet-preview-head,
  .sheet-preview-title {
    align-items: stretch;
    flex-direction: column;
  }

  .sheet-preview-head .button {
    width: 100%;
  }

  .sheet-preview-section {
    padding: 10px;
  }

  .sheet-preview-table {
    font-size: 14px;
  }

  .dad-page {
    padding-bottom: 310px;
  }

  .dad-page .dad-board,
  .dad-page .dad-summary-grid,
  .dad-page .dad-attachment-sections {
    grid-template-columns: 1fr;
  }

  .dad-page .dad-search {
    right: 10px;
    bottom: 10px;
    left: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }

  .dad-page .dad-search-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dad-page .dad-card-top,
  .warehouse-card-top {
    align-items: flex-start;
  }

  .dad-page .dad-card-main,
  .warehouse-card-row {
    flex-direction: column;
  }

  .warehouse-search {
    grid-template-columns: 1fr;
  }

  .warehouse-status-actions {
    grid-template-columns: 1fr;
  }

  .warehouse-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .warehouse-summary-grid {
    grid-template-columns: 1fr;
  }

  .pdf-preview-head {
    align-items: stretch;
    flex-direction: column;
  }

  .pdf-toolbar {
    top: 0;
  }

  .pdf-toolbar button,
  .pdf-toolbar strong {
    min-width: 0;
    flex: 1;
  }
}

.disassembly-facts {
  margin: 18px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.disassembly-actions-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 18px;
  margin: 18px 0;
}

.disassembly-upload-form,
.outside-purchase-form {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.disassembly-upload-form h3,
.outside-purchase-form h3,
.disassembly-file-group h3 {
  margin: 0;
  font-size: 17px;
}

.outside-purchase-form .check input {
  width: auto;
}

.disassembly-batch-file-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.disassembly-batch-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 230px);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.disassembly-batch-filename {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.designer-disassembly-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--primary);
  background: #f8fafc;
}

.designer-disassembly-status small {
  flex-basis: 100%;
  color: var(--muted);
}

.designer-history > summary {
  cursor: pointer;
  font-size: 20px;
  font-weight: 750;
}

.designer-history[open] > summary {
  margin-bottom: 16px;
}

.disassembly-package {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.disassembly-file-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.disassembly-file-group > .production-section-head {
  margin-bottom: 0;
}

.compact-files {
  margin-top: 10px;
}

.requirements-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.requirements-list li {
  margin-top: 4px;
}

.disassembly-submit-block > div,
.disassembly-complete-block > div {
  min-width: 0;
}

.disassembly-submit-block p,
.disassembly-complete-block p {
  margin: 6px 0 0;
}

@media (max-width: 760px) {
  .disassembly-actions-grid {
    grid-template-columns: 1fr;
  }

  .disassembly-file-group {
    padding: 12px;
  }

  .disassembly-batch-file-row {
    grid-template-columns: 1fr;
  }

  .disassembly-submit-block,
  .disassembly-complete-block,
  .custom-file-row {
    align-items: stretch;
  }
}

/* V1 frozen old-store board: bottom search is normal flow, collapsed by default */
.dad-page {
  padding-bottom: 0;
}

.dad-page .dad-hero {
  margin-bottom: 14px;
}

.dad-top-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.dad-top-stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.dad-top-stats span {
  display: block;
  color: #344054;
  font-size: 18px;
  font-weight: 700;
}

.dad-top-stats strong {
  display: block;
  margin-top: 6px;
  color: #0f4fa8;
  font-size: 28px;
  line-height: 1;
}

.dad-search-panel {
  margin-top: 22px;
  border: 1px solid #b8c7d9;
  border-radius: 12px;
  background: #fff;
}

.dad-search-panel summary {
  min-height: 64px;
  padding: 16px 18px;
  color: #0f4fa8;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
  list-style: none;
}

.dad-search-panel summary::-webkit-details-marker {
  display: none;
}

.dad-search-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.dad-page .dad-search {
  position: static;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: auto;
  margin: 0;
  border: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: none;
}

.dad-page .dad-card {
  min-height: 0;
  gap: 8px;
  padding: 12px 14px;
}

.dad-page .dad-card-top strong {
  font-size: 24px;
}

.dad-page .status {
  min-height: 36px;
  padding: 5px 12px;
  color: #073b7a;
  font-size: 18px;
}

.dad-page .dad-card-list {
  gap: 10px;
  padding: 12px;
}

.dad-page .dad-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.dad-page .dad-card-main div:last-child {
  text-align: right;
}

.dad-page .dad-card-main b {
  font-size: 18px;
  line-height: 1.3;
}

.dad-page .dad-customer-name {
  display: -webkit-box;
  overflow: hidden;
  color: #111827;
  font-size: 22px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dad-page .dad-card-main span {
  font-size: 15px;
}

.dad-page .dad-card-main div:last-child b {
  white-space: nowrap;
}

.dad-order-list-panel {
  margin-top: 22px;
  overflow: hidden;
}

.dad-order-list-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f0f3f7;
}

.dad-order-list-panel h2 {
  margin: 0;
  font-size: 22px;
}

.dad-order-list-panel header span {
  min-width: 36px;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  color: #0f4fa8;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
}

.dad-order-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dad-order-table {
  min-width: 620px;
}

.dad-order-table th,
.dad-order-table td {
  font-size: 18px;
}

.dad-order-table td {
  height: 58px;
}

.dad-order-table-row {
  cursor: pointer;
}

.dad-order-table-row:hover,
.dad-order-table-row:focus {
  background: #f8fafc;
  outline: none;
}

.dad-order-table .status {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 17px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .dad-page {
    padding-bottom: 0;
  }

  .dad-top-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dad-page .dad-search {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .dad-page .dad-search-actions {
    grid-column: auto;
  }

  .dad-search-panel {
    margin-bottom: 18px;
  }

  .dad-order-table {
    min-width: 520px;
  }

  .dad-order-table th,
  .dad-order-table td {
    padding: 10px 9px;
    font-size: 16px;
  }
}

/* M5 external procurement and warehouse handoff */
.procurement-module-card {
  margin-bottom: 18px;
}

.module-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0;
  color: var(--muted);
}

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

.panel-head h2 {
  margin: 0;
}

.procurement-project-board,
.procurement-status-board {
  margin-bottom: 18px;
}

.procurement-list {
  min-width: 0;
}

.procurement-row {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(240px, 1.3fr) minmax(180px, .8fr);
  gap: 14px;
  align-items: center;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

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

.procurement-row:hover {
  background: #f8fafc;
}

.procurement-row div,
.procurement-row strong,
.procurement-row span,
.procurement-row small {
  min-width: 0;
}

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

.procurement-row span,
.procurement-row small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.row-muted {
  opacity: .62;
}

.procurement-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.outside-file-list,
.arrival-list {
  display: grid;
  gap: 14px;
}

.outside-file-row,
.arrival-record {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.outside-file-row {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(360px, 1.2fr);
  gap: 18px;
}

.outside-file-main {
  min-width: 0;
}

.outside-file-main > strong,
.outside-file-main > span,
.outside-file-main > small {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.outside-file-main p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.outside-file-actions,
.procurement-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-form {
  display: grid;
  gap: 9px;
  align-content: start;
}

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

.danger-zone {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0b4b4;
}

.arrival-record header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.arrival-record p {
  margin: 10px 0;
}

.arrival-record > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.arrival-photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.arrival-photo-list a {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f4f6f8;
}

.arrival-photo-list img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stow-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.procurement-warehouse-group {
  margin-bottom: 24px;
}

.procurement-warehouse-group h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

@media (max-width: 760px) {
  .procurement-row,
  .outside-file-row,
  .outside-file-actions,
  .procurement-action-grid,
  .stow-form {
    grid-template-columns: 1fr;
  }

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

  .procurement-row {
    gap: 7px;
    padding: 14px 2px;
  }

  .arrival-photo-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dad-custom-head {
  align-items: center;
}

.dad-custom-filters form {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.dad-custom-list-panel {
  padding: 0;
  overflow: hidden;
}

.dad-custom-list-panel > .production-section-head {
  padding: 18px 18px 4px;
}

.dad-custom-list {
  border-top: 1px solid var(--line);
}

.dad-custom-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(110px, 0.9fr) minmax(180px, 1.8fr) minmax(90px, 0.7fr) minmax(120px, 0.9fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

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

.dad-custom-row:hover {
  background: #f7f9fc;
}

.dad-custom-row > div {
  min-width: 0;
}

.dad-custom-row span:not(.status),
.dad-custom-progress-grid span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 13px;
}

.dad-custom-row strong,
.dad-custom-progress-grid strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.dad-custom-project {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dad-custom-project strong {
  font-size: 17px;
}

.dad-custom-progress-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.dad-custom-progress-grid > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.dad-custom-readonly {
  margin-top: 16px;
  text-align: center;
}

.dad-custom-documents {
  min-width: 0;
  overflow: hidden;
}

.dad-custom-documents > .production-section-head span {
  color: var(--muted);
}

.dad-document-group + .dad-document-group {
  margin-top: 18px;
}

.dad-document-group h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.dad-document-list {
  border-top: 1px solid var(--line);
}

.dad-document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.dad-document-file {
  min-width: 0;
}

.dad-document-file strong,
.dad-document-file span {
  display: block;
  overflow-wrap: anywhere;
}

.dad-document-file span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.dad-document-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.dad-document-actions .button {
  min-width: 64px;
  padding: 9px 12px;
  text-align: center;
}

.page.production-board-shell {
  max-width: 1600px;
}

.shipping-scope-list,
.shipping-history-list {
  display: grid;
  gap: 10px;
}

.shipping-scope-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(200px, 1.5fr) minmax(150px, 0.8fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

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

.shipping-scope-row > div,
.shipping-history-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.shipping-scope-row span,
.shipping-history-row span {
  color: var(--muted);
}

.shipping-address strong {
  overflow-wrap: anywhere;
}

.shipping-history-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.shipping-history-row p {
  overflow-wrap: anywhere;
}

.shipping-boss-review {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.shipping-boss-review > p {
  grid-column: 1 / -1;
}

.shipping-special-form,
.shipping-event-form {
  margin-top: 18px;
}

@media (max-width: 760px) {
  .shipping-scope-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .shipping-scope-row .shipping-address,
  .shipping-scope-row > div:nth-child(3) {
    grid-column: 1 / -1;
  }

  .shipping-boss-review {
    grid-template-columns: 1fr;
  }

  .shipping-boss-review > p {
    grid-column: auto;
  }
}

.production-board-head {
  align-items: center;
}

.production-queue-section {
  margin-top: 18px;
}

.production-queue-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #263238;
  color: #fff;
}

.production-queue-title h2 {
  margin: 0;
  font-size: 21px;
}

.production-board-table-wrap {
  border-radius: 0;
}

.production-board-table th,
.production-board-table td {
  padding: 13px 14px;
  font-size: 16px;
}

.production-board-table th {
  background: #e8edf2;
}

.production-board-table tbody tr:nth-child(even) {
  background: #f8fafb;
}

.production-board-table td {
  white-space: normal;
}

.production-board-table td:first-child,
.production-board-table td:nth-child(2),
.production-board-table td:nth-last-child(-n + 2) {
  white-space: nowrap;
}

.schedule-identifier {
  font-size: 18px !important;
  font-weight: 750;
}

.schedule-address {
  min-width: 190px;
  max-width: 360px;
  overflow-wrap: anywhere;
}

.schedule-date-form {
  display: grid;
  grid-template-columns: minmax(138px, 1fr) minmax(96px, auto) auto;
  gap: 7px;
  min-width: 320px;
}

.schedule-date-form button {
  padding: 7px 10px;
}

.schedule-adjusted {
  display: block;
  margin-top: 4px;
  color: #7a4b00;
  font-size: 12px;
}

.schedule-timing {
  font-weight: 750;
}

.schedule-overdue {
  color: #b42318;
}

.schedule-today {
  color: #9a6700;
}

.schedule-remaining {
  color: #176336;
}

.schedule-unscheduled {
  color: var(--muted);
}

.tail-batch-list,
.dad-tail-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.tail-batch-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(150px, 1fr) minmax(120px, .8fr) minmax(130px, .8fr);
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.tail-batch-row:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.tail-batch-row div,
.tail-batch-row span,
.tail-batch-row small {
  min-width: 0;
}

.tail-batch-row span,
.tail-batch-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.tail-batch-row .status {
  display: inline-block;
  margin-top: 0;
  color: inherit;
}

.tail-board-badge {
  display: block;
  width: max-content;
  margin-top: 4px;
  padding: 2px 6px;
  background: #fff0d6;
  color: #7a4b00;
  font-size: 12px;
  font-weight: 700;
}

.dad-tail-row {
  border: 1px solid var(--line);
  padding: 12px;
}

.dad-tail-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.dad-tail-summary strong,
.dad-tail-summary span {
  display: block;
}

.dad-tail-summary div > span {
  margin-top: 3px;
  color: var(--muted);
}

.tail-void-section button {
  border-color: #b42318;
  color: #b42318;
}

@media (max-width: 760px) {
  .dad-custom-filters form,
  .dad-custom-progress-grid {
    grid-template-columns: 1fr;
  }

  .dad-custom-filters .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dad-custom-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    padding: 12px 14px;
  }

  .dad-custom-project,
  .dad-custom-address {
    grid-column: 1 / -1;
  }

  .dad-custom-progress-grid {
    gap: 8px;
  }

  .dad-custom-progress-grid > div {
    padding: 11px 12px;
  }

  .dad-document-row {
    gap: 9px;
  }

  .dad-document-actions {
    gap: 6px;
  }

  .dad-document-actions .button {
    min-width: 58px;
    padding: 10px 9px;
  }

  .production-board-head,
  .production-queue-title {
    align-items: stretch;
  }

  .production-queue-title {
    align-items: center;
  }

  .production-board-page .production-board-table {
    width: 100%;
    min-width: 0;
  }

  .production-board-page .production-board-table thead {
    display: none;
  }

  .production-board-page .production-board-table,
  .production-board-page .production-board-table tbody,
  .production-board-page .production-board-table tr,
  .production-board-page .production-board-table td {
    display: block;
  }

  .production-board-page .production-board-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-bottom: 10px;
    border: 1px solid var(--line);
    background: #fff;
  }

  .production-board-page .production-board-table td {
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .production-board-page .production-board-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }

  .production-board-page .production-board-table td:first-child,
  .production-board-page .production-board-table .schedule-address,
  .production-board-page .production-board-table .empty {
    grid-column: 1 / -1;
  }

  .production-board-page .production-board-table .empty::before {
    display: none;
  }

  .production-board-page .schedule-date-form {
    grid-template-columns: minmax(0, 1fr) minmax(92px, auto) auto;
    min-width: 0;
  }

  .tail-batch-row {
    grid-template-columns: 1fr 1fr;
    gap: 9px 12px;
  }

  .tail-create-form {
    grid-template-columns: 1fr;
  }
}
/* M9 installation dispatch */
.installation-board { display: grid; gap: 16px; }
.installation-group > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.installation-group > header h2 { margin: 0; }
.installation-group > header > span { min-width: 34px; padding: 5px 9px; border-radius: 4px; background: #edf2f7; text-align: center; font-weight: 700; }
.installation-list { display: grid; gap: 8px; min-width: 0; }
.installation-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.5fr) minmax(180px, .9fr) auto; gap: 12px; align-items: center; min-width: 0; padding: 12px; border: 1px solid #d8dee6; border-radius: 6px; background: #fff; color: inherit; text-decoration: none; }
.installation-row:hover { border-color: #1874c9; background: #f7fbff; }
.installation-row > div { display: grid; gap: 3px; min-width: 0; }
.installation-row span, .installation-row small { color: #5e6875; }
.installation-row strong { overflow-wrap: anywhere; }
.installation-dispatch-panel { max-width: 900px; }
.installation-note { padding: 12px; border-left: 4px solid #1874c9; background: #f5f8fb; }
.installer-task-panel { padding: 12px; }
.installer-safe-facts dd { font-size: 17px; }

@media (max-width: 760px) {
  .installation-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .installation-row > div { grid-column: 1 / -1; }
  .installation-row > .status { grid-column: 2; grid-row: 1; align-self: start; }
  .installation-address strong { white-space: normal; }
}

/* M10 project closure */
.closure-board { display: grid; gap: 18px; }
.closure-board-group > header { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; margin-bottom: 12px; }
.closure-board-group > header h2, .closure-board-group > header p { margin: 0; }
.closure-order-list, .closure-tail-list { display: grid; gap: 8px; }
.closure-order-row { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(180px, 1.25fr) minmax(190px, 1.35fr) auto; align-items: center; gap: 14px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); padding: 12px 2px; }
.closure-order-row > div, .closure-tail-row > * { min-width: 0; }
.closure-order-row strong, .closure-order-row span, .closure-order-row small { display: block; overflow-wrap: anywhere; }
.closure-condition-list { margin: 12px 0; padding-left: 22px; }
.closure-condition-list li { margin: 8px 0; }
.closure-condition-list.passed li::marker { color: #177245; }
.closure-condition-list.blocked li::marker { color: #b42318; }
.closure-tail-row { display: grid; grid-template-columns: minmax(170px, 1.3fr) repeat(3, minmax(120px, 1fr)) auto; align-items: center; gap: 14px; border-top: 1px solid var(--line); padding: 12px 0; }
.closure-banner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; border-left: 5px solid #177245; }
.closure-banner strong, .closure-banner span { display: block; }
.closure-action textarea { min-height: 100px; }

@media (max-width: 720px) {
  .closure-order-row, .closure-tail-row { grid-template-columns: 1fr; gap: 6px; }
  .closure-order-row .status, .closure-tail-row .status { justify-self: start; }
  .closure-banner { grid-template-columns: 1fr; }
}

/* V1.5 Boss custom-order index */
.boss-order-index-entry { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.boss-order-index-entry h2, .boss-order-index-entry p { margin: 0; }
.boss-order-filters { display: block; padding: 14px; }
.boss-order-filters form { display: grid; grid-template-columns: minmax(220px, 1.7fr) repeat(4, minmax(110px, .75fr)) auto; align-items: end; gap: 10px; }
.boss-order-filters input, .boss-order-filters select { max-width: none; }
.boss-order-filters .actions { flex-wrap: nowrap; }
.boss-order-index { min-width: 0; padding: 0; overflow: hidden; }
.boss-order-grid { display: grid; grid-template-columns: minmax(110px, .85fr) minmax(110px, .9fr) minmax(150px, 1.35fr) 46px 72px 78px minmax(180px, 1.55fr) minmax(112px, .9fr); align-items: center; gap: 10px; min-width: 0; }
.boss-order-grid > * { min-width: 0; overflow-wrap: anywhere; }
.boss-order-grid-head { padding: 10px 14px; background: #f0f3f7; color: #344054; font-size: 13px; font-weight: 700; }
.boss-order-index-row { min-height: 64px; padding: 10px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.boss-order-index-row:hover { background: #f7fbff; text-decoration: none; }
.boss-order-index-row.is-closed { background: #fafafa; color: #5e6875; }
.boss-order-index-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.boss-order-source, .boss-order-type { font-weight: 700; }
.boss-order-stage { justify-self: start; white-space: nowrap; }
.boss-order-delivery strong, .boss-order-delivery small { display: block; }
.boss-order-delivery.today, .boss-order-delivery.overdue { color: #b42318; }
.boss-order-delivery.unscheduled { color: var(--muted); }

@media (max-width: 900px) {
  .boss-order-filters form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .boss-order-search { grid-column: span 2; }
  .boss-order-filters .actions { align-self: end; }
  .boss-order-grid { grid-template-columns: minmax(105px, .8fr) minmax(105px, .8fr) minmax(140px, 1.2fr) 40px 64px 72px minmax(170px, 1.4fr) minmax(106px, .8fr); gap: 8px; font-size: 13px; }
}

@media (max-width: 760px) {
  .boss-orders-heading, .boss-order-index-entry { align-items: stretch; }
  .boss-order-index-entry { flex-direction: column; }
  .boss-order-filters form { grid-template-columns: 1fr 1fr; }
  .boss-order-search { grid-column: 1 / -1; }
  .boss-order-filters .actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .boss-order-grid-head { display: none; }
  .boss-order-index-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "project project delivery" "customer customer customer" "address address address" "source type stage" "task task task"; gap: 5px 10px; min-height: 0; padding: 12px 14px; }
  .boss-order-project { grid-area: project; font-size: 16px; }
  .boss-order-customer { grid-area: customer; font-weight: 700; }
  .boss-order-address { grid-area: address; color: var(--muted); }
  .boss-order-source { grid-area: source; }
  .boss-order-source::after { content: " 类"; }
  .boss-order-type { grid-area: type; }
  .boss-order-stage { grid-area: stage; justify-self: end; }
  .boss-order-task { grid-area: task; padding-top: 4px; border-top: 1px dashed #e2e6ec; }
  .boss-order-delivery { grid-area: delivery; text-align: right; white-space: nowrap; }
}

@media (max-width: 390px) {
  .boss-order-filters form { grid-template-columns: 1fr; }
  .boss-order-search, .boss-order-filters .actions { grid-column: 1; }
  .boss-order-index-row { padding-right: 12px; padding-left: 12px; }
}

.workshop-page { max-width: 1000px; margin: auto; min-width: 0; overflow-wrap: anywhere; }
.workshop-page h1 { font-size: 24px; }
.workshop-page h2 { font-size: 18px; margin-top: 26px; }
.workshop-page fieldset, .workshop-route { border: 1px solid #dce2df; margin: 16px 0; padding: 14px; min-width: 0; }
.workshop-route { display: flex; flex-wrap: wrap; gap: 20px; }
.workshop-route label, .workshop-source { display: flex; align-items: center; gap: 8px; }
.workshop-route input[type=checkbox], .workshop-source input { width: 18px; height: 18px; flex: 0 0 18px; }
.workshop-reason { flex-basis: 100%; flex-wrap: wrap; }
.workshop-worker-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 14px 0; }
.workshop-worker-form label { min-width: 0; }
.workshop-worker-form input[type=checkbox] { width: 18px; }
.workshop-worker-row, .workshop-history-row { border-bottom: 1px solid #dde3e0; padding: 14px 0; }
.workshop-worker-row > div { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.workshop-worker-row summary, .workshop-new summary { padding: 10px 0; cursor: pointer; }
.workshop-token { overflow-wrap: anywhere; white-space: normal; }
.workshop-source { padding: 12px 0; }
.workshop-source small { display: block; color: #67756e; }
.workshop-progress { list-style: none; padding: 0; }
.workshop-progress li { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 0; border-bottom: 1px solid #e3e7e4; }
.workshop-summary { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12px; }
.workshop-summary .done { color: #246344; }
.workshop-summary .na { color: #7b807d; }
@media (max-width: 480px) {
  .workshop-worker-form > label { flex: 1 1 100%; }
  .workshop-page input:not([type=checkbox]), .workshop-page select { max-width: 100%; width: 100%; }
  .workshop-page form { min-width: 0; }
  .workshop-route { gap: 14px; }
}
:root .legacy-import-row { min-width: 0; padding: 16px 0; border-bottom: 1px solid #d8dddf; overflow-wrap: anywhere; }
:root .legacy-import-row h3 { font-size: 17px; margin: 0; }
:root .legacy-import-row .custom-facts { margin: 12px 0; }
.test-data-label { display: inline-block; color: #8a3717; background: #fff1df; border: 1px solid #dba36c; border-radius: 3px; padding: 2px 6px; font-size: 12px; white-space: nowrap; }
.boss-order-filters .boss-test-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.boss-order-filters .boss-test-toggle input { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; margin: 0; padding: 0; }
@media (max-width: 760px) {
  .boss-order-filters .boss-test-toggle { grid-column: 1 / -1; }
}
