/* style.css - 印花厂 ERP 样式（移动端优先） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }

/* ===== 登录页 ===== */
.login-page { position: fixed; inset: 0; background: linear-gradient(135deg, #2563eb, #1e40af); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-box { background: #fff; border-radius: 20px; padding: 40px 30px; width: 90%; max-width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-box h1 { text-align: center; color: var(--primary); font-size: 28px; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-light); margin-bottom: 30px; font-size: 14px; }
.login-box input { width: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; font-size: 16px; margin-bottom: 14px; outline: none; }
.login-box input:focus { border-color: var(--primary); }
.login-tip { text-align: center; color: var(--text-light); font-size: 12px; margin-top: 16px; }

/* ===== 主应用 ===== */
.app { display: flex; flex-direction: column; height: 100vh; }
.app-header { position: sticky; top: 0; background: var(--primary); color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; z-index: 10; box-shadow: var(--shadow); }
.app-header h2 { font-size: 18px; font-weight: 600; flex: 1; text-align: center; }
.header-btn { background: none; border: none; color: #fff; font-size: 15px; cursor: pointer; padding: 6px 10px; min-width: 60px; }
.content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 80px; }

/* ===== 底部导航 ===== */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; display: flex; border-top: 1px solid var(--border); padding: 8px 0; padding-bottom: env(safe-area-inset-bottom, 8px); z-index: 20; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--text-light); cursor: pointer; padding: 4px 0; }
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 22px; }
.nav-scan .nav-icon { background: var(--primary); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -20px; box-shadow: 0 4px 12px rgba(37,99,235,0.4); font-size: 20px; }

/* ===== 按钮 ===== */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 12px 20px; border-radius: 10px; font-size: 15px; cursor: pointer; font-weight: 500; }
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; }
.btn-block { width: 100%; }
.btn-success { background: var(--success); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); padding: 10px 18px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ===== 卡片 ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }

/* ===== 看板 ===== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 18px 14px; text-align: center; box-shadow: var(--shadow); }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.stat-card.pending .num { color: var(--warning); }
.stat-card.producing .num { color: var(--primary); }
.stat-card.completed .num { color: var(--success); }
.stat-card.shipped .num { color: var(--text-light); }
.quick-actions { display: flex; gap: 10px; }
.quick-actions .btn-primary { flex: 1; }

/* ===== 列表 ===== */
.list-item { background: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer; }
.list-item .item-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.list-item .item-meta { font-size: 13px; color: var(--text-light); display: flex; gap: 12px; flex-wrap: wrap; }
.status-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-producing { background: #dbeafe; color: #1e40af; }
.status-completed { background: #dcfce7; color: #166534; }
.status-shipped { background: #e5e7eb; color: #4b5563; }

/* ===== 进度条 ===== */
.progress-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--success); border-radius: 4px; transition: width 0.3s; }
.progress-text { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ===== Tab ===== */
.tabs { display: flex; background: #fff; border-radius: 10px; padding: 4px; margin-bottom: 14px; box-shadow: var(--shadow); }
.tab-item { flex: 1; text-align: center; padding: 8px; font-size: 14px; color: var(--text-light); border-radius: 8px; cursor: pointer; }
.tab-item.active { background: var(--primary); color: #fff; font-weight: 500; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 14px; color: var(--text-light); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; outline: none; background: #fff;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* ===== 搜索 ===== */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; }

/* ===== 浮动按钮 ===== */
.fab { position: fixed; bottom: 80px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; border: none; font-size: 28px; cursor: pointer; box-shadow: 0 4px 16px rgba(37,99,235,0.4); z-index: 15; display: flex; align-items: center; justify-content: center; }

/* ===== 二维码 ===== */
.qr-container { text-align: center; padding: 20px; }
.qr-container canvas, .qr-container img { margin: 0 auto; display: block; }
.qr-order-no { font-size: 18px; font-weight: 700; margin-top: 12px; letter-spacing: 1px; }

/* ===== 扫码页 ===== */
.scan-container { text-align: center; padding: 20px 0; }
#scan-video { width: 100%; max-width: 400px; border-radius: 12px; background: #000; }
.scan-overlay { position: relative; display: inline-block; }
.scan-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 240px; height: 240px; border: 3px solid var(--primary); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); }
.scan-tip { margin-top: 16px; color: var(--text-light); font-size: 14px; }

/* ===== 计件提交 ===== */
.piecework-info { background: #eff6ff; border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.piecework-info .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.piecework-info .label { color: var(--text-light); }
.amount-display { font-size: 24px; font-weight: 700; color: var(--primary); text-align: center; padding: 16px; }
.over-warning { background: #fef2f2; color: var(--danger); padding: 10px; border-radius: 8px; text-align: center; font-size: 14px; margin-bottom: 12px; }

/* ===== 表格 ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f9fafb; font-weight: 600; color: var(--text-light); }
.data-table .num { text-align: right; }

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box { position: relative; background: #fff; width: 100%; max-width: 500px; border-radius: 16px 16px 0 0; max-height: 85vh; overflow-y: auto; animation: slideUp 0.25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.modal-header h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); padding: 4px 8px; }
.modal-body { padding: 16px; }

/* ===== Toast ===== */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.8); color: #fff; padding: 12px 24px; border-radius: 8px; font-size: 14px; z-index: 300; max-width: 80%; text-align: center; }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 打印样式 ===== */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* 出库单打印页 */
.print-page { padding: 30px; font-size: 14px; }
.print-page h2 { text-align: center; margin-bottom: 20px; }
.print-page .print-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #ccc; }
.print-page .print-label { color: #666; }

/* 详情页固定底部操作栏 */
.detail-action-bar {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  z-index: 15;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.detail-action-bar button {
  flex: 1;
  margin: 0;
}
