:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe4ea;
  --line-strong: #c9d2dc;
  --text: #18202a;
  --muted: #667085;
  --navy: #0647a8;
  --blue: #2563eb;
  --teal: #0f766e;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --rose: #be123c;
  --ink: #273244;
  --shadow: 0 10px 30px rgba(27, 39, 55, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  color: var(--text);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ff7a1a, #0f6ce5);
  color: #fff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav button {
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #eaf2ff;
  color: #0957c3;
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: #f3f6fb;
  font-size: 12px;
  color: #536176;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.environment-mode-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.environment-sidebar-copy {
  min-width: 0;
}

.environment-mode-badge {
  max-width: 100%;
}

.environment-sidebar-foot .environment-mode-badge {
  white-space: normal;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 54px;
  background: linear-gradient(90deg, #063f9f, #075cc4);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #0d52ac;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 14px;
}

.topbar h2 {
  margin: 0;
  font-size: 18px;
  color: #fff;
}

.topbar .muted {
  color: #dbeafe;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.topbar-user-role {
  color: #dbeafe;
  font-size: 12px;
}

.content {
  padding: 14px 18px 28px;
}

.login-page {
  min-height: calc(100vh - 54px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px 48px;
}

.login-card {
  width: min(480px, 100%);
  padding: 28px 28px 24px;
}

.login-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.locale-switcher select {
  min-width: 176px;
}

.topbar-locale-switcher {
  flex: 0 0 auto;
}

.topbar-locale-switcher select {
  width: 132px;
  min-width: 132px;
  height: 34px;
}

.sync-status-bar {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  line-height: 1.5;
  font-size: 13px;
}

.sync-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.sync-status-detail,
.sync-status-note {
  color: var(--muted);
}

.sync-status-pending {
  background: #fff7ed;
  border-color: #fed7aa;
}

.sync-status-pending .sync-status-pill {
  background: #f59e0b;
  color: #fff;
}

.sync-status-saving {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.sync-status-saving .sync-status-pill {
  background: #2563eb;
  color: #fff;
}

.sync-status-saved {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.sync-status-saved .sync-status-pill {
  background: #16a34a;
  color: #fff;
}

.sync-status-error,
.sync-status-auth_failed {
  background: #fef2f2;
  border-color: #fecaca;
}

.sync-status-error .sync-status-pill,
.sync-status-auth_failed .sync-status-pill {
  background: #dc2626;
  color: #fff;
}

.sync-status-conflict {
  background: #fff1f2;
  border-color: #fecdd3;
}

.sync-status-conflict .sync-status-pill {
  background: #e11d48;
  color: #fff;
}

.sync-status-retrying {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.sync-status-retrying .sync-status-pill {
  background: #64748b;
  color: #fff;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 8px;
}

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

.login-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
  font-size: 13px;
  line-height: 1.6;
}

.login-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

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

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

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.section-title {
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-title h3 {
  margin: 0;
  font-size: 16px;
}

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

.small {
  font-size: 12px;
}

.kpi {
  padding: 16px;
  min-height: 116px;
}

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

.kpi .value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
}

.kpi .hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.production-factory-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.production-factory-stats .kpi {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 90px;
  padding: 10px 12px;
}

.production-factory-stats .kpi .label {
  font-size: 13px;
}

.production-factory-stats .kpi .value {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1.05;
}

.production-factory-stats .kpi .hint {
  margin-top: 6px;
  font-size: 11px;
}

.btn,
.ghost,
.danger,
.icon-btn {
  border-radius: 8px;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
}

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

.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

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

.icon-btn {
  width: 36px;
  padding: 0;
  background: #eef2f7;
  color: var(--ink);
}

.input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  color: var(--text);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

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

.style-detail-basic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.factory-process-capabilities-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.factory-process-capabilities-title {
  margin-bottom: 0;
}

.factory-process-capabilities-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.factory-process-capability-option {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text) !important;
  font-size: 14px !important;
  font-weight: 600;
  cursor: pointer;
}

.factory-process-capability-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.factory-process-capability-option span {
  color: inherit;
}

.search-combo {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.search-combo-value {
  border-radius: 8px 0 0 8px;
}

.search-combo-toggle {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
  color: var(--ink);
}

.search-combo-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(27, 39, 55, 0.14);
}

.search-combo.open .search-combo-menu {
  display: block;
}

.search-combo-search {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--text);
  background: #f8fafc;
}

.search-combo-options {
  margin-top: 7px;
  max-height: 196px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
}

.search-combo-options button {
  min-height: 32px;
  width: 100%;
  border-radius: 6px;
  padding: 6px 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-combo-options button:hover,
.search-combo-options button:focus {
  background: #eaf2ff;
  color: #0957c3;
}

.search-combo-empty {
  padding: 9px 8px;
  color: var(--muted);
  font-size: 12px;
}

.search-combo-add {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  border-radius: 6px;
  background: #f0f6ff;
  color: #0b57c2;
  font-weight: 700;
  text-align: left;
  padding: 7px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-combo-add:hover,
.search-combo-add:focus {
  background: #dbeafe;
}

.search-combo-add:disabled {
  background: #f8fafc;
  color: var(--muted);
}

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

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.tabs button {
  white-space: nowrap;
  border-radius: 8px;
  padding: 8px 12px;
  background: #e9edf3;
  color: var(--ink);
}

.tabs button.active {
  background: #dbeafe;
  color: #1d4ed8;
}

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

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

.production-process-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.production-process-stats {
  width: 240px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.production-process-stats-assigned {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.production-process-stats-active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.production-process-stats-waiting {
  border-color: #fcd34d;
  background: #fefce8;
  color: #a16207;
  box-shadow: inset 0 0 0 1px rgba(234, 179, 8, 0.14);
}

.production-process-stats-pending {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.12);
}

.production-process-stats-active .small.muted,
.production-process-stats-waiting .small.muted,
.production-process-stats-assigned .small.muted,
.production-process-stats-pending .small.muted {
  color: inherit;
  opacity: 0.78;
}

.production-process-stats-active strong,
.production-process-stats-waiting strong,
.production-process-stats-assigned strong,
.production-process-stats-pending strong {
  color: inherit;
}

.production-process-status-action {
  margin-top: 4px;
}

.production-process-status-btn {
  width: 100%;
}

.production-process-report-pane {
  min-width: 0;
}

.production-process-report-header {
  align-items: center;
  margin-bottom: 8px;
}

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

.production-process-actions .btn,
.production-process-actions .ghost {
  min-width: 92px;
}

.production-process-report-table {
  width: 100%;
  overflow-x: visible;
}

.production-process-report-table table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.production-process-report-table th,
.production-process-report-table td {
  padding: 9px 10px;
  line-height: 1.35;
}

.production-process-report-table th {
  text-align: center;
}

.production-process-report-table td {
  text-align: center;
}

.production-process-report-table th:first-child,
.production-process-report-table td:first-child {
  text-align: left;
}

.production-process-report-table th:nth-last-child(3),
.production-process-report-table td:nth-last-child(3) {
  font-weight: 800;
}

.production-process-report-table th:nth-last-child(2),
.production-process-report-table th:last-child,
.production-process-report-table td:nth-last-child(2),
.production-process-report-table td:last-child {
  text-align: center;
}

.production-process-report-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.production-process-report-value.total {
  font-weight: 800;
  color: var(--ink);
}

.production-process-report-value.abnormal {
  color: var(--red);
  font-weight: 800;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}

.production-detail-base-card {
  padding: 12px;
}

.production-detail-base-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}

.production-detail-base-item {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  display: grid;
  gap: 4px;
}

.production-detail-base-item strong {
  display: block;
  min-width: 0;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  background: #f1f4f8;
  color: #485568;
  font-weight: 700;
}

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

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.tag.gray {
  background: #eef2f7;
  color: #475569;
}

.tag.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.tag.green {
  background: #dcfce7;
  color: #166534;
}

.tag.amber {
  background: #fef3c7;
  color: #92400e;
}

.tag.orange {
  background: #ffedd5;
  color: #c2410c;
}

.tag.purple {
  background: #f3e8ff;
  color: #7c3aed;
}

.tag.red {
  background: #fee2e2;
  color: #991b1b;
}

.tag.rose {
  background: #ffe4e6;
  color: #be123c;
}

/* 允许投产订单左边框高亮 */
.lifecycle-allowed-to-produce {
  border-left-color: #f97316 !important;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.status-pending {
  background: #eef2f7;
  color: #475569;
}

.status-badge.status-ordering {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge.status-ordered-complete {
  background: #ffedd5;
  color: #c2410c;
}

.status-badge.status-arrived-complete {
  background: #dcfce7;
  color: #166534;
}

.status-badge.status-ordered-over {
  background: #fee2e2;
  color: #b91c1c;
}

.status-badge.status-arrived-over {
  background: #fce7f3;
  color: #9d174d;
}

.status-badge.status-stockout {
  background: #fee2e2;
  color: #b91c1c;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.progress.green span {
  background: var(--green);
}

.progress.amber span {
  background: var(--amber);
}

.progress.red span {
  background: var(--red);
}

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

.list {
  display: grid;
  gap: 10px;
}

.order-card {
  padding: 12px;
  border-left: 4px solid var(--blue);
}

.order-card.selected {
  outline: 2px solid #93c5fd;
}

.order-card h4 {
  margin: 0 0 8px;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

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

.factory-card {
  padding: 12px;
  border-top: 4px solid var(--teal);
}

.production-factory-board {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.production-factory-sidebar {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  padding: 12px;
  position: sticky;
  top: 84px;
  align-self: start;
}

.production-factory-type-list {
  display: grid;
  gap: 8px;
}

.production-factory-type-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  text-align: left;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
}

.production-factory-type-item.active {
  border-color: rgba(20, 184, 166, 0.35);
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.12), rgba(20, 184, 166, 0.04));
  color: #0f766e;
}

.production-factory-type-item.active .small,
.production-factory-type-item.active [aria-hidden="true"] {
  color: #0f766e;
}

.production-factory-type-name {
  font-weight: 700;
}

.production-factory-type-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.production-factory-main {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.compact-filter-view-switch {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-filter-view-switch .ghost {
  white-space: nowrap;
}

.production-factory-filter-shell .compact-filter-core {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.production-factory-filter-shell .compact-filter-search {
  grid-column: span 2;
}

.production-factory-filter-shell .compact-filter-field .input,
.production-factory-filter-shell .compact-filter-field select,
.production-factory-filter-shell .ghost {
  min-height: 40px;
}

.production-factory-filter-shell .compact-filter-field .input,
.production-factory-filter-shell .compact-filter-field select {
  padding: 8px 10px;
}

.production-factory-filter-shell .compact-filter-view-switch {
  min-height: 40px;
  align-items: center;
}

.production-factory-card {
  padding: 12px;
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  justify-self: stretch;
}

.production-factory-card-head,
.production-factory-card-actions,
.production-factory-card-id {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.production-factory-card-id {
  min-width: 0;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.production-factory-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.production-factory-card-actions {
  align-items: center;
  justify-content: flex-end;
  flex-direction: column;
  gap: 8px;
}

.production-factory-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.production-factory-card-order-count {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #0f62fe;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.production-factory-card-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid #d8e4f5;
  background: linear-gradient(160deg, #eff6ff, #e0f2fe);
  color: #0f766e;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-align: center;
}

.production-factory-card-heading {
  min-width: 0;
}

.production-factory-card-heading h4 {
  margin: 0 0 2px;
  font-size: 16px;
}

.production-factory-card-actions {
  align-items: center;
}

.production-factory-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.production-factory-card-progress {
  margin-top: 2px;
}

.production-factory-card-progress .progress,
.production-factory-order-progress .progress {
  height: 6px;
}

.production-factory-card-body {
  display: grid;
  gap: 10px;
}

.production-factory-card-section-title {
  margin-bottom: 0;
}

.production-factory-order-list {
  display: grid;
  gap: 8px;
}

.production-factory-order-item {
  margin: 0;
  padding: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  box-shadow: none;
}

.production-factory-order-item:hover {
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 8px 22px rgba(31, 44, 61, 0.06);
}

.production-factory-order-media {
  min-width: 0;
}

.production-factory-order-thumb {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}

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

.production-factory-order-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  font-size: 12px;
  font-weight: 700;
}

.production-factory-order-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.production-factory-order-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.production-factory-order-title {
  min-width: 0;
}

.production-factory-order-po {
  font-weight: 800;
}

.production-factory-order-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.production-factory-order-meta-item {
  display: grid;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
}

.production-factory-order-meta-item strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.production-factory-order-meta-rate {
  justify-items: end;
  text-align: right;
}

.production-factory-order-meta-rate strong {
  text-align: right;
}

.production-factory-order-progress {
  margin-top: 1px;
}

.production-factory-card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.production-factory-empty {
  padding: 18px 16px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: linear-gradient(180deg, #fafcff, #f8fafc);
  display: grid;
  gap: 4px;
  text-align: center;
}

.production-factory-empty-state {
  min-height: 220px;
  align-content: center;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  position: relative;
  padding: 12px 12px 12px 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 15px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--blue);
}

.timeline-item.done::before {
  background: var(--green);
}

.gantt {
  overflow: auto;
}

.gantt-grid {
  min-width: 860px;
  display: grid;
  grid-template-columns: 170px repeat(7, minmax(96px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.gantt-cell {
  min-height: 58px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}

.gantt-cell.head {
  min-height: 40px;
  background: #f1f4f8;
  font-weight: 700;
}

.task-pill {
  display: block;
  margin-top: 5px;
  border-radius: 6px;
  padding: 5px 6px;
  background: #dbeafe;
  color: #1e3a8a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-board {
  display: grid;
  gap: 12px;
}

.schedule-header,
.schedule-row {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.schedule-header-side,
.schedule-row-side,
.schedule-header-track,
.schedule-track {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.schedule-header-side,
.schedule-header-track {
  background: #f1f4f8;
  font-weight: 700;
}

.schedule-header-side,
.schedule-row-side {
  padding: 12px;
}

.schedule-header-track {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  overflow: hidden;
}

.schedule-header-track span {
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.schedule-header-track span:last-child {
  border-right: 0;
}

.schedule-side-stats {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  font-size: 12px;
}

.schedule-track {
  position: relative;
  min-height: 122px;
  overflow: hidden;
}

.schedule-track-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
}

.schedule-track-grid span {
  border-right: 1px solid var(--line);
}

.schedule-track-grid span:last-child {
  border-right: 0;
}

.schedule-track-grid span:nth-child(odd) {
  background: rgba(241, 245, 249, 0.45);
}

.schedule-bars {
  position: relative;
  z-index: 1;
  min-height: 122px;
  padding: 10px 8px;
}

.schedule-bar {
  position: absolute;
  min-height: 74px;
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  display: grid;
  align-content: center;
  gap: 4px;
  overflow: hidden;
}

.schedule-bar-content {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.schedule-bar-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.18);
  padding: 0;
  cursor: zoom-in;
}

.schedule-bar-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  display: block;
}

.schedule-bar-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  text-align: center;
}

.schedule-bar-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.schedule-bar.blue {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.schedule-bar.red {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.schedule-bar.rose {
  background: linear-gradient(135deg, #991b1b, #7f1d1d);
}

.schedule-bar-process {
  font-size: 11px;
  opacity: 0.92;
}

.schedule-bar-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.schedule-bar-meta {
  font-size: 12px;
  line-height: 1.2;
}

.color-swatch {
  width: 32px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  display: inline-block;
  vertical-align: middle;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.48);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
}

.info-modal {
  width: min(980px, 100%);
}

.purchase-allow-to-produce-modal {
  width: min(1216px, calc(100vw - 36px));
  max-width: min(1216px, calc(100vw - 36px));
}

@media (max-width: 768px) {
  .purchase-allow-to-produce-modal {
    width: min(calc(100vw - 24px), 100%);
    max-width: calc(100vw - 24px);
  }
}

.modal header,
.modal footer {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-body {
  padding: 16px;
}

.purchase-print-modal {
  width: min(980px, 92vw);
}

.purchase-print-modal .modal-body {
  padding: 14px 16px 12px;
}

.purchase-print-modal footer {
  padding: 12px 16px;
}

.purchase-print-settings {
  display: grid;
  gap: 10px;
}

.purchase-print-material-type-group {
  margin-bottom: 2px;
}

.print-field-groups {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

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

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

.print-field-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.print-field-group-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.print-field-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.print-field-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1;
  transition: all 0.15s ease;
}

.print-field-option.is-checked {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eff6ff;
  color: #0f4fb8;
}

.print-field-option input {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
  flex-shrink: 0;
}

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

.production-report-modal {
  width: min(1140px, 90vw);
}

.production-report-layout {
  display: grid;
  gap: 12px;
}

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

.production-report-summary-item {
  min-width: 0;
}

.production-report-summary-item strong,
.production-report-summary-meta strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.production-report-summary-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.production-report-confirmation-title-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.production-report-confirmation-title-stats .tag {
  white-space: nowrap;
}

.production-report-confirmation-form {
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.production-report-confirmation-form select,
.production-report-confirmation-form .input {
  max-width: 320px;
}

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

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

.production-report-remark {
  grid-column: 1 / -1;
}

.production-report-reference-table {
  width: 100%;
  overflow: auto;
}

.production-report-reference-grid {
  width: 100%;
  min-width: 100%;
  table-layout: auto;
}

.production-report-assortment-grid {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

.production-report-col-color {
  width: 120px;
}

.production-report-col-metric {
  width: 96px;
}

.production-report-col-size {
  width: 118px;
}

.production-report-col-total {
  width: 108px;
}

.production-report-assortment-grid th,
.production-report-assortment-grid td {
  text-align: center;
  vertical-align: middle;
}

.production-report-cell-label {
  font-weight: 700;
}

.production-report-cell-number,
.production-report-cell-total {
  font-variant-numeric: tabular-nums;
}

.production-report-cell-readonly {
  background: #f8fafc;
}

.production-report-cell-total strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.production-report-row-total-input {
  width: 100%;
  max-width: 96px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.production-report-cell-completed strong,
#productionReportReportedTotal {
  color: #15803d;
  font-weight: 800;
}

.production-report-cell-remaining strong,
#productionReportGrandRemaining {
  color: #c2410c;
  font-weight: 800;
}

.production-report-cell-remaining strong.negative,
#productionReportGrandRemaining.negative {
  color: var(--red);
}

.production-report-cell-input {
  padding: 8px 6px;
}

.production-report-size-editor,
.production-report-size-fill {
  display: grid;
  gap: 6px;
  justify-items: center;
}

.production-report-size-editor .input,
.production-report-size-fill .input {
  width: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.production-report-size-remaining {
  color: #c2410c;
  line-height: 1;
}

.production-report-size-remaining.negative {
  color: var(--red);
  font-weight: 700;
}

.production-report-size-error {
  min-height: 14px;
  color: #dc2626;
  line-height: 1;
}

.production-report-row-total-error {
  min-height: 14px;
  color: #dc2626;
  line-height: 1;
}

.dispatch-reference-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.dispatch-reference-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dispatch-reference-item > span {
  font-size: 12px;
  color: var(--muted);
}

.dispatch-reference-item strong {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.input.invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.1);
}

.readonly-input {
  background: #f8fafc;
  color: #64748b;
  cursor: default;
}

.image-upload-cell {
  min-height: 220px;
  border: 2px dashed #b9c7d8;
  border-radius: 8px;
  background: #f8fbff;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.image-upload-cell:hover,
.image-upload-cell.dragging {
  border-color: #2563eb;
  background: #eef6ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.image-upload-cell input[type="file"] {
  display: none;
}

.image-upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.image-preview-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 10px;
  padding: 12px;
  position: relative;
  z-index: 1;
}

.image-preview-item {
  position: relative;
  min-height: 154px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d7e2f0;
  background: #fff;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  min-height: 154px;
  object-fit: contain;
  display: block;
  padding: 6px;
}

.image-preview-item button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.material-archive-image-field {
  margin-top: 4px;
}

.material-archive-upload-cell {
  min-height: 220px;
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.material-archive-upload-cell:hover,
.material-archive-upload-cell.dragging {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.material-archive-upload-cell input[type="file"] {
  display: none;
}

.material-archive-upload-placeholder {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px;
  color: #475569;
  text-align: center;
}

.material-archive-upload-placeholder strong {
  font-size: 15px;
  color: #0f172a;
}

.material-archive-upload-placeholder span {
  font-size: 12px;
  color: #64748b;
}

.material-archive-upload-cell.has-images .material-archive-upload-placeholder {
  display: none;
}

.material-archive-image-grid {
  width: 100%;
  min-height: 220px;
  padding: 12px;
}

.material-image-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.material-image-strip.compact {
  gap: 8px;
}

.material-image-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #d7e2f0;
  background: #fff;
  flex: 0 0 auto;
}

.material-image-strip.compact .material-image-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

.material-image-open {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  padding: 0;
  cursor: zoom-in;
}

.material-image-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.material-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.supplier-material-dropzone {
  padding: 6px 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.supplier-material-dropzone.dragging {
  border-color: #2563eb;
  background: #eef6ff;
  color: #1d4ed8;
}

.factory-detail-modal .modal-body {
  max-height: min(72vh, 760px);
  overflow: auto;
}

.factory-doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.factory-doc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.factory-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.factory-doc-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
}

.factory-doc-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border: 1px solid #d7e2f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.factory-doc-thumb button:first-child {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  background: #fff;
  cursor: zoom-in;
}

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

.factory-doc-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

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

.factory-doc-dropzone {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  padding: 8px 10px;
  font-size: 12px;
  text-align: center;
}

.factory-doc-dropzone.dragging {
  border-color: #2563eb;
  background: #eef6ff;
  color: #1d4ed8;
}

.upload-placeholder {
  display: grid;
  gap: 6px;
  text-align: center;
  color: #536176;
  padding: 16px;
}

.upload-placeholder strong {
  color: #273244;
}

.upload-placeholder span {
  font-size: 12px;
}

.image-upload-cell.has-image .upload-placeholder {
  display: none;
}

.sample-image-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sample-upload-card {
  min-height: 172px;
  border: 2px dashed #b9c7d8;
  border-radius: 8px;
  background: #f8fbff;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sample-upload-card:hover,
.sample-upload-card.dragging {
  border-color: #2563eb;
  background: #eef6ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.sample-upload-card input[type="file"] {
  display: none;
}

.sample-upload-preview {
  height: 100%;
  min-height: 172px;
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
  padding: 10px;
  position: relative;
}

.sample-upload-preview strong {
  color: var(--ink);
}

.sample-upload-preview span {
  font-size: 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-upload-preview img {
  width: 100%;
  height: 124px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.sample-upload-preview button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.sample-file-icon {
  width: 68px;
  height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eaf2ff;
  color: #0b57c2;
  font-weight: 800;
  border: 1px solid #bfdbfe;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.notice {
  padding: 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.role-lock {
  color: var(--red);
  font-size: 12px;
}

.design-dev-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 8px 22px rgba(42, 54, 71, 0.06);
}

.design-dev-panel.standalone {
  margin-top: 0;
}

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

.dev-card {
  min-height: 96px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #dce5f0;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.dev-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
}

.dev-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  flex: 0 0 auto;
}

.dev-icon.purple {
  background: #8b5cf6;
}

.dev-icon.blue {
  background: #2563eb;
}

.dev-icon.orange {
  background: #f97316;
}

.dev-icon.teal {
  background: #0f766e;
}

.dev-card strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.dev-card em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-weight: 800;
  color: #475467;
}

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

.dev-pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.dev-standalone-body {
  display: grid;
  grid-template-columns: minmax(360px, 0.86fr) minmax(620px, 1.14fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.dev-mini-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.design-style-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.design-style-card {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 16px;
  padding: 12px;
  border: 1px solid #dce5f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  min-height: 178px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.design-style-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.design-style-image {
  border-radius: 8px;
  overflow: hidden;
  background: #f8fbff;
  border: 1px solid #dbe7f5;
  cursor: zoom-in;
}

.design-style-image img {
  width: 100%;
  height: 100%;
  min-height: 154px;
  object-fit: cover;
  display: block;
}

.design-style-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.style-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.style-card-head strong {
  font-size: 20px;
}

.design-style-info h4 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.style-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.style-usage-field {
  max-width: 220px;
  display: inline-grid;
  grid-template-columns: auto minmax(72px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.style-usage-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.style-usage-field strong {
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-detail {
  display: grid;
  gap: 14px;
}

.style-detail-modal,
.design-style-modal {
  width: min(1300px, 92vw);
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
}

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

.style-detail-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.style-detail-head strong {
  font-size: 22px;
}

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

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

.style-detail-media {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
}

.style-technical-modal {
  width: min(1400px, 94vw);
  max-width: 94vw;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.style-print-options-modal {
  width: min(1180px, 92vw);
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.style-print-preview-modal {
  width: min(1200px, 94vw);
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.style-print-preview-modal header,
.style-print-preview-modal footer {
  flex: 0 0 auto;
}

.style-print-options-body,
.style-print-preview-body {
  display: grid;
  gap: 14px;
}

.style-print-preview-body,
.style-print-preview-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 6px;
}

.style-print-summary {
  display: grid;
  gap: 6px;
}

.style-print-options-grid {
  display: grid;
  gap: 12px;
}

.style-print-template-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.style-print-template-legend {
  width: 100%;
  padding: 0;
  margin-bottom: 10px;
  font-weight: 800;
}

.style-print-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 12px;
}

.style-print-template-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.style-print-preset-card {
  display: grid;
  gap: 8px;
}

.style-print-preset-field {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.style-print-preset-select {
  width: min(320px, 100%);
}

.style-print-option-category {
  display: grid;
  gap: 10px;
}

.style-print-option-category-title {
  font-weight: 900;
  color: #0f172a;
  margin-top: 4px;
}

.style-print-option-category-body {
  display: grid;
  gap: 12px;
}

.style-print-option-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.style-print-option-group-legend {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  padding: 0;
  margin-bottom: 10px;
  font-weight: 800;
}

.style-print-group-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.style-print-group-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.style-print-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px 12px;
}

.style-print-option-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.style-print-page {
  display: grid;
  gap: 14px;
  font-size: 13px;
  color: #0f172a;
}

.style-print-section,
.style-print-subsection {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  break-inside: auto;
  page-break-inside: auto;
}

.style-print-section {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.style-print-card {
  break-inside: avoid;
}

.style-print-cover.style-print-card .style-print-section-body {
  padding: 8px 10px 10px;
}

.style-print-title-section {
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fbff, #fff);
}

.style-print-title-main {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
}

.style-print-title-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.style-print-title-meta {
  margin-top: 4px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.style-print-section-title,
.style-print-subsection-title {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 900;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.style-print-section-body,
.style-print-subsection-body {
  padding: 12px 14px 14px;
}

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

.style-print-kv-item {
  display: grid;
  gap: 3px;
}

.style-print-kv-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.style-print-kv-value {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.style-print-table {
  width: 100%;
  border-collapse: collapse;
}

.style-print-table thead {
  display: table-header-group;
}

.style-print-table th,
.style-print-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.style-print-table th {
  background: #f8fafc;
  font-weight: 900;
}

.style-print-note {
  white-space: pre-wrap;
  line-height: 1.6;
}

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

.style-print-image-grid.single,
.style-print-image-grid--cover {
  grid-template-columns: minmax(0, 1fr);
}

.style-print-image-grid--process,
.style-print-image-grid--thumbnail {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.style-print-image-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
  break-inside: avoid;
}

.style-print-image-card--cover {
  max-width: 145px;
  margin: 0 auto;
  justify-items: center;
  padding: 6px;
  gap: 6px;
}

.style-print-image-card--cover img {
  width: 145px;
  max-width: 145px;
  max-height: 145px;
  height: auto;
  display: block;
  border-radius: 10px;
  object-fit: contain;
}

.style-print-image-card--gallery img,
.style-print-image-card--thumbnail img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  object-fit: cover;
}

.style-print-image-card--process {
  max-width: 180px;
}

.style-print-image-card--process img {
  width: 180px;
  max-width: 180px;
  object-fit: contain;
}

.style-print-image-card--thumbnail {
  max-width: 180px;
}

.style-print-image-card--thumbnail img {
  width: 180px;
  max-width: 180px;
  object-fit: contain;
}

.style-print-cover-page {
  display: grid;
  gap: 6px;
}

.style-print-cover-head {
  display: grid;
  gap: 0;
}

.style-print-cover-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 145px;
  gap: 10px;
  align-items: start;
}

.style-print-cover-meta {
  display: grid;
  gap: 4px;
  align-content: start;
}

.style-print-cover-meta .style-print-kv-grid {
  gap: 4px 12px;
}

.style-print-cover-image-wrap {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.style-print-process-sheet {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  break-inside: avoid;
}

.style-print-process-sheet-title {
  font-size: 14px;
  font-weight: 800;
}

.style-print-process-sheet-desc {
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.6;
}

.style-tech-modal-body {
  display: grid;
  gap: 14px;
}

.style-tech-header {
  display: grid;
  gap: 8px;
}

.style-tech-header-title {
  font-size: 18px;
  font-weight: 800;
}

.style-tech-header-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.style-tech-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
}

.style-tech-panels {
  display: grid;
  gap: 14px;
}

.style-tech-table {
  width: 100%;
  table-layout: fixed;
}

.style-tech-size-table th:first-child,
.style-tech-size-table td:first-child {
  width: 210px;
}

.style-tech-size-table th:nth-child(2),
.style-tech-size-table td:nth-child(2),
.style-tech-size-table th:nth-child(3),
.style-tech-size-table td:nth-child(3),
.style-tech-size-table th:nth-child(4),
.style-tech-size-table td:nth-child(4),
.style-tech-size-table th:nth-child(5),
.style-tech-size-table td:nth-child(5) {
  width: 88px;
}

.style-tech-size-table th:nth-child(6),
.style-tech-size-table td:nth-child(6) {
  width: 150px;
}

.style-tech-size-table th:nth-child(7),
.style-tech-size-table td:nth-child(7) {
  width: 92px;
}

.style-tech-table th,
.style-tech-table td {
  vertical-align: top;
}

.style-tech-actions {
  white-space: nowrap;
}

.style-tech-row-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
}

.style-tech-row-head label {
  flex: 1 1 360px;
  min-width: 0;
}

.style-tech-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.style-tech-process-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.2fr);
  gap: 12px;
  align-items: start;
  margin-top: 10px;
}

.style-tech-process-description textarea {
  min-height: 96px;
}

.style-tech-process-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 88px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.style-tech-mini-card {
  width: 96px;
  display: grid;
  gap: 6px;
  justify-items: center;
}

.style-tech-mini-preview,
.style-tech-image-preview {
  padding: 0;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: 12px;
}

.style-tech-mini-preview img,
.style-tech-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.style-tech-mini-name {
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

.style-tech-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.style-tech-image-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

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

.style-detail-block h4,
.detail-row-title h4 {
  margin: 0;
  font-size: 14px;
}

.detail-row-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detail-design-upload {
  width: min(360px, 100%);
  min-height: 132px;
}

.detail-design-upload .sample-upload-preview {
  min-height: 132px;
}

.detail-design-upload .sample-upload-preview img {
  height: 86px;
}

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

.cost-param-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.cost-param-grid label {
  min-width: 0;
}

.cost-param-grid .input {
  min-height: 34px;
}

.computed-cost {
  background: #f3f6fb;
  font-weight: 800;
}

.readonly-price {
  background: #f3f6fb;
  font-weight: 800;
}

.field-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.material-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(95px, 0.75fr) minmax(110px, 0.85fr) minmax(120px, 0.9fr) minmax(120px, 0.9fr) 36px;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bom-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.bom-color-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.bom-color-toggle.is-on {
  color: #065f46;
  background: #d1fae5;
  border-color: #a7f3d0;
}

.bom-color-toggle.is-off {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.bom-row-delete {
  min-height: 34px;
  padding: 0 12px;
}

.design-style-modal .material-list {
  gap: 12px;
}

.design-style-modal .bom-detail-row {
  grid-template-columns:
    minmax(300px, 2.3fr)
    minmax(130px, 1fr)
    minmax(110px, 0.8fr)
    minmax(120px, 0.8fr)
    minmax(140px, 0.95fr)
    minmax(140px, 0.95fr)
    minmax(170px, 1fr);
}

.design-style-modal .bom-detail-row .search-combo,
.design-style-modal .bom-detail-row label {
  width: 100%;
}

.design-style-modal .bom-detail-row .input,
.design-style-modal .bom-detail-row select {
  width: 100%;
}

.material-row label,
.material-row .search-combo {
  min-width: 0;
}

.material-row .input,
.material-row select {
  min-height: 34px;
}

.sample-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.sample-flow-upload {
  min-width: 0;
  border: 1px dashed #b9c7d8;
  border-radius: 8px;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sample-flow-upload:hover,
.sample-flow-upload:focus,
.sample-flow-upload.dragging {
  border-color: #2563eb;
  background: #eef6ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08);
  outline: none;
}

.sample-flow-upload input[type="file"] {
  display: none;
}

.sample-flow-item {
  position: relative;
  min-height: 76px;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  display: grid;
  grid-template-rows: minmax(42px, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
  padding: 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.sample-flow-item.done {
  background: transparent;
}

.sample-flow-item img {
  width: 100%;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
  cursor: zoom-in;
}

.sample-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

.sample-delete-btn:hover,
.sample-delete-btn:focus {
  background: #b91c1c;
}

.sample-flow-item span {
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-flow-item strong {
  font-size: 11px;
  color: var(--ink);
}

.sample-flow-hint {
  display: block;
  padding: 0 6px 7px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview-backdrop {
  z-index: 1200;
  background: rgba(15, 23, 42, 0.72);
}

.image-preview-modal {
  width: min(760px, 90vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.image-preview-modal header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-preview-modal h3 {
  margin: 0;
  font-size: 16px;
}

.image-preview-body {
  padding: 14px;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #f8fafc;
}

.image-preview-body img {
  max-width: min(600px, 100%);
  max-height: calc(90vh - 88px);
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.purchase-proof-thumb-invalid {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.purchase-proof-thumb-invalid.is-compact {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  margin: auto;
  padding: 2px 4px;
  border-radius: 7px;
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  line-height: 1.2;
  flex: 0 0 auto;
}

.production-voucher-summary {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  margin-bottom: 12px;
}

.production-voucher-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.production-voucher-summary-head span {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.production-voucher-summary-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.production-voucher-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 12px;
  overflow-x: auto;
  align-items: stretch;
  padding-bottom: 4px;
}

.production-voucher-card {
  min-width: 180px;
  max-width: 220px;
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.production-voucher-card.dragging {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.production-voucher-card.is-completed {
  border-color: #16a34a;
}

.production-voucher-card-head,
.production-voucher-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.production-voucher-completed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
  user-select: none;
  cursor: pointer;
}

.production-voucher-completed-toggle input {
  accent-color: var(--green);
}

.production-voucher-completed-toggle.is-completed {
  color: var(--green);
  font-weight: 700;
}

.production-voucher-thumb-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.production-voucher-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.production-voucher-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.production-voucher-thumb-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
}

.production-voucher-upload-zone,
.production-voucher-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
}

.production-voucher-upload-zone span,
.production-voucher-empty span {
  font-weight: 700;
  color: #0f172a;
}

.production-voucher-upload-zone small,
.production-voucher-empty small,
.production-voucher-foot {
  color: #64748b;
  line-height: 1.4;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    overflow: visible !important;
  }

  body > * {
    display: none !important;
  }

  #stylePrintRoot {
    display: block !important;
    position: static !important;
    inset: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    overflow: visible !important;
    max-width: none !important;
    width: auto !important;
  }

  #stylePrintRoot .style-print-preview-body,
  #stylePrintRoot .style-print-preview-scroll {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    width: auto !important;
    min-height: 0 !important;
  }

  #stylePrintRoot .style-print-preview-modal {
    width: 100% !important;
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
    box-shadow: none !important;
    position: static !important;
    inset: auto !important;
    margin: 0 !important;
  }

  #stylePrintRoot .style-print-preview-modal header,
  #stylePrintRoot .style-print-preview-modal footer,
  #stylePrintRoot .style-print-preview-modal * {
    visibility: visible;
  }

  .modal-backdrop {
    position: static;
    inset: auto;
    padding: 0;
    background: #fff;
    display: block;
  }

  .style-print-preview-modal header,
  .style-print-preview-modal footer,
  .style-print-options-modal,
  .sample-delete-btn,
  .detail-row-title button,
  .style-detail-head button {
    display: none;
  }

  .style-print-preview-backdrop {
    background: #fff;
    padding: 0;
  }

  .style-print-preview-body,
  .style-print-preview-scroll {
    padding: 0;
    overflow: visible !important;
    max-height: none !important;
  }

  .style-print-page {
    width: auto;
    min-height: 0 !important;
    height: auto !important;
    margin: 0;
    padding: 0;
    break-after: auto;
  }

  .style-print-section,
  .style-print-subsection {
    break-before: auto;
    page-break-before: auto;
    break-after: auto;
    page-break-after: auto;
    break-inside: auto;
    page-break-inside: auto;
    overflow: visible;
  }

  .style-print-card,
  .style-print-process-sheet,
  .style-print-image-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.dev-mini-panel .table-wrap table {
  min-width: 620px;
}

.dev-mini-panel th,
.dev-mini-panel td {
  padding: 10px 12px;
}

.pipeline-step {
  min-height: 38px;
  border-radius: 8px;
  background: #eef2f7;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.pipeline-step span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.pipeline-step.done {
  background: #e8f1ff;
  color: #0b57c2;
}

.pipeline-step.done span {
  background: #2563eb;
}

.home-filter {
  display: grid;
  grid-template-columns: 110px 150px minmax(220px, 1fr) 170px 150px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  box-shadow: none;
}

.sticky-filter-panel {
  position: sticky;
  top: 62px;
  z-index: 8;
  padding: 10px 12px;
}

.compact-filter {
  display: grid;
  gap: 8px;
}

.compact-filter-core {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(130px, 0.9fr)) auto auto auto;
  gap: 8px;
  align-items: end;
}

.compact-filter-advanced {
  display: none;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

.compact-filter-advanced.open {
  display: grid;
}

.compact-filter-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #475467;
  font-weight: 700;
}

.compact-filter-field .input,
.compact-filter-field select {
  min-height: 34px;
  padding: 6px 9px;
}

.compact-filter-search {
  min-width: 0;
}

.compact-filter-toggle {
  white-space: nowrap;
}

.home-filter label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #475467;
  font-weight: 700;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
}

.field-search {
  grid-template-columns: 130px minmax(0, 1fr) 38px;
}

.field-search select {
  border-radius: 8px 0 0 8px;
  border-right: 0;
}

.search-box input {
  border-radius: 8px 0 0 8px;
}

.field-search input {
  border-radius: 0;
}

.search-box button {
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
  color: var(--ink);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.home-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.home-kpi {
  min-height: 108px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 22px rgba(42, 54, 71, 0.06);
  width: 100%;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.home-kpi:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

.home-kpi.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12), 0 12px 28px rgba(37, 99, 235, 0.12);
}

.home-kpi .label {
  color: #536176;
  font-size: 13px;
  font-weight: 700;
}

.home-kpi .value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
}

.home-kpi .hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  flex: 0 0 auto;
}

.kpi-icon.purple {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.kpi-icon.blue {
  background: linear-gradient(135deg, #0f6ce5, #2563eb);
}

.kpi-icon.teal {
  background: linear-gradient(135deg, #0891b2, #0f766e);
}

.kpi-icon.orange {
  background: linear-gradient(135deg, #f97316, #fb923c);
}

.kpi-icon.red {
  background: linear-gradient(135deg, #dc2626, #f43f5e);
}

.home-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 14px;
}

.home-left {
  display: grid;
  align-content: start;
  gap: 12px;
}

.dashboard-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(42, 54, 71, 0.05);
}

.group-head {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background: #fff;
  color: #273244;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.group-row {
  width: 100%;
  min-height: 36px;
  padding: 0 14px 0 28px;
  background: #fff;
  color: #59677a;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  text-align: left;
  font-size: 13px;
  position: relative;
}

.group-row::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2f6edb;
  position: absolute;
  left: 16px;
}

.group-row:hover,
.group-row.active {
  background: #f0f6ff;
  color: #0b57c2;
}

.group-row strong {
  color: #667db3;
  font-size: 12px;
  white-space: nowrap;
}

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

.home-section-title {
  background: transparent;
  margin: 2px 0 12px;
}

.active-view {
  background: #e8f1ff;
  color: #0957c3;
  border-color: #bfdbfe;
  font-weight: 800;
}

.production-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.completed-title {
  margin-top: 22px;
}

.completed-grid .production-order-card {
  opacity: 0.92;
}

.production-order-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(31, 44, 61, 0.08);
  min-width: 0;
}

.production-order-card.red {
  border-top-color: var(--red);
}

.production-order-card.amber {
  border-top-color: #f59e0b;
}

.production-order-card.blue {
  border-top-color: var(--blue);
}

.production-order-card.teal {
  border-top-color: #14b8a6;
}

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

.order-no {
  font-size: 12px;
  font-weight: 800;
  color: #111827;
}

.erp-card-heading {
  display: grid;
  gap: 3px;
}

.erp-card-code {
  font-size: 13px;
  font-weight: 800;
  color: #273244;
}

.erp-card-color {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: #666;
  white-space: normal;
  word-break: break-word;
}

.erp-card-body {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.garment-photo {
  width: 64px;
  min-height: 78px;
  border-radius: 8px;
  background: linear-gradient(160deg, #f8fbff, #e7eef8);
  border: 1px solid #d8e4f5;
  overflow: hidden;
}

.garment-photo img,
.order-style-photo-trigger img {
  width: 100%;
  height: 100%;
  min-height: 78px;
  object-fit: cover;
  display: block;
}

.order-style-photo-trigger {
  width: 100%;
  height: 100%;
  min-height: 78px;
  padding: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  cursor: zoom-in;
}

.order-style-photo-placeholder {
  width: 100%;
  min-height: 78px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.erp-card-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.erp-card-metric {
  display: grid;
  gap: 2px;
  font-size: 12px;
  color: #64748b;
}

.erp-card-metric strong {
  color: #1f2937;
  line-height: 1.3;
}

.erp-card-metric-wide {
  grid-column: 1 / -1;
}

.erp-card-stage-row,
.erp-card-next,
.erp-card-footer {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.erp-card-stage-row span,
.erp-card-next span {
  color: #64748b;
}

.erp-card-stage-row strong,
.erp-card-next strong {
  color: #273244;
}

.erp-flow-line {
  margin-top: 10px;
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.erp-flow-step {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  align-content: center;
}

.erp-flow-step strong {
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.erp-flow-step span {
  font-size: 10px;
  color: #64748b;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.erp-flow-step.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.erp-flow-step.green strong {
  color: #166534;
}

.erp-flow-step.blue {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.erp-flow-step.blue strong {
  color: #1d4ed8;
}

.erp-flow-step.teal {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.erp-flow-step.teal strong {
  color: #0f766e;
}

.erp-flow-step.red {
  border-color: #fecdd3;
  background: #fff1f2;
}

.erp-flow-step.red strong {
  color: #be123c;
}

.erp-flow-step.gray strong {
  color: #64748b;
}

.erp-flow-arrow {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 12px;
}

.card-alert {
  margin-top: 10px;
  border-radius: 8px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}

.erp-card-alert {
  margin-top: 9px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 700;
}

.erp-card-finance {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.erp-card-finance.green {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.erp-card-finance.amber {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.erp-card-finance.red {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.card-actions button {
  min-height: 28px;
  background: transparent;
  color: #0b57c2;
  font-weight: 800;
  font-size: 12px;
  padding: 0;
}

.card-actions button:hover {
  text-decoration: underline;
}

@media (max-width: 1360px) {
  .dev-standalone-body {
    grid-template-columns: 1fr;
  }

  .design-style-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

@media (max-width: 1080px) {
  .sticky-filter-panel {
    top: 58px;
  }

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

  .compact-filter-search {
    grid-column: 1 / -1;
  }

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

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .cols-4,
  .cols-3,
  .cols-2,
  .split,
  .home-layout,
  .home-filter,
  .dev-grid,
  .dev-pipeline,
  .dev-standalone-body,
  .design-style-grid {
    grid-template-columns: 1fr;
  }

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

  .production-factory-filter-shell .compact-filter-core {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .production-factory-filter-shell .compact-filter-search {
    grid-column: 1 / -1;
  }

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

  .production-factory-sidebar {
    position: static;
    top: auto;
  }

  .production-factory-card-metrics,
  .production-factory-order-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

  .production-factory-card {
    max-width: none;
  }

}

@media (min-width: 1600px) {
  .production-factory-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) {
  .production-report-summary-grid,
  .production-report-summary-meta,
  .production-report-form-grid {
    grid-template-columns: 1fr;
  }

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

  .production-process-stats {
    width: 100%;
  }

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

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

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

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

@media (max-width: 640px) {
  .production-detail-base-grid {
    grid-template-columns: 1fr;
  }

  .production-factory-filter-shell .compact-filter-core {
    grid-template-columns: 1fr;
  }

  .production-factory-filter-shell .compact-filter-search {
    grid-column: auto;
  }

  .compact-filter-core,
  .compact-filter-advanced {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .content {
    padding: 14px;
  }

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

  .style-print-cover-layout {
    grid-template-columns: 1fr;
  }

  .style-print-cover-image-wrap {
    justify-content: flex-start;
  }

  .home-kpis,
  .production-card-grid,
  .production-factory-board,
  .erp-card-body,
  .design-style-grid,
  .design-style-card,
  .modal-card-grid,
  .sample-image-grid {
    grid-template-columns: 1fr;
  }

  .production-factory-card-head,
  .production-factory-card-actions,
  .production-factory-card-id,
  .production-factory-order-item,
  .production-factory-order-head {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .production-factory-card-metrics,
  .production-factory-order-meta {
    grid-template-columns: 1fr;
  }

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

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

  .trim-row,
  .material-row,
  .cost-param-grid {
    grid-template-columns: 1fr;
  }

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

  .style-detail-basic-grid {
    grid-template-columns: 1fr;
  }

  .style-tech-row-head,
  .style-tech-summary,
  .style-tech-header-meta {
    gap: 10px;
  }

  .garment-photo {
    width: 80px;
    justify-self: start;
  }

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

  .erp-card-metric-wide {
    grid-column: auto;
  }

  .erp-flow-line {
    flex-wrap: wrap;
  }

  .span-2 {
    grid-column: span 1;
  }
}

/* ─── Factory Production Monitor: modern card system ─── */
.fm-stat-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  margin-bottom: 14px;
}

.fm-stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fm-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.fm-stat-label {
  font-size: 12px;
  color: var(--muted);
}

.fm-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.fm-stat-unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.fm-order-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

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

.fm-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
}

.fm-progress-bar-track {
  background: #e5e7eb;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin: 4px 0 6px;
}

.fm-progress-bar-fill {
  background: #2563eb;
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s;
}

.fm-entry-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

/* Tabs: more prominent active state */
.tabs button.active {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.tabs button:hover:not(.active) {
  background: #d1d9e4;
}

@media (max-width: 900px) {
  .fm-stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .fm-order-layout {
    grid-template-columns: 1fr;
  }
}
