/* workshop-pc 样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --primary-light: #e6f7ff;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #f5222d;
  --text: #333;
  --text-secondary: #888;
  --border: #f0f0f0;
  --bg: #f5f7fa;
  --sidebar-width: 200px;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.06);
  --card-radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* 登录页 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  width: 380px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary);
  font-size: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

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

.btn-block {
  display: block;
  width: 100%;
}

.btn-success { background: var(--success); }
.btn-success:hover { background: #389e0d; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #d48806; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #cf1322; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; }

/* 后台布局 */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 8px rgba(0,0,0,0.03);
}

.sidebar-header {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 16px;
  color: var(--primary);
}

.sidebar-menu {
  padding: 10px 0;
}

.menu-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--text);
  transition: all 0.2s;
  font-size: 13px;
}

.menu-item:hover {
  background: #f0f0f0;
}

.menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-right: 3px solid var(--primary);
  font-weight: 500;
}

.menu-item .icon {
  margin-right: 10px;
  font-size: 16px;
}

.menu-item .arrow {
  margin-left: auto;
  transition: transform 0.3s;
}

.menu-item.collapsed .arrow {
  transform: rotate(-90deg);
}

.submenu {
  display: none;
  background: #fafafa;
}

.submenu.show {
  display: block;
}

.submenu-item {
  padding: 8px 16px 8px 42px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

.submenu-item:hover,
.submenu-item.active {
  color: var(--primary);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.header {
  background: #fff;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  padding: 20px;
}

/* 卡片 */
.card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

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

/* 表格 */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

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

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

th {
  background: #f7f8fa;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  color: #333;
  font-size: 13px;
}

tr:hover {
  background: #f0f5ff;
}

/* 搜索栏 */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.search-bar input {
  flex: 1;
  min-width: 200px;
}

.search-bar select {
  min-width: 150px;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-primary { background: #e6f7ff; color: #1890ff; }
.tag-success { background: #f6ffed; color: #52c41a; }
.tag-warning { background: #fffbe6; color: #faad14; }
.tag-danger { background: #fff1f0; color: #f5222d; }
.tag-default { background: #f5f5f5; color: #666; }

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .label {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary);
}

.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }

/* 模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 90%;
  max-width: 640px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

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

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* 表单 */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

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

textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* 操作按钮 */
.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  padding: 4px 8px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
}

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

.actions button.danger {
  color: var(--danger);
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* 工具栏 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 响应式 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* 图片画廊 */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.photo-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.photo-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.photo-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.photo-name {
  padding: 8px;
  font-size: 12px;
  color: #666;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 详情页图片 */
.detail-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.detail-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #e8e8e8;
}

.detail-img:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 编辑图片 */
.edit-images-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
}
.edit-image-item {
  position: relative;
  width: 100px;
  height: 100px;
}
.edit-img-preview {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e8e8e8;
}
.edit-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5222d;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  padding: 0;
  z-index: 1;
}
.edit-img-remove:hover {
  background: #cf1322;
}

.resolver-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  background: #e6f7ff;
  color: #0958d9;
  border-radius: 12px;
  font-size: 12px;
}

/* 状态标签 */
.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

.status-pending { background: #fff1b8; color: #ad6800; border: 1px solid #ffe58f; }
.status-processing { background: #e6f7ff; color: #0958d9; border: 1px solid #91caff; }
.status-resolved { background: #f9f0ff; color: #722ed1; border: 1px solid #d3adf7; }
.status-reviewing { background: #fff0f6; color: #c41d7f; border: 1px solid #ffadd2; }
.status-completed { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.status-rejected { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }
.status-expired { background: #f5f5f5; color: #999; border: 1px solid #d9d9d9; text-decoration: line-through; }

/* 详情区域 */
.detail-section {
  background: #f9fafb;
  border-radius: 8px;
  padding: 14px;
}

.detail-section h4 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 13px;
}

.detail-section p {
  font-size: 12px;
  margin-bottom: 4px;
  color: #555;
}

/* 表单输入（模态框内） */
.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

/* 按钮行内间隔 */
td .btn { margin: 2px; }

/* ==================== 工单模块样式 ==================== */

/* 工序卡片 */
.wo-templates-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wo-process-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.wo-process-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.wo-process-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfc;
}

.wo-process-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.wo-process-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
}

.wo-process-card-actions {
  display: flex;
  gap: 6px;
}

.wo-process-card-body {
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* 报工字段标签 */
.wo-field-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  background: #f0f5ff;
  color: #2f54eb;
  border-radius: 4px;
  font-size: 12px;
}

/* 不良原因标签 */
.wo-defect-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  background: #fff1f0;
  color: #f5222d;
  border-radius: 4px;
  font-size: 12px;
}

/* 字段配置行 */
.wo-fields-container {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}

.wo-field-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px;
  background: #fafbfc;
  border-radius: 4px;
}

.wo-field-row:last-child {
  margin-bottom: 0;
}

.wo-field-row .form-input {
  padding: 6px 8px;
  font-size: 13px;
}

/* 不良原因checkbox区 */
.wo-defects-container {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  line-height: 2;
}

/* 工单状态标签 */
.wo-status-draft { background: #f5f5f5; color: #666; }
.wo-status-released { background: #e6f7ff; color: #1890ff; }
.wo-status-in_progress { background: #fff7e6; color: #d46b08; }
.wo-status-completed { background: #f6ffed; color: #389e0d; }
.wo-status-cancelled { background: #fff1f0; color: #cf1322; }
.wo-status-paused { background: #fffbe6; color: #faad14; }