body{font-family:Arial,sans-serif;margin:0;background:#f6f7fb;color:#111}header{display:flex;justify-content:space-between;align-items:center;padding:14px 22px;background:#111827;color:white}a{color:inherit}.brand{font-weight:800;text-decoration:none;font-size:20px}main{padding:20px}.top{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:14px}input,select{padding:9px;border:1px solid #ddd;border-radius:8px}button,.btn{display:inline-block;background:#2563eb;color:white;border:0;border-radius:8px;padding:9px 11px;text-decoration:none;cursor:pointer}.secondary{background:#4b5563}.searchbox{display:flex;gap:8px}.tabs{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0 14px}.tab{background:white;border:1px solid #e5e7eb;border-radius:999px;padding:9px 13px;text-decoration:none}.tab.active{background:#2563eb;color:white}.toolbar{display:flex;gap:8px;margin-bottom:12px}.table-wrap{background:white;border-radius:14px;overflow:auto;box-shadow:0 4px 18px #0001}table{border-collapse:collapse;width:100%}th,td{padding:11px;border-bottom:1px solid #eee;text-align:left;vertical-align:top}th{background:#f0f4ff;position:sticky;top:0;z-index:1}.flash{background:#fff3cd;padding:12px;border-radius:10px;margin-bottom:14px}.thumb{width:92px;height:92px;object-fit:contain;background:#f3f4f6;border:1px solid #e5e7eb;border-radius:10px}.noimg,.bad{display:inline-block;padding:6px 9px;border-radius:10px;background:#fee2e2;color:#991b1b;font-weight:700}.good{display:inline-block;padding:6px 9px;border-radius:10px;background:#dcfce7;color:#166534;font-weight:700}.status{display:inline-block;margin:6px 0;padding:4px 8px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:12px}.upload-inline{display:flex;gap:8px;align-items:center;min-width:250px}.upload-inline input[type=file]{max-width:150px;padding:8px}.status-form{display:grid;gap:6px;min-width:190px}.mini{margin-top:6px}small{color:#555;line-height:1.35}.warn{color:#b45309;font-weight:700}tr.same-group td:nth-child(1),tr.same-group td:nth-child(2),tr.same-group td:nth-child(3),tr.same-group td:nth-child(4){background:#fafafa;color:#aaa}tr.same-group td{border-top:1px dashed #e5e7eb}tr.missing-row{background:#fffafa}@media(max-width:800px){.top{display:block}main{padding:10px}th,td{padding:8px}.searchbox{margin-top:10px}.upload-inline{min-width:220px}}
.inline-form{display:inline}.danger{background:#dc2626}.toolbar form{margin:0}
.toast{display:none;position:fixed;right:18px;bottom:18px;background:#111827;color:#fff;padding:12px 16px;border-radius:12px;box-shadow:0 10px 25px #0003;z-index:50}.drop-zone{display:flex;align-items:center;justify-content:center;min-width:150px;min-height:74px;border:2px dashed #bfdbfe;border-radius:12px;background:#eff6ff;color:#1d4ed8;font-weight:700;text-align:center;cursor:pointer;padding:8px}.drop-zone input{display:none}.drop-zone.has-image{background:#f8fafc;color:#475569;border-color:#cbd5e1}.data-row.dragover{outline:3px solid #2563eb;outline-offset:-3px;background:#eff6ff}.data-row.active-row{box-shadow:inset 4px 0 0 #2563eb}.small{padding:6px 8px;font-size:12px;margin-top:6px}.modal{display:none;position:fixed;inset:0;background:#000b;z-index:100;align-items:center;justify-content:center;padding:20px}.modal img{max-width:96vw;max-height:94vh;background:white;border-radius:12px}.image-cell{text-align:center}.image-cell .thumb{cursor:zoom-in}.toolbar{flex-wrap:wrap}
.stats-grid{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:10px;margin:14px 0}
.stats-grid>div{background:#fff;border:1px solid #dbe3ef;border-radius:14px;padding:12px;box-shadow:0 6px 18px rgba(15,23,42,.05)}
.stats-grid b{display:block;font-size:26px;color:#0f172a;line-height:1}
.stats-grid span{font-size:12px;color:#64748b}
.stats-grid .bad b{color:#dc2626}.stats-grid .good b{color:#16a34a}.stats-grid .warnbox b{color:#d97706}
.big-index{font-size:30px;font-weight:900;text-align:center;color:#1d4ed8;min-width:54px}.big-index small{font-size:15px;color:#64748b}
.dup{margin:5px 0;padding:4px 6px;border-radius:8px;background:#fef3c7;color:#92400e;font-weight:700;font-size:12px}
@media(max-width:900px){.stats-grid{grid-template-columns:repeat(2,1fr)}}

.settings-grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr);gap:18px;align-items:start}.card{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:18px;box-shadow:0 8px 20px rgba(15,23,42,.06)}.settings-form h2{margin:18px 0 10px;font-size:18px}.settings-form h2:first-child{margin-top:0}.settings-form label{display:block;font-weight:700;margin:10px 0 4px}.settings-form input,.settings-form select{width:100%;box-sizing:border-box;padding:10px 11px;border:1px solid #d1d5db;border-radius:10px;background:#fff}.checkline{display:flex!important;gap:8px;align-items:center;font-weight:600!important}.checkline input{width:auto}.form-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}.help-card p{line-height:1.55}.logo-preview{display:flex;gap:12px;align-items:center;padding:10px;border:1px dashed #cbd5e1;border-radius:12px;background:#f8fafc;margin-top:8px}.logo-preview img{width:80px;height:80px;object-fit:contain;background:#fff;border-radius:10px;border:1px solid #e5e7eb}@media(max-width:900px){.settings-grid{grid-template-columns:1fr}}
/* V10 Giai đoạn 1: dashboard trạng thái theo đơn */
.stage-stats>div{position:relative;overflow:hidden}.stage-stats>div:before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px;background:#94a3b8}.stage-stats>div.bad:before{background:#ef4444}.stage-stats>div.good:before{background:#22c55e}.stage-stats>div.warnbox:before{background:#f59e0b}
.stage-tabs .tab b{margin-left:4px}.link{color:#2563eb;font-weight:800}.stage-pill{display:inline-block;padding:7px 10px;border-radius:999px;font-size:12px;font-weight:900;white-space:nowrap;border:1px solid transparent}.stage-no-image{background:#fee2e2!important;color:#991b1b!important;border-color:#fecaca!important}.stage-partial{background:#fef3c7!important;color:#92400e!important;border-color:#fde68a!important}.stage-ready{background:#dcfce7!important;color:#166534!important;border-color:#bbf7d0!important}.stage-printed{background:#dbeafe!important;color:#1e40af!important;border-color:#bfdbfe!important}.stage-cancelled{background:#e5e7eb!important;color:#374151!important;border-color:#d1d5db!important}.stage-unknown{background:#f3e8ff!important;color:#6b21a8!important;border-color:#e9d5ff!important}
tr.stage-no-image{background:#fff7f7}tr.stage-partial{background:#fffaf0}tr.stage-ready{background:#f7fff9}tr.stage-printed{background:#f8fbff}tr.stage-cancelled{opacity:.76;background:#f8fafc}
.timeline-strip{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:0 0 12px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 6px 18px rgba(15,23,42,.04)}.timeline-strip span{font-size:12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:999px;padding:5px 8px;color:#475569}.order-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:16px}.detail-actions{display:flex;gap:8px;flex-wrap:wrap}.cards.product-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px;margin-bottom:16px}.product-card .photo{height:180px;display:flex;align-items:center;justify-content:center;background:#f8fafc;border-radius:12px;border:1px solid #e5e7eb;margin-bottom:10px}.product-card .photo img{max-width:100%;max-height:100%;object-fit:contain}.timeline{display:grid;gap:10px}.timeline-item{display:grid;grid-template-columns:150px 1fr auto;gap:10px;align-items:start;padding:10px;border-left:4px solid #2563eb;background:#f8fafc;border-radius:10px}.timeline-item small{color:#64748b}.timeline-card{margin-top:10px}
header nav{display:flex;gap:14px;align-items:center}header nav a{text-decoration:none;color:#e5e7eb;font-weight:700}
@media(max-width:800px){.order-head{display:block}.timeline-item{grid-template-columns:1fr}.toolbar button,.toolbar .btn{width:100%}.searchbox input{flex:1}.table-wrap{font-size:13px}}

/* V10.1 phân quyền nhiều shop */
.user-pill{display:inline-flex;align-items:center;padding:7px 10px;border:1px solid #e5e7eb;border-radius:999px;background:#fff;color:#334155;font-size:13px}
.login-page{background:#f8fafc;min-height:100vh}
.login-wrap{max-width:460px;margin:8vh auto;padding:16px}
.login-card{display:flex;flex-direction:column;gap:14px}
.login-card input{width:100%}
.muted{color:#64748b;font-size:13px;line-height:1.5}
.table-wrap{overflow:auto}.mini-table{width:100%;border-collapse:collapse}.mini-table th,.mini-table td{border-bottom:1px solid #e5e7eb;padding:10px;text-align:left;vertical-align:top}.mini-table small{color:#64748b}

/* v10.5: Dòng đã in tự đổi màu khi đã in + đã tải đủ ảnh */
tr.stage-printed,
tr.item-printed{
  background:#eef6ff !important;
  border-left:6px solid #2563eb;
}
tr.stage-printed td,
tr.item-printed td{
  box-shadow:inset 0 -1px 0 rgba(37,99,235,.14);
}
.line-status.printed{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 11px;
  border-radius:999px;
  background:#dbeafe;
  color:#1e40af;
  border:1px solid #bfdbfe;
  font-weight:900;
  white-space:nowrap;
}

/* v10.6: trạng thái dòng dựa theo In vận đơn + Tải ảnh */
.line-status{display:inline-block;padding:7px 10px;border-radius:999px;font-size:12px;font-weight:900;margin-bottom:6px}
.line-status.line-done{background:#dcfce7;color:#166534;border:1px solid #86efac}
.line-status.line-need-download{background:#fef3c7;color:#92400e;border:1px solid #fcd34d}
.line-status.line-need-print{background:#dbeafe;color:#1e40af;border:1px solid #93c5fd}
.line-status.line-waiting{background:#f3f4f6;color:#374151;border:1px solid #d1d5db}
.line-status.line-missing{background:#fee2e2;color:#991b1b;border:1px solid #fecaca}
tr.line-done td{background:#f0fdf4!important}
tr.line-need-download td{background:#fffbeb!important}
tr.line-need-print td{background:#eff6ff!important}

/* v10.9: chi phí vật liệu trên dash admin */
.cost-stat b{color:#7c2d12}.material-cost-cell{min-width:145px;background:#fff7ed!important}.material-cost-cell b{color:#9a3412}.material-cost-cell small{color:#64748b;line-height:1.35}
.filter-card{display:flex;gap:12px;align-items:end;flex-wrap:wrap;background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:14px;margin:12px 0;box-shadow:0 8px 24px rgba(15,23,42,.06)}
.filter-card label{display:flex;flex-direction:column;gap:6px;font-weight:700;color:#334155}
.filter-card select{min-width:180px;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;background:#fff}

/* Đối soát vật liệu theo trạng thái vận đơn */
.settle{display:inline-block;padding:4px 8px;border-radius:999px;font-weight:700;font-size:12px;background:#f1f5f9;color:#334155;border:1px solid #cbd5e1}
.settle.delivered{background:#dcfce7;color:#166534;border-color:#86efac}
.settle.returned{background:#fef3c7;color:#92400e;border-color:#fcd34d}
.settle.pending{background:#fee2e2;color:#991b1b;border-color:#fecaca}
