:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #687385;
  --line: #dfe6ef;
  --blue: #2563eb;
  --teal: #0f766e;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --ink: #111827;
  --shadow: 0 14px 32px rgba(22, 34, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

[hidden] {
  display: none !important;
}

/* 未完成服务端会话校验前，业务界面永远不可见，避免移动端缓存或脚本加载延迟造成内容闪现。 */
body[data-auth-state="pending"] #app,
body[data-auth-state="unauthenticated"] #app {
  display: none !important;
}

body[data-auth-state="authenticated"] #loginGate {
  display: none !important;
}

.app-loading {
  display: none;
  width: min(100%, 320px);
  padding: 32px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(22, 34, 51, 0.1);
}

.app-loading strong,
.app-loading span {
  display: block;
}

.app-loading span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

body[data-auth-state="pending"] .app-loading {
  display: block;
}

body[data-auth-state="pending"] .login-card {
  display: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  touch-action: pan-y;
}

.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3f8;
}

.login-card {
  width: min(100%, 392px);
  padding: 38px;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(22, 34, 51, 0.12);
}

.login-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-size: 23px;
  font-weight: 800;
}

.login-heading {
  margin-bottom: 28px;
}

.login-heading strong,
.login-heading span {
  display: block;
}

.login-heading strong {
  font-size: 24px;
}

.login-heading span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  height: 44px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
}

.login-card input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
}

.login-error {
  margin: -4px 0 12px;
  color: #b42318;
  font-size: 13px;
}

.session-user-name {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

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

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  max-width: 100vw;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  background: #182235;
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #2f80ed;
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #aeb8c8;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  text-align: left;
  color: #c9d4e5;
  background: transparent;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: #2b3a55;
}

.main {
  min-width: 0;
  max-width: 100vw;
  padding: 24px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.3;
}

h2 {
  font-size: 17px;
}

.topbar p,
.panel-head span,
.bridge-item p,
.meta,
.subtle {
  color: var(--muted);
}

.topbar p {
  display: none;
}

.user-box,
.toolbar,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric,
.panel,
.bridge-item {
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.workbench,
.orders-layout,
.materials-layout,
.users-layout,
.files-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 14px;
}

.ai-assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 14px;
}

.ai-assistant-layout > .admin-only {
  grid-column: 1 / -1;
}

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

.ai-chat-window {
  display: grid;
  grid-template-rows: minmax(360px, 58vh) auto;
  gap: 12px;
}

.ai-chat-messages {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
}

.ai-chat-message {
  max-width: 82%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.ai-chat-message.user {
  margin-left: auto;
  background: #eaf2ff;
  border-color: #bfdbfe;
}

.ai-chat-message.assistant {
  margin-right: auto;
}

.ai-chat-message div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ai-chat-message div span {
  color: var(--muted);
  font-size: 12px;
}

.ai-chat-message p {
  line-height: 1.65;
  word-break: break-word;
}

.ai-chat-composer {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.ai-chat-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-chat-tools button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--muted);
  background: #f8fafc;
}

.ai-chat-tools button.active {
  color: #ffffff;
  border-color: #1f2937;
  background: #1f2937;
}

.ai-chat-composer textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
}

.ai-reference-zone {
  display: grid;
  gap: 4px;
  border: 1px dashed #b6c4d6;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f8fafc;
}

.ai-reference-zone.drag-over,
.ai-reference-zone:focus {
  border-color: var(--blue);
  outline: none;
  background: #eef5ff;
}

.ai-reference-zone strong {
  color: var(--text);
}

.ai-reference-zone span {
  font-size: 12px;
}

.ai-reference-zone input {
  display: none;
}

.ai-reference-preview:empty {
  display: none;
}

.ai-reference-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
}

.ai-reference-chip img {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.ai-reference-chip div {
  min-width: 0;
  flex: 1;
}

.ai-reference-chip strong,
.ai-reference-chip span {
  display: block;
}

.ai-reference-chip span {
  color: var(--muted);
  font-size: 12px;
}

.ai-reference-chip button {
  border: 0;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--red);
  background: #fee2e2;
}

.ai-usage-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -2px;
}

.ai-usage-note span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.ai-chat-send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-chat-send-row span {
  color: var(--muted);
  font-size: 13px;
}

.ai-hidden-compat-form {
  display: none;
}

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

.ai-card-form > div strong,
.ai-empty-state strong,
.ai-result-card strong {
  display: block;
}

.ai-card-form > div span,
.ai-empty-state span,
.ai-result-card .design-file-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ai-card-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.ai-card-form input,
.ai-card-form select,
.ai-card-form textarea {
  width: 100%;
}

.ai-result-list {
  display: grid;
  gap: 12px;
}

.ai-empty-state,
.ai-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}

.ai-result-card pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  color: #243044;
  font-family: inherit;
  font-size: 14px;
}

.reshipment-panel {
  margin-top: 14px;
}

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

.reshipment-row {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdff;
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

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

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

.stage-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 150px;
  padding: 12px;
  background: #fbfdff;
}

.stage-column h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.mini-order,
.risk-item,
.inventory-row {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.mini-order:first-of-type,
.risk-item:first-child,
.inventory-row:first-child {
  border-top: 0;
}

.mini-order strong,
.risk-item strong {
  display: block;
  margin-bottom: 4px;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.scanner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.shipped-records-panel {
  margin-top: 14px;
}

.shipped-records-list {
  display: grid;
  gap: 8px;
}

.shipped-record {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.8fr 0.9fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdff;
}

.shipped-record.reverted {
  opacity: 0.72;
  background: #fff7ed;
}

.shipped-record strong,
.shipped-record span,
.shipped-record small {
  display: block;
}

.shipped-record span,
.shipped-record small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.scanner-bar label {
  display: grid;
  gap: 6px;
  min-width: 280px;
}

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

.scanner-bar input {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.my-tasks-panel {
  margin-bottom: 14px;
}

.my-tasks-panel.collapsed {
  margin-bottom: 10px;
  padding-bottom: 12px;
}

.my-tasks-panel.collapsed .my-task-board {
  display: none;
}

.compact-toggle {
  margin-left: auto;
  min-height: 32px;
  padding: 0 12px;
}

.my-task-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.my-task-board.single-lane {
  grid-template-columns: minmax(260px, 420px);
}

.task-lane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

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

.task-lane-head strong {
  font-size: 15px;
}

.task-lane-head span {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  color: var(--teal);
  background: #e8f7f5;
  font-size: 13px;
  font-weight: 700;
}

.task-lane p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
}

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

.task-card {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  color: var(--text);
  background: #fff;
}

.task-card-main {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.task-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.task-action-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
}

.task-action-button.secondary {
  color: var(--text);
  background: #e8edf4;
}

.feedback-mini-button {
  min-height: 32px;
  border: 1px solid #f4c542;
  border-radius: 8px;
  padding: 0 10px;
  color: #7c4a03;
  background: #fff8db;
  font-size: 12px;
  font-weight: 800;
}

.task-section-title {
  margin: 8px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-card:hover,
.task-card.active {
  border-color: #93b4ff;
  background: #f0f6ff;
}

.task-card strong {
  font-size: 12px;
  line-height: 1.35;
  word-break: break-all;
}

.task-card span,
.task-card small,
.task-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.task-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  background: #fff;
}

.print-task-order-list {
  display: grid;
  gap: 8px;
}

.print-task-order-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) minmax(120px, 1fr) minmax(80px, .7fr) minmax(140px, 1fr) minmax(70px, .55fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: #fff;
}

.print-task-order-row:hover,
.print-task-order-row.active {
  border-color: #0f9f9a;
  background: #eefafa;
}

.print-task-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.print-task-main strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
}

.print-task-main em,
.print-task-order-row span,
.print-task-order-row small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-task-main em {
  color: #334155;
  font-style: normal;
}

.empty-detail-hint {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 22px;
  color: var(--muted);
  background: #fff;
}

.empty-detail-hint strong {
  color: var(--ink);
  font-size: 16px;
}

.woven-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.woven-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

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

.woven-column-head span {
  min-width: 30px;
  border-radius: 999px;
  padding: 3px 8px;
  text-align: center;
  color: #0f8b8d;
  background: #e6f6f6;
  font-weight: 800;
}

.woven-list,
.woven-card,
.woven-card-main {
  display: grid;
}

.woven-list {
  gap: 10px;
}

.woven-card {
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.woven-card-main {
  gap: 5px;
  text-align: left;
  color: inherit;
}

.woven-card-main strong,
.woven-card-main span,
.woven-card-main small {
  display: block;
}

.woven-card-top {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.woven-card-top img {
  width: 84px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.woven-card-main small {
  color: var(--muted);
  line-height: 1.5;
}

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

.linked-woven-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  width: fit-content;
  margin-top: 5px;
  border-radius: 999px;
  padding: 0 8px;
  color: #0f766e;
  background: #e6fffb;
  font-size: 12px;
  font-weight: 800;
}

.linked-woven-panel {
  border: 1px solid #b6ebe5;
  border-radius: 8px;
  padding: 0;
  background: #f5fffd;
}

.linked-woven-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  cursor: pointer;
}

.linked-woven-panel summary strong {
  color: var(--ink);
  font-size: 15px;
}

.linked-woven-panel summary span {
  border-radius: 999px;
  padding: 3px 8px;
  color: #0f766e;
  background: #d9f8f4;
  font-size: 12px;
  font-weight: 800;
}

.linked-woven-list {
  display: grid;
  gap: 10px;
  border-top: 1px solid #d6f4ef;
  padding: 12px;
}

.linked-woven-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.linked-woven-item img {
  width: 96px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.linked-woven-item strong,
.linked-woven-item span,
.linked-woven-item small {
  display: block;
}

.linked-woven-item span,
.linked-woven-item small {
  color: var(--muted);
  line-height: 1.45;
}

.linked-woven-address {
  white-space: normal;
}

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

@media (max-width: 720px) {
  .linked-woven-panel summary {
    min-height: 42px;
    padding: 0 10px;
  }

  .linked-woven-list {
    padding: 10px;
  }

  .linked-woven-item {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
  }

  .linked-woven-item img {
    width: 74px;
    height: 58px;
  }

  .linked-woven-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.capacity-panel {
  margin-bottom: 14px;
}

.capacity-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(240px, 0.7fr) minmax(360px, 1.2fr);
  gap: 12px;
  align-items: start;
}

.capacity-layout:has(.admin-only[hidden]) {
  grid-template-columns: minmax(360px, 1fr);
}

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

.machine-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.machine-form button {
  grid-column: 1 / -1;
}

.machine-list,
.schedule-preview {
  display: grid;
  gap: 8px;
}

.machine-list-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.machine-list-wrap summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
}

.machine-list-wrap .machine-list {
  padding: 0 10px 10px;
}

.machine-row,
.schedule-row,
.schedule-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.machine-row small {
  flex-basis: 100%;
  color: var(--muted);
  line-height: 1.6;
}

.machine-choice-panel {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  background: #fbfcfe;
}

.machine-choice-panel strong,
.machine-choice-panel span {
  display: block;
}

.machine-choice-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.machine-choice-panel select {
  min-width: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.machine-row span,
.schedule-row span,
.schedule-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.schedule-row.urgent-row {
  border-color: #f4c542;
  background: #fff9e3;
}

.stage-eta-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.eta-pill {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.search {
  flex: 1;
  min-width: 260px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

input,
select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
}

.primary-button,
.ghost-button,
.icon-button,
.step-button,
.danger-button {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 38px;
  padding: 0 14px;
}

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

.ghost-button {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.icon-button {
  width: 34px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  font-size: 20px;
}

.step-button {
  color: var(--blue);
  background: #eef4ff;
  border-color: #c9dcff;
}

.step-button.done {
  color: var(--green);
  background: #ebf8ef;
  border-color: #c9efd4;
}

.step-button.current {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.step-button.danger-action {
  display: block;
  margin-top: 8px;
  color: var(--red);
  background: #fff5f5;
  border-color: #fecaca;
}

.step-button.blocked {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.danger-button {
  color: var(--red);
  background: #fff5f5;
  border-color: #fecaca;
}

.danger-button:hover {
  background: #fee2e2;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

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

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.order-no {
  display: inline-block;
  max-width: 150px;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-all;
}

.urgent-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 6px;
  color: #121a25;
  background: #f4c542;
  font-size: 12px;
  font-weight: 800;
  vertical-align: text-bottom;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f0f6ff;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--teal);
  background: #e8f7f5;
}

.status.warning {
  color: var(--amber);
  background: #fff4df;
}

.status.danger {
  color: var(--red);
  background: #ffe8e8;
}

.platform {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  background: #64748b;
}

.platform.pdd {
  background: #dc2626;
}

.platform.taobao {
  background: #ea580c;
}

.platform.internal {
  background: #2563eb;
}

.address-cell {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
}

.remark-cell {
  max-width: 240px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
}

.order-row-action-cell {
  width: 116px;
  text-align: right;
}

.list-start-button {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.customers-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.customer-list,
.feedback-alert-list,
.feedback-list {
  display: grid;
  gap: 10px;
}

.customer-card,
.feedback-item,
.feedback-alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  text-align: left;
}

.customer-card strong,
.customer-card span,
.customer-card small,
.customer-card em {
  display: block;
}

.customer-card span,
.customer-card p,
.customer-card small,
.customer-card em,
.feedback-item small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.customer-delete-button {
  display: block;
  margin-top: 10px;
  margin-left: auto;
}

.customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.payment-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.payment-tag.monthly {
  background: #e0f2fe;
  color: #0369a1;
}

.payment-tag.private {
  margin-left: 6px;
  background: #fff1f2;
  color: #be123c;
}

.payment-tag.label {
  margin-left: 6px;
  background: #ecfdf5;
  color: #047857;
}

.finance-panel {
  margin-top: 16px;
}

.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.finance-summary > div,
.ledger-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.finance-summary span,
.finance-summary small,
.ledger-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.finance-summary strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
}

.finance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.finance-grid h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

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

.ledger-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.source-chart {
  display: grid;
  gap: 10px;
}

.source-bar {
  display: grid;
  grid-template-columns: 64px 1fr 44px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.source-bar div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.source-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}

.feedback-alert {
  cursor: pointer;
}

.feedback-alert span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.feedback-panel {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.feedback-item.done {
  opacity: 0.72;
}

.feedback-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.proof-thumb {
  display: block;
  width: 96px;
  height: 52px;
  margin-top: 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.proof-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.order-preview-cell {
  display: grid;
  grid-template-columns: 86px minmax(90px, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 190px;
}

.order-preview-cell img {
  width: 86px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.order-preview-cell span {
  white-space: normal;
  line-height: 1.4;
}

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-title strong {
  display: block;
  font-size: 20px;
}

.detail-title .meta {
  display: none;
}

.shipping-proof-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0f766e;
}

.shipping-proof-summary strong,
.shipping-proof-summary span {
  margin: 0;
  color: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.shipping-proof-summary span,
.shipping-list-summary {
  font-weight: 700;
}

.shipping-list-summary {
  color: #0f766e !important;
}

.compact-detail-title strong {
  font-size: 18px;
}

.shipping-address-preview {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 12px;
}

.shipping-address-preview span,
.shipping-address-preview small {
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
}

.shipping-address-preview strong {
  color: #111827;
  font-size: 15px;
  line-height: 1.55;
}

.order-address-lines {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.order-address-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--text);
  line-height: 1.55;
  word-break: break-word;
}

.order-address-line b {
  min-width: 44px;
  border-radius: 4px;
  background: #ffedd5;
  color: #9a3412;
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.mobile-detail-toggle {
  display: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--accent);
  padding: 10px 12px;
  font-weight: 800;
}

.mobile-order-detail-more {
  display: contents;
}

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

.field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdff;
}

.field span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
}

.production-action-panel {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.production-action-button {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-size: 18px;
  font-weight: 800;
}

.production-action-button:disabled {
  background: #94a3b8;
}

.production-action-panel span {
  color: var(--muted);
  font-size: 13px;
}

.production-due-alert {
  font-size: 15px;
  font-weight: 700;
}

.actual-quantity-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.actual-quantity-panel strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.actual-quantity-panel span {
  color: var(--muted);
  font-size: 13px;
}

.actual-quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
}

.actual-quantity-row.with-roll-count {
  grid-template-columns: minmax(0, 1fr) 150px 150px;
}

.actual-quantity-row input {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 20px;
  font-weight: 700;
}

.actual-style-quantity-list {
  display: grid;
  gap: 8px;
}

.actual-style-quantity-list label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 8px;
  align-items: center;
}

.actual-style-quantity-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actual-style-quantity-list input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 800;
}

.style-items-editor,
.style-items-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}

.style-items-editor.single-style {
  padding: 0;
  border: 0;
  background: transparent;
}

.style-items-editor.single-style .style-items-head {
  margin-bottom: 0;
  justify-content: flex-start;
}

.style-items-editor.single-style .style-items-head div,
.style-items-editor.single-style .style-items-list {
  display: none;
}

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

.style-items-head strong {
  display: block;
}

.style-items-head span {
  color: var(--muted);
  font-size: 12px;
}

.style-items-list,
.style-items-table {
  display: grid;
  gap: 8px;
}

.style-items-editor .style-items-list {
  overflow-x: auto;
  padding-bottom: 2px;
}

.style-item-row,
.style-items-row {
  display: grid;
  grid-template-columns: 54px 0.65fr 0.85fr 0.85fr 0.85fr 1.05fr 0.95fr 0.75fr 0.65fr 1.05fr 42px;
  gap: 8px;
  align-items: center;
}

.style-items-editor .style-item-row {
  min-width: 920px;
}

.style-items-row {
  grid-template-columns: 0.7fr 1fr 1fr 1.1fr 0.9fr 0.8fr 0.9fr;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.style-detail-table .style-items-row {
  grid-template-columns: 0.55fr 92px 0.82fr 0.82fr 0.95fr 0.78fr 0.62fr 0.78fr 1fr 1fr;
}

.style-detail-table.with-production-inputs .style-items-row {
  grid-template-columns: 0.38fr 0.66fr 0.66fr 0.72fr 0.66fr 0.5fr 0.62fr 0.72fr minmax(86px, 0.75fr) minmax(330px, 1.8fr);
  align-items: center;
}

.style-inline-production-cell {
  display: block;
  min-width: 0;
}

.style-inline-production-cell .actual-style-quantity-card {
  grid-template-columns: 92px minmax(92px, 1fr) minmax(96px, 0.95fr);
  grid-template-rows: auto auto;
  gap: 6px 8px;
  padding: 8px;
  border-color: #b8ddff;
  background: #fafdff;
}

.style-inline-production-cell .actual-style-preview-block {
  grid-row: 1 / 3;
  width: 92px;
  min-width: 92px;
}

.style-inline-production-cell .style-preview-thumb,
.style-inline-production-cell .actual-preview-placeholder {
  width: 68px;
  height: 58px;
}

.style-inline-production-cell .actual-style-meta {
  grid-column: 2 / 4;
  font-size: 13px;
}

.style-inline-production-cell .actual-style-quantity-card input,
.style-inline-production-cell .actual-style-quantity-card select {
  width: 100%;
  min-width: 78px;
  min-height: 34px;
  font-size: 14px;
}

.style-items-row.head {
  color: var(--muted);
  background: #eef4fb;
  font-weight: 800;
}

.style-preview-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  background: #fff;
  cursor: zoom-in;
}

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

.style-editor-preview {
  width: 52px;
  height: 42px;
  align-self: center;
  justify-self: start;
}

.style-editor-preview[draggable="true"] {
  cursor: grab;
}

.style-item-row.drag-preview-over {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: #f0fdfa;
}

.style-item-row.drag-preview-source {
  opacity: 0.72;
}

.style-editor-preview.empty {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.style-preview-stack {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
}

.style-preview-stack .style-preview-thumb {
  width: 42px;
}

.shared-back-preview {
  position: relative;
  border-color: #5eead4;
  background: #f0fdfa;
}

.shared-back-preview span {
  position: absolute;
  right: 2px;
  bottom: 1px;
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.actual-style-quantity-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 110px 92px;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.actual-style-quantity-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.actual-style-preview-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 96px;
  min-width: 96px;
}

.actual-style-meta {
  color: var(--text);
}

.actual-style-quantity-card select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font-size: 15px;
  font-weight: 800;
}

.style-quantity-record {
  color: #0f766e;
  font-weight: 800;
}

.quantity-record-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #bfe9df;
  border-radius: 10px;
  background: #f0fdfa;
  color: #0f172a;
}

.quantity-record-panel strong {
  margin-right: 4px;
}

.quantity-record-panel span {
  font-size: 14px;
  font-weight: 800;
}

.shipping-style-detail .style-items-row {
  grid-template-columns: 72px 104px repeat(4, minmax(92px, 1fr));
  align-items: center;
  gap: 8px 12px;
  padding: 12px;
  font-size: 14px;
}

.shipping-style-detail .style-items-row.head {
  display: none;
}

.shipping-style-detail .style-items-row > span {
  white-space: normal;
  line-height: 1.35;
}

.shipping-style-detail .style-preview-stack {
  min-width: 96px;
}

.inline-style-save-panel {
  padding: 10px;
}

.inline-style-save-panel .inline-save-only {
  grid-template-columns: minmax(0, 180px);
  justify-content: end;
}

.actual-preview-placeholder {
  display: grid;
  place-items: center;
  width: 44px;
  height: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
}

.style-item-row input,
.style-item-row select,
.contract-review-table input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
}

.contract-review-table input {
  background: #fff;
}

.hidden-production-detail {
  display: none !important;
}

.proof-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: #fbfdff;
}

.proof-panel strong,
.proof-panel span {
  display: block;
}

.proof-panel span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.proof-panel img {
  width: 100%;
  max-height: min(68vh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

[data-proof-preview] {
  cursor: zoom-in;
}

html.proof-preview-open,
body.proof-preview-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.proof-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.88);
}

/* Use a native dialog for image previews so it can sit above the order editor. */
.proof-preview-dialog {
  width: min(96vw, 980px);
  height: min(92vh, 760px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  touch-action: none;
  overscroll-behavior: contain;
}

.proof-preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.88);
}

.proof-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(96vw, 980px);
  height: min(92vh, 760px);
  overflow: hidden;
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

.proof-preview-panel:has(.proof-preview-pagination) {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.proof-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  color: #fff;
  background: rgba(15, 23, 42, 0.96);
  touch-action: manipulation;
}

.proof-preview-head strong,
.proof-preview-head span {
  display: block;
}

.proof-preview-head span {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 13px;
}

.proof-preview-close {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.proof-preview-image-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
}

.proof-preview-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  transform-origin: center center;
  will-change: transform;
}

.proof-preview-pagination {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  color: #fff;
  background: #0f172a;
}

.proof-preview-pagination strong {
  text-align: center;
}

.proof-preview-pagination button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.proof-preview-pagination button:disabled {
  opacity: 0.4;
}

@media (max-width: 700px) {
  .proof-preview-pagination {
    grid-template-columns: 74px minmax(0, 1fr) 74px;
    padding: 8px;
  }
}

.color-preview-panel {
  width: min(92vw, 560px);
  height: min(82vh, 640px);
  background: #fff;
}

.color-preview-wrap {
  display: grid;
  gap: 18px;
  place-items: center;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background: #f8fafc;
  color: #172033;
}

.color-preview-swatch {
  width: min(420px, 80vw);
  aspect-ratio: 1;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.color-preview-wrap strong {
  font-size: 28px;
}

.empty-proof {
  display: block;
  color: var(--muted);
}

.design-file-panel,
.contract-label-panel,
.address-edit-panel,
.operation-log-panel,
.shipping-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: #fbfdff;
}

.manual-shipping-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.manual-shipping-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.manual-shipping-form input {
  height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.contract-label-panel {
  background: #f8fdfb;
  border-color: #bbf7d0;
}

.contract-style-table {
  margin-bottom: 12px;
}

.address-edit-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}

.address-edit-panel > .order-address-lines {
  margin-top: 2px;
}

.address-edit-dialog {
  width: min(620px, calc(100vw - 28px));
}

.address-edit-dialog form,
.address-edit-field {
  display: grid;
  gap: 10px;
}

.address-edit-field textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
}

.operation-log-list {
  display: grid;
  gap: 8px;
}

.operation-log-item {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.operation-log-item strong {
  color: var(--text);
  font-size: 13px;
}

.operation-log-item span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.contract-extract-preview {
  display: block;
  border: 1px dashed #86efac;
  border-radius: 8px;
  padding: 10px;
  background: #f0fdf4;
}

.design-file-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.design-file-head strong,
.design-file-head span {
  display: block;
}

.design-file-head span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.design-file-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.design-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.compact-actions {
  justify-content: flex-end;
  margin-bottom: 0;
}

.upload-button {
  display: inline-flex;
  align-items: center;
}

.upload-button input {
  display: none;
}

.upload-button.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

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

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

.swatch-panel strong {
  display: block;
  margin-bottom: 10px;
}

.swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font-size: 13px;
}

.color-swatch button {
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: zoom-in;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.color-swatch em {
  font-style: normal;
}

.cancel-note {
  border-left: 3px solid var(--red);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  color: var(--red);
  background: #fff1f1;
}

.material-note {
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  line-height: 1.6;
  background: #f5f9ff;
}

.material-note.ok {
  border-left-color: var(--green);
  color: var(--green);
  background: #effaf3;
}

.material-note.warning {
  border-left-color: var(--amber);
  color: var(--amber);
  background: #fff8e8;
}

.material-note.danger {
  border-left-color: var(--red);
  color: var(--red);
  background: #fff1f1;
}

.material-note.neutral {
  color: var(--muted);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.spec-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.spec-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.spec-row > div {
  padding: 10px;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.spec-row > div:first-child {
  border-left: 0;
}

.spec-head {
  color: var(--muted);
  background: #f7f9fc;
  font-size: 13px;
}

.note {
  border-left: 3px solid var(--blue);
  background: #f5f9ff;
  padding: 10px 12px;
  color: var(--ink);
}

.inventory-row {
  display: grid;
  grid-template-columns: 1fr 140px 160px;
  gap: 12px;
  align-items: center;
}

.inventory-row.with-cost {
  grid-template-columns: minmax(0, 1fr) 140px 180px 160px;
}

.inventory-value-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 8px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 12px;
}

.inventory-value-summary span,
.inventory-value-summary small,
.inventory-row-cost small {
  color: var(--muted);
  font-size: 12px;
}

.inventory-value-summary strong {
  color: var(--ink);
  font-size: 20px;
}

.inventory-row-cost {
  display: grid;
  gap: 2px;
  justify-items: start;
}

.inventory-row-cost strong {
  color: var(--ink);
}

.inventory-row-cost.muted {
  color: var(--muted);
  font-size: 12px;
}

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

.material-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  background: #fbfdff;
}

.material-card:hover,
.material-card.active {
  border-color: #93b4ff;
  background: #f0f6ff;
}

.material-card strong {
  font-size: 16px;
}

.material-card span {
  color: var(--teal);
  font-weight: 700;
}

.material-card small {
  color: var(--muted);
  line-height: 1.5;
}

.material-spec-list {
  display: grid;
  gap: 6px;
}

.material-spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.material-spec-row span {
  color: var(--muted);
  font-weight: 400;
}

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

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

.material-form label,
.user-form label,
.file-form label,
.quote-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.material-form .wide,
.material-form button,
.user-form .wide,
.user-form button,
.file-form .wide,
.file-form button,
.quote-form .wide,
.quote-form button {
  grid-column: 1 / -1;
}

.ruixin-panel {
  grid-column: 1 / -1;
}

.integration-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.integration-status.online {
  color: #087f5b;
  background: #e6fcf5;
}

.integration-status.offline {
  color: #9a6700;
  background: #fff4cc;
}

.integration-summary {
  margin-bottom: 12px;
  border-left: 3px solid var(--green);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #f1fbf6;
}

.integration-summary.error {
  border-left-color: var(--red);
  color: var(--red);
  background: #fff3f3;
}

.ruixin-login-form {
  display: grid;
  grid-template-columns: 150px minmax(180px, 280px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.ruixin-login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.captcha-image-button {
  width: 150px;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #fff;
  cursor: pointer;
}

.captcha-image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ruixin-actions {
  margin-bottom: 12px;
}

.ruixin-orders-wrap {
  max-height: 430px;
  overflow: auto;
}

.empty-state.compact {
  min-height: 72px;
  padding: 22px;
}

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

  .captcha-image-button {
    width: 100%;
    max-width: 220px;
  }

  .ruixin-actions {
    align-items: stretch;
  }

  .ruixin-actions button {
    flex: 1 1 140px;
  }
}

.quote-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
}

.quote-choice-field {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: center;
}

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

.quote-material-field select {
  display: none;
}

.quote-material-choice-grid,
.quote-quantity-choice-grid {
  grid-column: 2 / 3;
}

.quote-choice-button,
.quote-form .quote-choice-button {
  grid-column: auto;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #7d96ac;
  min-height: 32px;
  padding: 6px 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  min-width: 88px;
}

.quote-choice-button:hover,
.quote-choice-button.active {
  background: #555555;
  color: #ffffff;
}

.quote-material-choice-grid {
  gap: 12px 28px;
}

.quote-quantity-choice-grid {
  gap: 12px 34px;
}

.quote-quantity-field input[name="quantity"] {
  grid-column: 3 / 4;
  min-height: 34px;
  width: 132px;
}

@media (max-width: 720px) {
  .woven-history-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .woven-history-price {
    text-align: left;
  }

  .quote-choice-field {
    grid-template-columns: 1fr;
  }

  .quote-material-choice-grid,
  .quote-quantity-choice-grid,
  .quote-quantity-field input[name="quantity"] {
    grid-column: 1 / -1;
  }

  .quote-quantity-field input[name="quantity"] {
    width: 100%;
  }
}

.orders-layout,
.orders-layout.compact-workflow {
  grid-template-columns: minmax(0, 1fr);
}

.orders-layout .table-panel {
  min-width: 0;
}

@media (max-width: 720px) {
  .style-detail-table.with-production-inputs .style-items-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .style-detail-table.with-production-inputs .style-items-row.head {
    display: none;
  }

  .style-detail-table.with-production-inputs .style-items-row > span:last-child {
    grid-column: 1 / -1;
  }

  .style-inline-production-cell .actual-style-quantity-card {
    grid-template-columns: 78px minmax(0, 1fr) 88px;
  }

  .orders-layout .detail-panel {
    display: none;
  }
}

.shortage-copy-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.shortage-copy-panel textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: Consolas, "Microsoft YaHei", monospace;
}

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

.file-library-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.file-library-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.file-library-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.file-library-pagination .ghost-button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.file-library-page-jump,
.file-library-page-jump label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-library-page-jump input {
  width: 58px;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  text-align: center;
}

.file-library-item {
  position: relative;
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 184px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-library-select {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.file-library-select input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.file-library-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.file-library-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.file-library-meta span {
  min-width: 0;
  flex: 1;
}

.file-library-amount {
  flex: 0 0 auto;
  color: #b54708;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.file-library-main strong,
.file-library-main span,
.file-library-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-library-main span,
.file-library-main small {
  color: var(--muted);
}

.file-library-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 6px;
}

.file-library-actions .step-button,
.file-library-actions .ghost-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.history-file-upload {
  width: fit-content;
}

#filesView .files-layout {
  grid-template-columns: minmax(0, 1fr);
}

.file-library-item {
  align-items: center;
}

.file-library-thumb {
  width: 144px;
  height: 144px;
  flex: none;
  overflow: hidden;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #f7f9fc;
  padding: 0;
  cursor: zoom-in;
}

.file-library-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.file-library-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.print-settings-panel {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1320px) {
  .file-library-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .file-library-selection-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-library-list {
    grid-template-columns: 1fr;
  }

  .file-library-item {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 0;
    gap: 8px 10px;
  }

  .file-library-thumb {
    width: 112px;
    height: 112px;
  }

  .file-library-actions {
    grid-column: 1 / -1;
  }

}

.upload-queue {
  margin-top: 10px;
}

.upload-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.upload-queue-head .ghost-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.upload-queue-head .primary-mini-button {
  min-height: 28px;
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: #0f8f86;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.upload-queue-head .primary-mini-button:hover {
  background: #0b756f;
}

.upload-queue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.upload-queue-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 0;
  background: #fff;
}

.upload-queue-list {
  display: grid;
  gap: 5px;
  max-height: 188px;
  overflow: auto;
}

.upload-queue-sticky-action {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 4px 0;
  background: #fff;
}

.upload-queue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.upload-queue-item strong,
.upload-queue-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-queue-item small {
  color: var(--muted);
}

.upload-progress {
  display: inline-block;
  width: 72px;
  height: 4px;
  margin-left: 7px;
  overflow: hidden;
  vertical-align: middle;
  border-radius: 99px;
  background: #d9e8ec;
}

.upload-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #14898a;
  transition: width 160ms linear;
}

.upload-state {
  font-size: 12px;
  color: var(--muted);
}

.upload-uploading {
  border-color: #77b8c7;
  background: #effafd;
}

.upload-done {
  border-color: #8ac9a8;
  background: #f2fbf5;
}

.upload-failed {
  border-color: #e6aaaa;
  background: #fff6f6;
}

.file-preview-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.file-preview-row span,
.file-preview-row strong {
  display: block;
}

.file-preview-row span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.file-preview-row strong {
  word-break: break-all;
}

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

.quote-debug-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.quote-debug-details summary {
  padding: 11px 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.quote-debug-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.quote-debug-content {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.quote-debug-content .file-preview-row {
  background: var(--surface);
}

.quote-image-upload input[type="file"] {
  padding: 10px;
  border: 1px dashed #b9c7d8;
  border-radius: 8px;
  background: #f8fbff;
}

.quote-paste-zone {
  display: grid;
  gap: 5px;
  min-height: 86px;
  align-content: center;
  justify-items: center;
  border: 1px dashed #9eb2ca;
  border-radius: 8px;
  padding: 14px;
  color: #334155;
  background: #f8fbff;
  cursor: pointer;
  text-align: center;
}

.quote-paste-zone:focus,
.quote-paste-zone.drag-over {
  border-color: var(--blue);
  background: #eef6ff;
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.quote-paste-zone strong,
.quote-paste-zone span {
  display: block;
}

.quote-paste-zone span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.quote-image-analysis {
  display: grid;
  gap: 8px;
  border: 1px solid #d7e3f2;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fbff;
}

.quote-image-analysis:empty {
  display: none;
}

.quote-image-summary strong,
.quote-image-summary span,
.quote-image-analysis small,
.quote-image-card strong,
.quote-image-card span {
  display: block;
}

.quote-image-summary span,
.quote-image-analysis small,
.quote-image-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.quote-image-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quote-image-swatch {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.quote-rule-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quote-records-inline {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.quote-records-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.quote-records-head h3 {
  margin: 0;
  font-size: 16px;
}

.quote-records-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.quote-records-inline .quote-rule-list {
  max-height: 720px;
  overflow-y: auto;
  padding-right: 4px;
}

.quote-rule-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.quote-rule-row strong,
.quote-rule-row span {
  display: block;
}

.quote-rule-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.woven-markup-table {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.woven-markup-head,
.woven-markup-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
}

.woven-markup-head {
  background: #f1f5f9;
  color: #334155;
}

.woven-markup-row {
  border-top: 1px solid var(--line);
  background: #fff;
}

.woven-markup-row strong {
  color: #0f766e;
}

.woven-markup-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #0f766e;
  font-weight: 700;
}

.woven-markup-row input {
  width: 120px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.woven-markup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.woven-markup-table > p {
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.print-size-surcharge-table {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.print-size-surcharge-head {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(220px, 1.3fr);
  gap: 16px;
  padding: 10px 14px;
  background: #f1f5f9;
  color: #334155;
}

.print-size-surcharge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #fff;
}

.print-size-surcharge-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.print-size-surcharge-row:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.print-size-surcharge-row > span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #0f766e;
  font-weight: 700;
}

.print-size-surcharge-row input {
  width: 90px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.print-size-surcharge-table > p {
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .print-size-surcharge-head {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .print-size-surcharge-grid {
    grid-template-columns: 1fr;
  }

  .print-size-surcharge-row:nth-child(odd) {
    border-right: 0;
  }
}

.quote-card {
  border: 1px solid #f4c542;
  border-radius: 8px;
  padding: 14px;
  background: #fff9e3;
}

.quote-card strong,
.quote-card span {
  display: block;
}

.quote-card strong {
  font-size: 22px;
}

.quote-card span {
  margin-top: 6px;
  color: var(--muted);
}

.copy-quote-button {
  margin-top: 12px;
}

.customer-quote-text {
  display: block;
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #243244;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.urgent-toggle {
  border-color: #f59e0b;
  color: #92400e;
  background: #fff7ed;
}

.quote-cost-card {
  border: 1px solid #b8d4c2;
  border-radius: 8px;
  padding: 12px 14px;
  background: #eef8f1;
}

.quote-image-card {
  border: 1px solid #c7d8f2;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f3f7ff;
}

.woven-history-card {
  border: 1px solid #d7e5de;
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.woven-history-card > strong,
.woven-history-card > span {
  display: block;
}

.woven-history-card > span,
.woven-history-card > p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.woven-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.woven-history-head span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.woven-history-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-top: 11px;
  padding: 11px 12px;
  border: 1px solid #e5ece8;
  border-radius: 6px;
  background: #fff;
}

.woven-history-summary small,
.woven-history-summary strong,
.woven-history-summary span {
  display: block;
}

.woven-history-summary small {
  color: var(--muted);
  font-size: 12px;
}

.woven-history-summary strong {
  margin-top: 3px;
  color: #183b36;
  font-size: 15px;
  line-height: 1.35;
}

.woven-history-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.woven-history-unit-price {
  min-width: 102px;
  text-align: right;
}

.woven-history-unit-price strong {
  color: #0f766e;
  font-size: 19px;
}

.woven-history-unit-price em {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.woven-history-details {
  margin-top: 10px;
  border-top: 1px solid #e5ece8;
}

.woven-history-details summary {
  padding-top: 10px;
  color: #42635e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.woven-history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.woven-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(168px, auto);
  gap: 5px 16px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.woven-history-row strong,
.woven-history-row span,
.woven-history-row small {
  display: block;
}

.woven-history-row span,
.woven-history-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.woven-history-price {
  text-align: right;
}

.woven-history-row small {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .woven-history-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .woven-history-unit-price {
    min-width: 0;
    text-align: left;
  }

  .woven-history-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .woven-history-price {
    text-align: left;
  }
}

.quote-cost-card strong,
.quote-cost-card span {
  display: block;
}

.quote-cost-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.file-preview-row code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  color: #243244;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
}

.stock-history {
  margin-top: 18px;
}

.stock-history h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr 100px 110px 110px 160px;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.history-row strong {
  color: var(--green);
}

.history-row .history-amount {
  color: var(--text);
  font-weight: 700;
}

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

.bridge-grid.single {
  grid-template-columns: 1fr;
}

.bridge-item {
  padding: 18px;
}

.bridge-item p {
  margin-top: 8px;
  line-height: 1.7;
}

.dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  padding: 0;
}

.dialog::backdrop {
  background: rgba(14, 22, 36, 0.45);
}

.dialog form {
  padding: 18px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.check-field {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-height: 40px;
  color: var(--text) !important;
  font-weight: 700;
}

.check-field input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.form-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.order-file-drop-zone {
  border: 1px dashed #9fb4d0;
  border-radius: 8px;
  padding: 14px;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.order-file-drop-zone span {
  color: var(--muted);
  font-size: 12px;
}

.order-file-drop-zone.drag-over {
  border-color: var(--accent);
  background: #eef7ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.order-screenshot-paste-zone {
  display: grid;
  gap: 4px;
  min-height: 78px;
  align-content: center;
  border: 1px dashed #93b7ca;
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: #f8fcfd;
  cursor: pointer;
}

.order-screenshot-paste-zone strong,
.order-screenshot-paste-zone span {
  display: block;
}

.order-screenshot-paste-zone span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.order-screenshot-paste-zone:focus,
.order-screenshot-paste-zone.drag-over {
  border-color: var(--accent);
  background: #eef8f8;
  box-shadow: 0 0 0 3px rgba(14, 124, 123, 0.12);
  outline: none;
}

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

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px;
    gap: 12px;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
  }

  .workbench,
  .capacity-layout,
  .orders-layout,
  .materials-layout,
  .users-layout,
  .ai-assistant-layout,
  .files-layout,
  .woven-board {
    grid-template-columns: 1fr;
  }

  .ai-mode-grid {
    grid-template-columns: 1fr;
  }

  .stage-board,
  .my-task-board,
  .metrics,
  .finance-summary,
  .finance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .user-box {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .metrics,
  .stage-board,
  .my-task-board,
  .capacity-layout,
  .material-grid,
  .design-file-grid,
  .proof-panel,
  .actual-quantity-row,
  .style-item-row,
  .style-items-row,
  .timeline,
  .bridge-grid,
  .form-grid,
  .material-form,
  .user-form,
  .file-form,
  .finance-summary,
  .finance-grid,
  .history-row {
    grid-template-columns: 1fr;
  }

  .inventory-row {
    grid-template-columns: 1fr;
  }

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

/* 现代化生产调度台主题 */
:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --text: #121a25;
  --muted: #647184;
  --line: #d7dee8;
  --blue: #2563eb;
  --teal: #0f8b8d;
  --green: #14844f;
  --amber: #b7791f;
  --red: #c2413a;
  --ink: #121a25;
  --shadow: 0 18px 42px rgba(33, 45, 61, 0.1);
}

body {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 139, 141, 0.04) 1px, transparent 1px),
    #eef2f6;
  background-size: 32px 32px;
}

.shell {
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  background: #101827;
  border-right: 1px solid #273246;
  box-shadow: 14px 0 36px rgba(16, 24, 39, 0.18);
}

.brand {
  min-height: 72px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  padding: 0 6px 18px;
}

.brand-mark {
  background: #f4c542;
  color: #111827;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand span {
  color: #8fa3bd;
}

.nav {
  gap: 8px;
}

.nav-item {
  position: relative;
  height: 44px;
  border-radius: 8px;
  color: #aebed2;
  font-weight: 600;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 12px;
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: transparent;
}

.nav-item:hover {
  color: #ffffff;
  background: #1b2638;
}

.nav-item.active {
  color: #ffffff;
  background: #223149;
}

.nav-item.active::before {
  background: #f4c542;
}

.main {
  padding: 26px 28px 34px;
}

.topbar {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

.user-box span,
.top-operator {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  padding: 0 10px;
  color: #415066;
  background: #f7f9fc;
  font-size: 13px;
}

.top-operator {
  gap: 8px;
  padding-right: 6px;
}

.top-operator select {
  height: 32px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  color: var(--text);
  font-weight: 700;
}

.metric,
.panel,
.bridge-item {
  border-color: #d7dee8;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 16px;
  background: #ffffff;
}

.metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: #0f8b8d;
}

.metric:nth-child(2)::before {
  background: #2563eb;
}

.metric:nth-child(3)::before {
  background: #f4c542;
}

.metric:nth-child(4)::before {
  background: #8b5cf6;
}

.metric:nth-child(5)::before {
  background: #b7791f;
}

.metric:nth-child(6)::before {
  background: #c2413a;
}

.metric span {
  color: #5f6f83;
  font-weight: 600;
}

.metric strong {
  margin-top: 14px;
  font-size: 30px;
  color: #121a25;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
}

.panel-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head h2::before {
  content: "";
  width: 7px;
  height: 18px;
  border-radius: 6px;
  background: #0f8b8d;
}

.toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

input,
select,
textarea {
  border-color: #cdd6e3;
  border-radius: 8px;
  background: #fbfcfe;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 139, 141, 0.2);
  border-color: #0f8b8d;
  background: #ffffff;
}

.primary-button,
.ghost-button,
.icon-button,
.step-button {
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  background: #0f8b8d;
  box-shadow: 0 10px 18px rgba(15, 139, 141, 0.22);
}

.primary-button:hover {
  background: #0b7678;
}

.ghost-button {
  border-color: #cdd6e3;
  background: #f8fafc;
}

.ghost-button:hover,
.step-button:hover {
  border-color: #0f8b8d;
  color: #0f7678;
}

.stage-column,
.task-lane,
.field,
.proof-panel,
.design-file-panel,
.shipping-panel,
.swatch-panel,
.file-preview-row,
.material-card {
  border-color: #d7dee8;
  background: #f9fbfd;
}

.stage-column {
  min-height: 172px;
}

.stage-column h3,
.task-lane-head strong {
  color: #121a25;
}

.mini-order,
.risk-item,
.inventory-row {
  border-top-color: #dce3ed;
}

.my-tasks-panel {
  border-color: #cbd8e8;
  background: #f7fbff;
}

.task-lane {
  background: #ffffff;
}

.task-lane-head span {
  color: #121a25;
  background: #f4c542;
}

.task-card {
  border-color: #d6dfeb;
  background: #fbfcfe;
}

.task-card:hover,
.task-card.active {
  border-color: #0f8b8d;
  background: #eefafa;
}

.task-card.active {
  box-shadow: inset 3px 0 0 #0f8b8d;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f6fb;
  color: #4a5a70;
}

td {
  background: #ffffff;
}

tbody tr:hover td,
tbody tr.selected td {
  background: #edfafa;
}

.status {
  color: #0f7678;
  background: #e2f5f5;
  font-weight: 700;
}

.status.warning {
  color: #8a5a12;
  background: #fff2c7;
}

.status.danger {
  color: #a43631;
  background: #ffe5e2;
}

.step-button {
  color: #0f7678;
  background: #e6f6f6;
  border-color: #bfe2e2;
}

.step-button.done {
  color: #14844f;
  background: #e4f6ec;
}

.step-button.current {
  color: #121a25;
  background: #f4c542;
  border-color: #f4c542;
}

.proof-panel img,
.order-preview-cell img,
.proof-thumb {
  border-color: #cdd6e3;
}

.material-note {
  border-left-color: #0f8b8d;
  background: #eefafa;
}

.note {
  border-left-color: #0f8b8d;
  background: #f3fbfb;
}

.dialog {
  border-radius: 8px;
}

.dialog-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

@media (max-width: 1040px) {
  .sidebar {
    min-height: auto;
    box-shadow: none;
  }

  .brand {
    min-height: auto;
    padding-bottom: 8px;
  }
}

@media (max-width: 720px) {
  body {
    overflow-x: hidden;
    background: #eef2f6;
  }

  .shell {
    display: block;
    min-width: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 0;
    padding: 10px 10px 8px;
    border-right: 0;
    border-bottom: 1px solid #273246;
    box-shadow: 0 10px 24px rgba(16, 24, 39, 0.16);
  }

  .brand {
    min-height: 0;
    gap: 10px;
    padding: 0 2px 8px;
    border-bottom: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex: 0 0 auto;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    margin-top: 2px;
    font-size: 11px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 4px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 88px;
    height: 38px;
    padding: 0 12px;
    text-align: center;
    white-space: nowrap;
  }

  .nav-item::before {
    left: 8px;
    top: 9px;
    height: 20px;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  .topbar {
    display: grid;
    gap: 10px;
    min-height: 0;
    margin-bottom: 12px;
    padding: 12px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    font-size: 13px;
    line-height: 1.55;
  }

  .user-box {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  #adminViewerButton {
    display: none !important;
  }

  .toolbar,
  .scanner-bar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .manual-shipping-form {
    grid-template-columns: 1fr;
  }

  .panel,
  .topbar,
  .task-lane,
  .detail-panel,
  .table-panel {
    border-radius: 8px;
  }

  .metrics,
  .stage-board,
  .my-task-board,
  .orders-layout,
  .workbench,
  .capacity-layout,
  .material-grid,
  .detail-grid,
  .design-file-grid,
  .proof-panel,
  .actual-quantity-row,
  .style-item-row,
  .style-items-row,
  .timeline,
  .bridge-grid,
  .form-grid,
  .material-form,
  .user-form,
  .file-form,
  .finance-summary,
  .finance-grid,
  .history-row,
  .woven-board,
  .materials-layout,
  .users-layout,
  .files-layout,
  .customers-layout {
    grid-template-columns: 1fr !important;
  }

  .my-task-board.single-lane {
    grid-template-columns: 1fr;
  }

  .detail-title {
    display: grid;
    gap: 10px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .detail-grid .field {
    min-height: 0;
    padding: 8px;
  }

  .detail-grid .field span {
    margin-bottom: 3px;
    font-size: 11px;
  }

  .detail-grid .field strong {
    font-size: 13px;
    line-height: 1.35;
  }

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

  .orders-layout .detail-panel {
    order: 1;
  }

  .orders-layout .table-panel {
    order: 2;
  }

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

  .proof-panel {
    padding: 12px;
  }

  .proof-panel img {
    max-height: 260px;
  }

  .mobile-detail-toggle {
    display: block;
    margin: 8px 0 12px;
  }

  .mobile-order-detail-more:not(.expanded) {
    display: none;
  }

  .mobile-order-detail-more.expanded {
    display: block;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    min-height: 36px;
    padding: 8px 10px;
    border-top: 1px solid #edf1f6;
  }

  td:first-child {
    border-top: 0;
  }

  td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  #ordersTable td:nth-child(1)::before { content: "订单"; }
  #ordersTable td:nth-child(2)::before { content: "预览"; }
  #ordersTable td:nth-child(3)::before { content: "数量"; }
  #ordersTable td:nth-child(4)::before { content: "材料"; }
  #ordersTable td:nth-child(5)::before { content: "工序"; }
  #ordersTable td:nth-child(6)::before { content: "交期"; }
  #ordersTable td:nth-child(7)::before { content: "备注"; }
  #ordersTable td:nth-child(8)::before { content: "操作"; }

  .order-preview-cell {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .order-preview-cell img {
    width: 56px;
    height: 56px;
  }

  .dialog {
    width: min(100vw - 16px, 720px);
    max-height: calc(100vh - 16px);
    padding: 14px;
  }

  .dialog form {
    max-height: calc(100vh - 44px);
    overflow: auto;
  }

  .style-item-row {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .style-items-row {
    gap: 4px;
  }

  .actual-style-quantity-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .actual-style-preview-block {
    width: 44px;
    min-width: 44px;
  }

  .actual-style-quantity-card input,
  .actual-style-quantity-card select {
    grid-column: 1 / -1;
  }

  .production-action-button,
  .actual-quantity-row input {
    min-height: 54px;
  }

  .feedback-mini-button {
    min-height: 38px;
    padding: 0 12px;
  }
}

/* 手机端防止页面被导航和宽内容撑出大小边 */
@media (max-width: 720px) {
  html,
  body,
  #app,
  .shell {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  body {
    position: relative;
  }

  .shell {
    display: block !important;
  }

  .sidebar,
  .main,
  .view,
  .panel,
  .topbar,
  .table-panel,
  .detail-panel,
  .task-lane,
  .customer-card,
  .feedback-alert,
  .feedback-item {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .sidebar {
    overflow: hidden !important;
  }

  .nav {
    width: 100% !important;
    max-width: calc(100vw - 20px) !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    flex: 0 0 auto !important;
    max-width: calc(100vw - 36px) !important;
  }

  .operation-log-item {
    grid-template-columns: 1fr;
  }

  .operation-log-item span {
    text-align: left;
  }

  .main {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .main > *,
  .panel > *,
  .topbar > * {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  img,
  canvas,
  video,
  iframe {
    max-width: 100% !important;
  }
}

/* Professional ERP visual system */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-muted: #eef3f8;
  --text: #172033;
  --muted: #6b7788;
  --line: #dbe3ee;
  --line-soft: #edf1f6;
  --accent: #0f8b8d;
  --accent-strong: #087577;
  --accent-soft: #e8f6f6;
  --warning-soft: #fff6dc;
  --danger-soft: #fff0ee;
  --shadow: 0 8px 24px rgba(19, 31, 48, 0.06);
  --shadow-soft: 0 2px 8px rgba(19, 31, 48, 0.04);
}

html,
body {
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  font-size: 14px;
  line-height: 1.48;
}

.mobile-erp-shell-lock,
html,
body,
#app,
.shell {
  max-width: 100vw;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

.shell {
  grid-template-columns: 228px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  padding: 18px 12px;
  gap: 18px;
  background: #111827;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.brand {
  min-height: 58px;
  gap: 10px;
  padding: 0 4px 14px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #f2c94c;
  box-shadow: none;
}

.brand strong {
  font-size: 15px;
  line-height: 1.25;
}

.brand span {
  margin-top: 2px;
  font-size: 11px;
  color: #96a3b7;
}

.nav {
  gap: 4px;
}

.nav-item {
  height: 38px;
  padding: 0 12px 0 16px;
  color: #b7c3d4;
  font-size: 13px;
  font-weight: 700;
}

.nav-item::before {
  left: 6px;
  top: 10px;
  width: 3px;
  height: 18px;
  background: transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: #223049;
  color: #ffffff;
}

.nav-item.active::before {
  background: #f2c94c;
}

.main {
  padding: 18px;
}

.topbar,
.content-strip,
.toolbar,
.scanner-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.topbar {
  min-height: 62px;
  margin-bottom: 10px;
  padding: 12px 14px;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 800;
}

.topbar p,
.panel-head span,
.scanner-bar span,
.form-hint,
.meta,
.subtle {
  color: var(--muted);
}

.user-box {
  gap: 8px;
}

.user-box span,
.top-operator {
  min-height: 32px;
  border-color: var(--line);
  background: var(--surface-soft);
}

.metrics {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.metric {
  min-height: 86px;
  padding: 14px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric::before {
  height: 3px;
  background: var(--accent);
}

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

.metric strong {
  margin-top: 8px;
  font-size: 24px;
}

.panel,
.bridge-item,
.metric {
  border-radius: 8px;
}

.panel {
  padding: 14px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel-head {
  min-height: 34px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2::before {
  width: 4px;
  height: 16px;
  background: var(--accent);
}

.panel-head span {
  font-size: 12px;
}

.toolbar,
.content-strip {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
  padding: 10px;
}

.toolbar label,
.scanner-bar label {
  min-width: 0;
}

.toolbar input,
.toolbar select,
.scanner-bar input,
input,
select,
textarea {
  border-color: var(--line);
  background: #ffffff;
}

.toolbar input,
.toolbar select,
.scanner-bar input {
  height: 38px;
}

.scanner-bar {
  margin: 0 0 10px;
  padding: 10px;
  background: var(--surface-soft);
}

.scanner-bar label {
  min-width: min(360px, 100%);
}

.my-tasks-panel {
  margin-bottom: 10px;
  background: #fbfdff;
}

.my-tasks-panel.collapsed {
  padding-top: 10px;
  padding-bottom: 10px;
}

.my-tasks-panel.collapsed .panel-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.orders-layout,
.orders-layout.compact-workflow {
  grid-template-columns: minmax(520px, 1.02fr) minmax(420px, 0.98fr);
  gap: 12px;
  align-items: start;
}

.orders-layout .table-panel,
.orders-layout .detail-panel {
  min-height: 0;
}

.detail-panel {
  position: sticky;
  top: 14px;
}

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
}

table {
  min-width: 820px;
  font-size: 13px;
}

th {
  height: 38px;
  padding: 9px 10px;
  background: var(--surface-soft);
  color: #556174;
  font-size: 12px;
}

td {
  padding: 9px 10px;
  border-bottom-color: var(--line-soft);
}

tbody tr:hover td,
tbody tr.selected td {
  background: #edfafa;
}

.order-no {
  max-width: 132px;
  font-size: 11px;
}

.status,
.platform,
.urgent-badge {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.task-lane,
.stage-column,
.field,
.proof-panel,
.design-file-panel,
.contract-label-panel,
.address-edit-panel,
.operation-log-panel,
.shipping-panel,
.swatch-panel,
.density-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.task-card,
.customer-card,
.feedback-alert,
.feedback-item,
.file-preview-row,
.material-card,
.quote-card,
.quote-rule-row,
.quote-cost-card,
.quote-image-card,
.density-card {
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.task-card {
  padding: 10px;
}

.task-card:hover,
.task-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.detail-grid {
  gap: 8px;
}

.detail-grid .field {
  min-height: 58px;
  padding: 9px 10px;
}

.detail-grid .field span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.detail-grid .field strong {
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.proof-panel {
  gap: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.proof-panel span {
  margin-top: 4px;
  line-height: 1.45;
}

.proof-panel img {
  max-height: min(64vh, 680px);
  border-radius: 6px;
}

.swatch-list,
.quote-image-swatches {
  gap: 8px;
}

.swatch-item,
.quote-image-swatch {
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 7px;
}

.swatch-color,
.quote-image-swatch i {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.primary-button,
.ghost-button,
.icon-button,
.step-button,
.copy-quote-button,
.feedback-mini-button {
  min-height: 34px;
  border-radius: 7px;
  font-size: 13px;
}

.primary-button {
  background: var(--accent);
  box-shadow: none;
}

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

.ghost-button,
.step-button {
  border-color: var(--line);
  background: var(--surface-soft);
}

.danger-button,
.step-button.danger-action,
.status.danger {
  background: var(--danger-soft);
}

.status.warning,
.material-shortage,
.urgent-badge {
  background: var(--warning-soft);
}

.quote-form {
  gap: 10px;
}

.quote-spec-control {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) 24px minmax(82px, 1fr) 42px;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.quote-spec-control input[type="number"] {
  min-width: 0;
  width: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quote-spec-symbol,
.quote-spec-unit {
  color: var(--text);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.quote-spec-symbol {
  font-size: 18px;
}

.quote-spec-unit {
  font-size: 13px;
}

.quote-choice-grid {
  gap: 8px;
}

.quote-choice-button,
.quote-form .quote-choice-button {
  min-height: 36px;
  border-radius: 7px;
  background: var(--surface);
}

.quote-choice-button.active {
  background: #2f3a4a;
  border-color: #2f3a4a;
}

.dialog {
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .orders-layout,
  .orders-layout.compact-workflow,
  .workbench,
  .materials-layout,
  .users-layout,
  .files-layout,
  .customers-layout,
  .ai-assistant-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden !important;
    touch-action: pan-y;
  }

  body {
    background: #f4f6f9;
    font-size: 13px;
  }

  /* iOS zooms the whole page when a focused control is below 16px. */
  input,
  select,
  textarea {
    min-width: 0;
    font-size: 16px !important;
    touch-action: manipulation;
  }

  .shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    padding: 8px 10px;
  }

  .brand {
    min-height: 42px;
    padding-bottom: 6px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand span {
    display: none;
  }

  .nav {
    display: flex;
    width: 100%;
    max-width: calc(100vw - 20px);
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 76px;
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
    scroll-snap-align: start;
  }

  .nav-item::before {
    display: none;
  }

  .main {
    padding: 10px;
  }

  .topbar {
    display: grid;
    min-height: 0;
    padding: 10px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .user-box {
    width: 100%;
    gap: 6px;
  }

  .user-box > *,
  .top-operator {
    max-width: 100%;
  }

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

  .metric {
    min-height: 72px;
    padding: 10px;
  }

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

  .panel {
    padding: 10px;
  }

  .panel-head {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .panel-head span {
    font-size: 11px;
    line-height: 1.35;
  }

  .toolbar,
  .content-strip,
  .scanner-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 9px;
  }

  .scanner-bar span {
    font-size: 11px;
  }

  .orders-layout,
  .orders-layout.compact-workflow {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .orders-layout .detail-panel {
    order: 1;
  }

  .orders-layout .table-panel {
    order: 2;
  }

  .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 13px;
  }

  tbody tr,
  .density-card {
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  td {
    grid-template-columns: 72px minmax(0, 1fr);
    min-height: 32px;
    padding: 7px 9px;
  }

  td::before {
    font-size: 11px;
  }

  .order-preview-cell img {
    width: 48px;
    height: 48px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px;
  }

  .detail-grid .field {
    padding: 8px;
  }

  .proof-panel img {
    max-height: 320px;
  }

  .manual-shipping-form,
  .actual-quantity-row,
  .style-item-row,
  .style-items-row,
  .form-grid,
  .material-form,
  .user-form,
  .file-form {
    grid-template-columns: 1fr !important;
  }

  .primary-button,
  .ghost-button,
  .step-button,
  .production-action-button,
  .actual-quantity-row input {
    min-height: 42px;
  }
}

@media print {
  body {
    background: #ffffff !important;
  }

  .production-ticket-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 8mm 6mm;
    align-items: start;
    break-inside: avoid;
  }

  .production-ticket-grid img {
    max-width: 100%;
    max-height: 86mm;
    object-fit: contain;
  }

  .production-ticket-meta {
    margin-top: 6mm;
    padding-top: 4mm;
    border-top: 1px solid #111827;
    font-size: 10pt;
    line-height: 1.35;
  }
}

/* Professional ERP visual system - stronger executive theme */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f7;
  --text: #111827;
  --muted: #667085;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --accent: #0e7c7b;
  --accent-strong: #0a6867;
  --accent-soft: #e7f6f5;
  --blue: #1f5eff;
  --teal: #0e7c7b;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 18px rgba(16, 24, 40, 0.04);
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.04);
}

body {
  background: #f5f7fa !important;
  color: var(--text);
}

.shell {
  grid-template-columns: 216px minmax(0, 1fr);
}

.sidebar {
  background: #0f172a;
  padding: 16px 10px;
}

.brand {
  margin: 0 2px 4px;
  padding: 0 4px 12px;
}

.brand-mark {
  background: #ffd84d;
  color: #0f172a;
}

.nav-item {
  height: 36px;
  border-radius: 7px;
  padding-left: 15px;
}

.nav-item.active {
  background: #263449;
}

.main {
  padding: 16px;
}

.topbar {
  min-height: 56px;
  border-color: var(--line);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.topbar h1 {
  font-size: 21px;
}

.panel,
.toolbar,
.scanner-bar,
.topbar,
.metric {
  box-shadow: var(--shadow-soft);
}

.panel {
  padding: 12px;
}

.panel-head {
  min-height: 30px;
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.panel-head h2 {
  font-size: 14px;
}

.panel-head h2::before {
  width: 3px;
  height: 14px;
}

.metric {
  min-height: 76px;
  padding: 12px;
}

.metric strong {
  font-size: 22px;
}

.toolbar,
.scanner-bar {
  padding: 9px 10px;
}

.my-tasks-panel.collapsed {
  border-color: #d6e4ee;
  background: #fbfdff;
}

.orders-layout,
.orders-layout.compact-workflow {
  grid-template-columns: minmax(540px, 1.08fr) minmax(430px, 0.92fr);
}

.table-panel .panel-head,
.detail-panel .panel-head {
  background: transparent;
}

.table-wrap {
  border-color: var(--line);
}

th {
  height: 36px;
  background: #f8fafc;
  color: #475467;
  letter-spacing: 0;
}

td {
  height: 54px;
}

tbody tr.selected td {
  background: #e8f7f6;
  box-shadow: inset 3px 0 0 var(--accent);
}

.inline-order-detail-row > td {
  height: auto;
  padding: 0 0 14px;
  white-space: normal;
  background: #f7fcfc;
  box-shadow: inset 3px 0 0 var(--accent);
}

.inline-order-detail-row:hover > td {
  background: #f7fcfc;
}

.inline-order-detail-row #inlineOrderDetail {
  padding: 12px 14px 16px;
}

.inline-order-detail-row .detail-title {
  margin-top: 0;
}

.detail-start-button {
  min-height: 38px;
  padding: 0 16px;
  white-space: nowrap;
}

.detail-panel {
  border-color: #cbd5e1;
}

.detail-title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.detail-grid .field {
  background: #ffffff;
}

.proof-panel {
  background: #ffffff;
}

.proof-panel img {
  background: #f8fafc;
}

.status {
  border: 1px solid rgba(14, 124, 123, 0.18);
}

.status.warning {
  border-color: rgba(180, 83, 9, 0.16);
}

.status.danger {
  border-color: rgba(185, 28, 28, 0.16);
}

.quote-card {
  background: #f8fafc;
}

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

  .sidebar {
    padding: 7px 9px;
  }

  .brand {
    min-height: 38px;
  }

  .main {
    padding: 8px;
  }

  .topbar,
  .panel,
  .toolbar,
  .scanner-bar {
    border-radius: 7px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .nav-item {
    height: 32px;
    min-width: 72px;
    border-radius: 7px;
  }

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

  .panel-head h2 {
    font-size: 14px;
  }

  tbody tr {
    border-color: #dbe3ee;
  }

  td {
    height: auto;
  }
}

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

.finance-trend-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #ffffff;
}

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

.finance-section-head h3,
.finance-breakdown-grid h3 {
  margin: 0;
  font-size: 14px;
}

.finance-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.finance-trend-chart {
  width: 100%;
  height: 168px;
  min-height: 0;
  overflow: hidden;
}

.finance-trend-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.finance-chart-grid line {
  stroke: #edf1f6;
  stroke-width: 1;
}

.finance-chart-grid text,
.finance-chart-axis text {
  fill: #667085;
  font-size: 11px;
}

.finance-chart-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.finance-chart-dots circle {
  fill: #ffffff;
  stroke: #2563eb;
  stroke-width: 1.8;
}

.finance-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.finance-breakdown-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.inventory-finance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.inventory-finance-card,
.inventory-finance-list {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.inventory-finance-card span,
.inventory-finance-card small,
.inventory-cost-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.inventory-finance-card strong {
  display: block;
  margin: 6px 0 3px;
  color: var(--ink);
  font-size: 22px;
}

.inventory-finance-card.warning strong {
  color: #b45309;
}

.inventory-finance-list b {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
}

.inventory-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid #e5eaf1;
}

.inventory-cost-row:first-of-type {
  border-top: 0;
}

.inventory-cost-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
}

.inventory-cost-row strong {
  grid-row: span 2;
  color: var(--ink);
  font-size: 13px;
}

.revenue-breakdown-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.revenue-breakdown-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  overflow: hidden;
  border: 1px solid #e5eaf1;
  border-radius: 8px;
  padding: 9px 10px 11px;
  background: #ffffff;
}

.revenue-breakdown-row span,
.revenue-breakdown-row strong,
.revenue-breakdown-row small {
  position: relative;
  z-index: 1;
}

.revenue-breakdown-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.revenue-breakdown-row strong {
  text-align: right;
}

.revenue-breakdown-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.revenue-breakdown-row i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #2563eb, #0e7c7b);
}

@media (max-width: 1180px) {
  .finance-summary-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 720px) {
  .finance-summary-wide,
  .finance-breakdown-grid,
  .inventory-finance-summary {
    grid-template-columns: 1fr;
  }

  .finance-trend-card {
    padding: 9px;
  }

  .finance-trend-chart {
    height: 150px;
    min-height: 0;
  }

  .finance-chart-grid text,
  .finance-chart-axis text {
    font-size: 10px;
  }
}

.desktop-order-id-cell {
  display: block;
}

.mobile-simple-order-card {
  display: none;
}

#ordersTable {
  border-collapse: separate;
  border-spacing: 0 10px;
}

#ordersTable tbody tr {
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 22px rgba(15, 23, 42, 0.05);
}

#ordersTable tbody tr td:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

#ordersTable tbody tr td:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

@media (max-width: 720px) {
  #ordersTable {
    border-spacing: 0;
    min-width: 0;
  }

  #ordersTable tbody {
    display: grid;
    gap: 14px;
  }

  #ordersTable tbody tr {
    margin: 0;
    border: 1px solid #dbe5ef;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    overflow: hidden;
  }

  #ordersTable td {
    min-height: 0;
  }

  #ordersTable td:not(:first-child) {
    display: none;
  }

  #ordersTable td:first-child {
    display: block;
    padding: 0;
    border: 0;
  }

  #ordersTable td:first-child::before {
    content: none;
  }

  .desktop-order-id-cell {
    display: none;
  }

  .mobile-simple-order-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #ffffff;
  }

  .mobile-simple-order-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  .mobile-simple-order-copy strong,
  .mobile-simple-order-copy span,
  .mobile-simple-order-copy small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-simple-order-copy strong {
    color: var(--ink);
    font-size: 15px;
  }

  .mobile-simple-order-copy span {
    color: #52657a;
    font-size: 13px;
  }

  .mobile-simple-order-copy small {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-simple-order-copy em {
    width: fit-content;
    border-radius: 999px;
    padding: 3px 8px;
    background: #eef8f7;
    color: #0e7c7b;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
  }

  .mobile-simple-order-card img {
    width: 104px;
    height: 78px;
    border: 1px solid #dbe5ef;
    border-radius: 10px;
    background: #f8fafc;
    object-fit: contain;
  }

  .mobile-order-card-action {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
  }

.mobile-order-card-action .list-start-button {
    min-height: 42px;
    width: 100%;
  }

  .print-task-order-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    min-height: 92px;
    border-radius: 14px;
    padding: 12px;
  }

  .print-task-main strong {
    font-size: 15px;
  }

  .print-task-main em,
  .print-task-order-row span,
  .print-task-order-row small {
    white-space: normal;
  }
}

@media (max-width: 720px) {
  .mobile-inline-production-override .style-items-row:not(.head) {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0;
    padding: 7px 8px;
  }

  .mobile-inline-production-override .style-items-row:not(.head) > span:not(:last-child) {
    display: none;
  }

  .mobile-inline-production-override .style-items-row:not(.head) > span:last-child {
    grid-column: 1 / -1;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card {
    grid-template-columns: 86px minmax(0, 1fr) 82px;
    grid-template-rows: auto 62px;
    gap: 6px 8px;
    padding: 7px;
    align-items: center;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card.without-roll-select {
    grid-template-columns: 86px minmax(0, 1fr) 82px;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-preview-block {
    grid-column: 1;
    grid-row: 2;
    width: 86px;
    min-width: 86px;
  }

  .mobile-inline-production-override .style-inline-production-cell .style-preview-thumb,
  .mobile-inline-production-override .style-inline-production-cell .actual-preview-placeholder {
    width: 38px;
    height: 58px;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-meta {
    grid-column: 1 / -1;
    grid-row: 1;
    display: grid;
    gap: 2px;
    min-width: 0;
    white-space: normal;
    line-height: 1.2;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-meta b,
  .mobile-inline-production-override .style-inline-production-cell .actual-style-meta small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-meta b {
    color: var(--ink);
    font-size: 15px;
    font-weight: 850;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-meta small {
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card input,
  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card select {
    grid-column: auto;
    grid-row: 2;
    min-height: 42px;
    padding: 0 6px;
    font-size: 14px;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card input {
    grid-column: 2;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card select {
    grid-column: 3;
  }

  .mobile-inline-production-override .style-inline-production-cell .actual-style-quantity-card.without-roll-select input {
    grid-column: 2 / -1;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row.head {
    display: none;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row:not(.head) {
    grid-template-columns: 128px repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 12px;
    align-items: start;
    padding: 14px;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(1) {
    grid-column: 1 / -1;
    font-size: 20px;
    font-weight: 900;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(2) {
    grid-column: 1;
    grid-row: 2 / span 4;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-preview-stack {
    display: grid;
    grid-template-columns: repeat(2, 58px);
    align-items: start;
    gap: 6px;
    min-width: 128px;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-preview-stack .style-preview-thumb {
    width: 58px;
    height: 78px;
    border-radius: 10px;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(n + 3) {
    display: grid;
    gap: 2px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 15px;
    font-weight: 850;
    color: var(--text);
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(n + 3)::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(3)::before { content: "尺寸"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(4)::before { content: "数量"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(5)::before { content: "材质"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(6)::before { content: "做法"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(7)::before { content: "印刷"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(8)::before { content: "用料"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(9)::before { content: "备注"; }
  .mobile-style-detail:not(.with-production-inputs) .style-items-row > span:nth-child(10)::before { content: "记录"; }

  .style-items-editor .style-item-row {
    min-width: 0;
    grid-template-columns: 76px repeat(2, minmax(0, 1fr)) !important;
  }

  .style-items-editor .style-editor-preview {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 68px;
    height: 86px;
  }
}

/* Keep all style fields visible in one row on desktop order entry. */
@media (min-width: 1100px) {
  #orderDialog {
    width: min(1320px, calc(100vw - 32px));
    max-width: none;
  }

  #orderDialog .style-items-editor .style-items-list {
    overflow-x: hidden;
  }

  #orderDialog .style-items-editor .style-item-row {
    min-width: 0;
    grid-template-columns:
      54px
      minmax(66px, 0.7fr)
      minmax(78px, 0.8fr)
      minmax(84px, 0.85fr)
      minmax(80px, 0.85fr)
      minmax(98px, 1.05fr)
      minmax(90px, 0.95fr)
      minmax(72px, 0.75fr)
      minmax(66px, 0.68fr)
      minmax(54px, 0.58fr)
      minmax(88px, 0.95fr)
      38px;
  }
}

/* Monthly settlement statements */
.monthly-statement-center {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #fff;
}

.monthly-statement-head,
.monthly-statement-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.monthly-statement-head h3,
.monthly-statement-preview-head strong {
  margin: 0;
  color: var(--ink);
}

.monthly-statement-head span,
.monthly-statement-preview-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.monthly-statement-head label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.monthly-statement-head input {
  width: 150px;
}

.monthly-statement-special {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-left: 3px solid #d99b26;
  background: #fff8e8;
  color: #765410;
  font-size: 13px;
}

.monthly-statement-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.62fr) minmax(0, 1.7fr);
  gap: 14px;
  margin-top: 14px;
}

.monthly-statement-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.monthly-statement-customer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 6px;
  border: 1px solid #dbe4ee;
  border-radius: 7px;
  background: #f8fafc;
}

.monthly-statement-customer.active {
  border-color: #7bc7c3;
  background: #edf9f8;
}

.monthly-statement-customer > button:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  min-width: 0;
  padding: 6px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.monthly-statement-customer span {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monthly-statement-customer small {
  grid-row: 2;
  color: var(--muted);
}

.monthly-statement-customer strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: #087f7b;
}

.monthly-statement-preview {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 7px;
}

.monthly-statement-table-wrap {
  overflow: auto;
  margin-top: 12px;
  border: 1px solid #e4eaf1;
}

.monthly-statement-table-wrap table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.monthly-statement-table-wrap th,
.monthly-statement-table-wrap td {
  padding: 9px 8px;
  border-bottom: 1px solid #e4eaf1;
  text-align: left;
  white-space: nowrap;
}

.monthly-statement-table-wrap th {
  background: #f4f7fa;
  color: var(--muted);
  font-size: 12px;
}

.monthly-statement-table-wrap tfoot td {
  border-bottom: 0;
  background: #f8fafc;
  font-weight: 800;
  text-align: right;
}

@media (max-width: 760px) {
  #ordersView .toolbar .mobile-hidden-order-control {
    display: none !important;
  }

  #ordersView .toolbar {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #ordersView .toolbar:has(> .primary-button[hidden]),
  #ordersView .toolbar:has(> .primary-button.is-hidden) {
    display: none;
  }

  .monthly-statement-center {
    padding: 12px;
  }

  .monthly-statement-head,
  .monthly-statement-preview-head {
    align-items: stretch;
    flex-direction: column;
  }

  .monthly-statement-head label {
    justify-content: space-between;
  }

  .monthly-statement-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .monthly-statement-customer {
    grid-template-columns: minmax(0, 1fr) 86px;
  }
}
.order-print-side-field {
  display: grid;
  gap: 8px;
  align-content: start;
  color: var(--muted);
  font-size: 14px;
}

.order-print-side-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7f9;
}

.order-print-side-toggle button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.order-print-side-toggle button.active {
  background: #ffffff;
  color: var(--teal);
  box-shadow: 0 1px 4px rgba(15, 118, 110, 0.16);
}
