* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif; background: #f3f6fb; color: #1f2937; }
tr:hover {background-color: #F9FAFB !important;}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #111827; color: #fff; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 20px; font-weight: 800; margin-bottom: 18px; }
.userbox { background: rgba(255,255,255,.08); border-radius: 10px; padding: 10px; margin-bottom: 16px; line-height: 1.7; font-size: 13px; }
.sidebar nav a { display: block; padding: 10px 12px; color: #e5e7eb; border-radius: 8px; margin-bottom: 6px; }
.sidebar nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.content { flex: 1; padding: 24px; }
.content-full { max-width: 460px; margin: 0 auto; padding-top: 70px; }
h1 { margin: 0 0 18px; font-size: 24px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 18px; margin-bottom: 16px; box-shadow: 0 8px 20px rgba(15,23,42,.04); }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; }
.form-row { margin-bottom: 12px; }
label { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea, select { width: 100%; border: 1px solid #d1d5db; border-radius: 9px; padding: 9px 10px; background: #fff; font-size: 14px; }
textarea { min-height: 82px; resize: vertical; }
.required { color: #dc2626; }
.btn { display: inline-block; border: 0; border-radius: 9px; padding: 9px 13px; cursor: pointer; font-size: 14px; background: #2563eb; color: #fff; text-decoration: none; }
.btn:hover { text-decoration: none; background: #1d4ed8; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-light { background: #eef2ff; color: #3730a3; }
.btn-light:hover { background: #e0e7ff; }
.btn-small { padding: 6px 9px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { border-bottom: 1px solid #e5e7eb; padding: 10px; text-align: left; vertical-align: top; }
.table th { background: #f9fafb; font-size: 13px; color: #374151; }
.alert { border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.item-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) 100px minmax(220px, 1.5fr) 80px; gap: 10px; align-items: end; padding: 12px; border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 10px; background: #fbfdff; }
.create-items-box .item-create-row { grid-template-columns: minmax(180px, 1.2fr) 100px minmax(220px, 1.5fr) 80px; }
.item-row .remove-item { margin-bottom: 0; }
.order-card { border-left: 5px solid #93c5fd; }
.task-order-card { background: #fff7ed; border-color: #fdba74; border-left-color: #f97316; box-shadow: 0 8px 20px rgba(249,115,22,.10); }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.order-meta { line-height: 1.9; }
.order-fields { margin-top: 10px; line-height: 1.9; }
.badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700; background: #e5e7eb; color: #374151; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-normal { background: #dcfce7; color: #166534; }
.badge-cancel { background: #fee2e2; color: #991b1b; }
.items-list { margin-top: 12px; border-top: 1px dashed #d1d5db; padding-top: 10px; }
.items-list div { line-height: 1.9; }
.review-box { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; margin-bottom: 14px; background: #fbfdff; }
.image-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.image-thumb { width: 110px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 6px; background: #fff; }
.image-thumb img { display: block; width: 100%; height: 78px; object-fit: cover; border-radius: 7px; margin-bottom: 5px; }
.image-thumb label { font-size: 12px; font-weight: 400; }
.muted { color: #6b7280; font-size: 13px; }
.filter-form { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.login-card { background: #fff; border-radius: 16px; padding: 24px; border: 1px solid #e5e7eb; box-shadow: 0 14px 34px rgba(15,23,42,.08); }
.help { color: #6b7280; font-size: 12px; margin-top: 4px; }
@media (max-width: 900px) {
    .layout { display: block; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .grid, .grid-3, .filter-form { grid-template-columns: 1fr; }
    .item-row { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .order-head { display: block; }
}
.bulk-card { border-left: 5px solid #60a5fa; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.order-check { margin-right: 8px; }
.bulk-status-select { width: auto; min-width: 120px; }
.order-items-table { margin-top: 0; }
.order-items-table th:nth-child(2), .order-items-table td:nth-child(2),
.order-items-table th:nth-child(4), .order-items-table td:nth-child(4) { width: 120px; white-space: nowrap; }
@media (min-width: 1200px) {
    .filter-form { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
}
@media (max-width: 700px) {
    .order-items-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* v3：编辑订单页订单内容改为表格后，对旧 .item-row 卡片样式做覆盖 */
.item-edit-table { margin-bottom: 12px; }
.item-edit-table .item-row { display: table-row; padding: 0; border: 0; border-radius: 0; margin: 0; background: transparent; }
.item-edit-table input[type="text"], .item-edit-table input[type="number"] { min-width: 110px; }
.item-edit-table th:nth-child(5), .item-edit-table td:nth-child(5) { width: 90px; white-space: nowrap; }
.uploaded-image-list { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d1d5db; }
.image-preview-list:empty { display: none; }
.preview-thumb { border-style: dashed; }
.image-name { font-size: 11px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
@media (max-width: 700px) {
    .item-edit-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* v5：创建订单产品输入不显示表头；编辑订单产品只读表格 */
.create-items-box .item-create-row { margin-bottom: 12px; }
.create-items-box .item-create-row label { min-height: 18px; }
.upload-picker { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed #93c5fd; background: #eff6ff; color: #1d4ed8; border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 700; margin: 0 0 6px; }
.upload-picker:hover { background: #dbeafe; }
.upload-picker input[type="file"] { display: none; }
.upload-plus { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; background: #2563eb; color: #fff; font-weight: 800; line-height: 1; }
.uploaded-image-list { min-height: 0; }
.uploaded-image-list:empty { display: none; }
.image-preview-list { display: flex; flex-wrap: wrap; gap: 10px; }

/* v10：订单审核页 */
.badge-paying { background: #dbeafe; color: #1d4ed8; }
.audit-table { font-size: 13px; }
.audit-table th, .audit-table td { vertical-align: middle; }
.audit-actions { gap: 10px; }
.file-inline { margin: 0; display: inline-flex; align-items: center; font-weight: 400; }
.file-inline input[type="file"] { max-width: 220px; }
@media (max-width: 900px) {
    .audit-table { display: block; overflow-x: auto; white-space: nowrap; }
    .audit-actions { align-items: stretch; }
}

/* v11：订单审核页工具栏同一排显示，修复状态选择框占整行问题 */
.audit-toolbar-card { overflow-x: auto; }
.audit-toolbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; white-space: nowrap; min-width: max-content; }
.audit-toolbar .btn { flex: 0 0 auto; }
.audit-toolbar .bulk-status-select { flex: 0 0 140px; width: 140px; min-width: 140px; }
.audit-toolbar .audit-file-input { flex: 0 0 210px; width: 210px; max-width: 210px; padding: 6px; }
.audit-table th:first-child, .audit-table td:first-child { width: 42px; text-align: center; }
@media (max-width: 900px) {
    .audit-toolbar { flex-wrap: nowrap; }
}


/* v14：买家列表 */
.buyer-table th:first-child, .buyer-table td:first-child { width: 42px; text-align: center; }
.buyer-table td { max-width: 220px; word-break: break-all; }


/* v21：Excel 文件选择后自动执行导入/更新 */
.auto-submit-status { display: inline-flex; align-items: center; margin-left: 8px; padding: 6px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; font-size: 12px; font-weight: 700; white-space: nowrap; }
.is-auto-submitting .audit-file-input, .is-auto-submitting input[type="file"][data-auto-submit-action] { opacity: .75; }
