/* Product Upload Workflow - Stylesheet */
:root {
  --primary: #378ADD;
  --primary-dark: #185FA5;
  --success: #1D9E75;
  --success-bg: #E1F5EE;
  --warning: #EF9F27;
  --warning-bg: #FAEEDA;
  --danger: #E24B4A;
  --danger-bg: #FCEBEB;
  --info: #7F77DD;
  --info-bg: #EEEDFE;
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --border: rgba(0,0,0,0.1);
  --text: #222;
  --text-muted: #666;
  --text-light: #999;
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Sukhumvit Set', 'Noto Sans Thai', sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Layout ---- */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.app-header nav { display: flex; gap: 8px; margin-left: auto; }
.app-header nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}
.app-header nav a:hover { background: var(--bg); color: var(--text); }
.app-header nav a.active { background: var(--primary); color: white; }

.app-main {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 16px;
}
.card-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 15px; font-weight: 600; }

/* ---- Buttons ---- */
button, .btn {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
button:hover, .btn:hover { background: var(--bg); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.95); }
.btn-danger { background: var(--danger-bg); color: #791F1F; border-color: var(--danger); }
.btn-warning { background: var(--warning-bg); color: #663C00; border-color: var(--warning); }
.btn-small { padding: 3px 10px; font-size: 12px; }
.btn-large { padding: 10px 24px; font-size: 15px; }

/* ---- Form elements ---- */
input[type=text], input[type=number], input[type=url], input[type=email], textarea, select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(55, 138, 221, 0.2);
}
textarea { resize: vertical; min-height: 60px; font-family: inherit; }
label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.form-row > * { flex: 1; }

/* ---- Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius);
  text-align: center;
}
.stat-card .label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.stat-card .value { font-size: 22px; font-weight: 600; }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.danger .value { color: var(--danger); }
.stat-card.info .value { color: var(--info); }

/* ---- Status badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge-pending     { background: #F0F0F0; color: #555; }
.badge-team1       { background: var(--success-bg); color: #085041; }
.badge-team2       { background: var(--info-bg); color: #3C3489; }
.badge-qa          { background: #FFF0E6; color: #A66F00; }
.badge-done        { background: var(--success-bg); color: var(--success); }
.badge-rejected    { background: var(--danger-bg); color: #791F1F; }

/* ---- Product cards (dashboard) ---- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: box-shadow 0.1s, transform 0.1s;
}
.product-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); transform: translateY(-1px); }
.product-card .thumb {
  aspect-ratio: 1;
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: var(--text-light);
  overflow: hidden;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  height: 36px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.product-card .meta {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 6px;
}
.product-card .footer {
  display: flex; justify-content: space-between; align-items: center;
}

/* ---- Filter chips ---- */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: 12px;
  background: var(--bg); color: var(--text-muted); border: 1px solid transparent;
}
.chip:hover { background: white; border-color: var(--border); }
.chip.active { background: var(--primary); color: white; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 500; color: var(--text-muted); }
table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tr.selected { background: var(--success-bg); }
table input[type=text], table input[type=number] { font-size: 12px; padding: 4px 8px; }

/* ---- Category picker (component) ---- */
.cat-picker-selected {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--bg); border-radius: 6px;
}

/* ---- Category modal (Shopee Mall style) ---- */
.cat-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  animation: cat-fade-in 0.15s ease-out;
}
@keyframes cat-fade-in { from { opacity: 0; } to { opacity: 1; } }
.cat-modal {
  background: white; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%; max-width: 1080px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.cat-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, #fafafa, white);
}
.cat-modal-head h3 { font-size: 16px; font-weight: 600; }
.cat-modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted);
  padding: 4px 10px; line-height: 1; border-radius: 4px;
}
.cat-modal-close:hover { background: var(--bg); color: var(--danger); }
.cat-modal-search { padding: 14px 22px; border-bottom: 1px solid var(--border); }
.cat-modal-search input {
  width: 100%; padding: 10px 16px; font-size: 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cat-modal-search input:focus {
  outline: none; border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.cat-modal-body { flex: 1; overflow: hidden; display: flex; min-height: 420px; max-height: 60vh; }
.cat-modal-recent {
  padding: 10px 16px; border-top: 1px solid var(--border);
  background: #fafafa; display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.cat-recent-chip {
  padding: 5px 12px; font-size: 12px;
  background: white; color: var(--info);
  border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
  transition: all 0.15s;
}
.cat-recent-chip:hover { border-color: var(--info); background: var(--info-bg); }

/* Tree columns */
.cat-tree-cols {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  flex: 1; overflow: hidden; width: 100%;
}
.cat-col {
  border-right: 1px solid var(--border); overflow-y: auto;
  background: white; position: relative;
}
.cat-col:last-child { border-right: none; }
.cat-col[data-level="1"] { background: #fafafa; }
.cat-col[data-level="2"] { background: #f5f5f5; }
.cat-col[data-level="3"] { background: #f0f0f0; }
.cat-col:empty::before {
  content: '←  เลือกหมวดทางซ้าย'; display: block;
  padding: 24px 14px; color: #bbb; font-size: 12px; text-align: center;
}
.cat-col[data-level="0"]:empty::before { content: 'กำลังโหลด...'; }
.cat-col-item {
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background 0.1s;
  background: white;
}
.cat-col-item:hover { background: var(--info-bg); }
.cat-col-item.active {
  background: var(--info); color: white; font-weight: 500;
}
.cat-col-item.active .cat-arrow,
.cat-col-item.active .cat-leaf-id { color: rgba(255,255,255,0.8); }
.cat-col-item.leaf { color: var(--success); }
.cat-col-item.leaf:hover { background: var(--success-bg); color: var(--success); }
.cat-col-item.leaf.active { background: var(--success); color: white; }
.cat-arrow { color: var(--text-muted); font-size: 16px; margin-left: 8px; }
.cat-leaf-id { color: var(--text-muted); font-size: 10px; font-family: monospace; margin-left: 8px; }

/* Search results overlay */
.cat-search-results {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
.cat-search-row {
  padding: 10px 22px; cursor: pointer; border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px; transition: background 0.1s;
}
.cat-search-row:hover { background: var(--info-bg); }
.cat-search-row code {
  background: var(--info-bg); color: var(--info); padding: 2px 8px;
  border-radius: 4px; font-size: 11px; margin-right: 8px; font-family: monospace;
}

/* ---- Image gallery ---- */
.img-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
.img-cell {
  aspect-ratio: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  position: relative; overflow: hidden; cursor: pointer;
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-cell.cover { border-color: var(--success); border-width: 2px; }
.img-cell .star { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--success); font-weight: 600; }
.img-cell .num { position: absolute; bottom: 2px; left: 4px; font-size: 10px; color: var(--text-muted); }
.img-cell .placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-light); font-size: 20px; }

/* ---- Steps (for Team 2) ---- */
.step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.step-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.step.done .step-num { background: var(--success); color: white; }
.step.active .step-num { background: var(--primary); color: white; }

/* ---- Helpers ---- */
.muted { color: var(--text-muted); }
.small { font-size: 11px; }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.p-3 { padding: 16px; }


/* ---- Toast/Alert ---- */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 10px 16px;
  background: var(--success);
  color: white;
  border-radius: 6px;
  z-index: 10000;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.2s;
}
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Setup banner ---- */
.setup-banner {
  background: var(--warning-bg); border-left: 4px solid var(--warning);
  padding: 14px 18px; border-radius: 6px; margin-bottom: 16px;
}
.setup-banner h3 { margin: 0 0 8px; font-size: 14px; }
.setup-banner p { margin: 4px 0; font-size: 13px; }

/* ---- Gallery Manager ---- */
.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.gal-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  background: var(--bg);
  border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
}
.gal-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-item img.gal-img-error {
  object-fit: contain;
  opacity: 0.45;
  background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 8px, #e5e7eb 8px, #e5e7eb 16px);
}
.gal-item img.gal-img-loading {
  background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
  background-size: 200% 100%;
  animation: gal-loading 1s linear infinite;
}
@keyframes gal-loading {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.gal-item.gal-cover { border-color: var(--success); }
.gal-item.gal-dragging { opacity: 0.4; }
.gal-item:active { cursor: grabbing; }
.gal-item.gal-dragover { border-color: var(--info); transform: scale(1.05); }
.gal-cover-badge {
  position: absolute; top: 4px; left: 4px;
  font-size: 10px; font-weight: 500; padding: 2px 8px;
  background: var(--success); color: white; border-radius: 4px;
}
.gal-num {
  position: absolute; bottom: 4px; left: 4px;
  font-size: 10px; padding: 1px 6px;
  background: rgba(0,0,0,0.7); color: white; border-radius: 3px;
}
.gal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  justify-content: center;
}
.gal-item.active .gal-overlay { display: flex; }
.gal-row { display: flex; gap: 4px; }
.gal-btn {
  flex: 1; padding: 5px 8px; font-size: 11px;
  background: white; color: black; border: none;
  border-radius: 4px; cursor: pointer; line-height: 1.2;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.gal-btn:hover { background: var(--info-bg); }
.gal-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.gal-btn-danger { background: var(--danger); color: white; }
.gal-btn-danger:hover { background: #B71C1C; }
.gal-add {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px dashed var(--border);
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.1s, color 0.1s;
}
.gal-add:hover { border-color: var(--info); color: var(--info); }
.gal-hint {
  margin-top: 10px; padding: 8px 12px;
  font-size: 11px; color: var(--text-muted);
  background: var(--info-bg); border-radius: 4px;
  text-align: center;
}
.gal-item.gal-uploading {
  display: flex; align-items: center; justify-content: center;
  background: var(--info-bg); border: 2px dashed var(--info);
  cursor: wait;
}
.gal-spinner { font-size: 11px; color: var(--info); text-align: center; padding: 8px; }
.gal-full {
  cursor: not-allowed;
  background: var(--warning-bg) !important;
  border-color: var(--warning) !important;
  color: var(--warning) !important;
}

.gal-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  flex-wrap: wrap;
}
.gal-bulk-toolbar.active {
  background: #fff7ed;
  border-color: #fb923c;
}
.gal-bulk-toolbar .spacer { flex: 1; }
.gal-bulk-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.gal-bulk-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.gal-bulk-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.gal-bulk-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}
.gal-bulk-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}
.gal-bulk-danger.outline {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.gal-bulk-danger.outline:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #f87171;
}
.gal-bulk-count {
  font-size: 12px;
  color: #6b7280;
  padding: 0 4px;
}
.gal-grid-bulk .gal-item {
  cursor: pointer;
}
.gal-item.gal-selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.gal-select-check {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.95);
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  z-index: 4;
}
.gal-select-check.checked {
  background: #2563eb;
  border-color: #fff;
}
.gal-item.gal-select-mode .gal-cover-badge {
  top: 32px;
}
@media (max-width: 720px) {
  .gal-bulk-toolbar .spacer { display: none; }
  .gal-bulk-toolbar { align-items: stretch; }
  .gal-bulk-btn { flex: 1 1 auto; }
}

/* ---- BigSeller-style tabs ---- */
.bs-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 0; }
.bs-tab { padding: 12px 18px; cursor: pointer; font-size: 13px; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.bs-tab:hover { color: var(--text); }
.bs-tab.active { color: #EE4D2D; border-bottom-color: #EE4D2D; font-weight: 500; }
.bs-tab .num { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); color: var(--text-muted); font-size: 10px; text-align: center; line-height: 18px; margin-right: 6px; }
.bs-tab.active .num { background: #EE4D2D; color: white; }
.bs-tab.done .num { background: var(--success); color: white; }
.bs-tab-panel { display: none; padding: 20px 0; }
.bs-tab-panel.active { display: block; }

.bs-section { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 20px; margin-bottom: 16px; }
.bs-section h3 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.bs-field-row { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: start; padding: 10px 0; }
.bs-field-row .lbl { font-size: 13px; color: var(--text-muted); padding-top: 8px; }
.bs-field-row .lbl.required::before { content: '* '; color: var(--danger); }
.bs-field-row .field { min-width: 0; }
.bs-help { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.bs-sticky-bar {
  position: sticky; bottom: 0; background: white;
  border-top: 1px solid var(--border); padding: 12px 20px;
  margin: 0 -20px -20px; display: flex; gap: 8px; align-items: center;
  z-index: 50;
}
.bs-progress { flex: 1; height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bs-progress-bar { height: 100%; background: linear-gradient(90deg, var(--success), #16A34A); transition: width 0.3s; }
.bs-status-pill { font-size: 11px; padding: 4px 12px; border-radius: 999px; background: var(--info-bg); color: var(--info); }

/* Prompt button (split) */
.prompt-split { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); margin-left: auto; }
.prompt-split button { border: none; border-radius: 0; padding: 6px 10px; font-size: 12px; background: white; display: inline-flex; align-items: center; gap: 4px; }
.prompt-split button:hover { background: var(--bg); }
.prompt-split .prompt-copy { background: var(--info-bg); color: var(--info); }
.prompt-split .prompt-copy:hover { background: var(--info); color: white; }
.prompt-split .prompt-edit { border-left: 1px solid var(--border); padding: 6px 8px; }

/* Gallery inline bar (always visible — no overlay) */
.gal-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; gap: 1px; padding: 0;
  background: rgba(0,0,0,0.65);
}
.gal-bar-btn {
  flex: 1; padding: 4px 0; font-size: 11px;
  background: transparent; color: white; border: none;
  border-radius: 0; cursor: pointer; line-height: 1;
}
.gal-bar-btn:hover { background: rgba(255,255,255,0.2); }
.gal-bar-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.gal-bar-danger:hover { background: var(--danger); }
.gal-bar-spacer { flex: 1; }
.gal-item .gal-num { bottom: auto; top: 4px; right: 4px; left: auto; }
.gal-status-badge {
  position: absolute; top: 4px; left: 4px;
  font-size: 9px; padding: 2px 6px;
  background: rgba(99, 102, 241, 0.9); color: white;
  border-radius: 999px; font-weight: 500;
  animation: pulse 1.2s ease-in-out infinite;
}
.gal-status-err { background: rgba(231, 76, 60, 0.9); animation: none; }
.gal-status-local { background: rgba(29, 158, 117, 0.9); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.gal-delete-btn {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(0,0,0,0.62);
  color: white;
  font-size: 18px;
  line-height: 20px;
  z-index: 2;
}
.gal-delete-btn:hover { background: var(--danger); }

.image-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.image-viewer {
  position: relative;
  width: min(92vw, 1100px);
  height: min(88vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: white;
}
.image-viewer-close,
.image-viewer-nav {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,0.18);
  color: white;
  z-index: 2;
}
.image-viewer-close {
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 28px;
  line-height: 32px;
}
.image-viewer-nav {
  top: 50%;
  width: 42px;
  height: 56px;
  padding: 0;
  transform: translateY(-50%);
  font-size: 44px;
  line-height: 44px;
}
.image-viewer-prev { left: 0; }
.image-viewer-next { right: 0; }
.image-viewer-close:hover,
.image-viewer-nav:hover { background: rgba(255,255,255,0.32); }
.image-viewer-count {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 12px;
}

/* ========== Admin Dashboard (index.new.html) — polished v2 ========== */

/* KPI strip — premium cards with icon + accent bar */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  overflow: hidden;
  cursor: default;
}
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #cbd5e1;
  border-radius: 12px 0 0 12px;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border-color: #c7d2fe;
}
.kpi-card .kpi-icon {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 18px;
  opacity: 0.5;
}
.kpi-card .kpi-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}
.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
}
.kpi-card.kpi-team1::before    { background: #3B82F6; }
.kpi-card.kpi-team1 .kpi-value { color: #1E40AF; }
.kpi-card.kpi-team2::before    { background: #8B5CF6; }
.kpi-card.kpi-team2 .kpi-value { color: #5B21B6; }
.kpi-card.kpi-qa::before       { background: #F59E0B; }
.kpi-card.kpi-qa .kpi-value    { color: #B45309; }
.kpi-card.kpi-done::before     { background: #10B981; }
.kpi-card.kpi-done .kpi-value  { color: #047857; }
.kpi-card.kpi-rejected::before { background: #EF4444; }
.kpi-card.kpi-rejected .kpi-value { color: #B91C1C; }

/* Admin toolbar — divider chips */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.admin-toolbar .toolbar-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  padding-right: 12px;
  border-right: 1px solid #e5e7eb;
  margin-right: 4px;
  white-space: nowrap;
}
.admin-toolbar .toolbar-divider {
  width: 1px; height: 24px;
  background: #e5e7eb;
  margin: 0 4px;
}
.admin-toolbar button {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 7px;
  transition: all 0.15s;
}
.admin-toolbar button:hover { transform: translateY(-1px); }
.admin-toolbar .spacer { flex: 1; }
.admin-toolbar input[type="file"] {
  font-size: 12px;
  max-width: 180px;
}

/* Filter row */
.dash-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.dash-filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
}
.dash-filter-tab {
  padding: 6px 14px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.dash-filter-tab:hover { color: #111827; background: rgba(255,255,255,0.6); }
.dash-filter-tab.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.dash-filter-tab .tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  border-radius: 10px;
  background: rgba(0,0,0,0.08);
  color: #4b5563;
}
.dash-filter-tab.active .tab-count {
  background: #dbeafe;
  color: #1d4ed8;
}
.dash-filter-row input[type="text"] {
  font-size: 13px;
  padding: 7px 10px;
}

/* Bulk select mode — big highlight bar at top */
.bulk-mode-banner {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1px solid #F59E0B;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #78350F;
}
.bulk-mode-banner.visible { display: flex; }
.bulk-mode-banner strong { font-weight: 600; }
.bulk-mode-banner .spacer { flex: 1; }
.bulk-mode-banner button {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #92400E;
  background: rgba(255,255,255,0.7);
  color: #78350F;
  cursor: pointer;
}
.bulk-mode-banner button:hover { background: #fff; }
.bulk-mode-banner button.btn-primary-mini {
  background: #92400E;
  color: #fff;
  border-color: #92400E;
}

.products-grid.bulk-mode .product-card {
  cursor: pointer;
  user-select: none;
  padding-top: 36px !important;
}
.product-card .bulk-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.95);
  border: 2px solid #cbd5e1;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
  font-size: 14px;
  color: transparent;
  font-weight: 700;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.products-grid.bulk-mode .product-card .bulk-checkbox { display: flex; }
.product-card.bulk-selected .bulk-checkbox {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.product-card.bulk-selected {
  outline: 2.5px solid #2563eb;
  outline-offset: -1px;
  background: rgba(37, 99, 235, 0.04);
  transform: scale(0.98);
}

/* Sticky bulk action bar */
.bulk-action-bar {
  position: sticky;
  bottom: 16px;
  margin: 20px 0 0;
  padding: 14px 20px;
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
  color: #fff;
  border-radius: 12px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(127, 29, 29, 0.4);
  z-index: 50;
  animation: slideUpFade 0.2s ease-out;
}
@keyframes slideUpFade {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.bulk-action-bar.visible { display: flex; }
.bulk-action-bar .bulk-icon {
  font-size: 22px;
}
.bulk-action-bar .bulk-count {
  font-weight: 600;
  font-size: 15px;
}
.bulk-action-bar .bulk-count-num {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  margin: 0 4px;
}
.bulk-action-bar .spacer { flex: 1; }
.bulk-action-bar button {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #fff;
  font-weight: 500;
  transition: all 0.15s;
}
.bulk-action-bar button:hover { background: rgba(255,255,255,0.1); }
.bulk-action-bar button.btn-confirm {
  background: #fff;
  color: #7f1d1d;
  border: none;
  font-weight: 600;
}
.bulk-action-bar button.btn-confirm:hover { background: #fef2f2; }

/* Confirm modal — premium look */
.confirm-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.confirm-modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
  animation: scaleIn 0.2s ease-out;
}
@keyframes scaleIn {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.confirm-modal h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #7f1d1d;
  font-weight: 600;
}
.confirm-modal p { font-size: 14px; color: #374151; line-height: 1.5; }
.confirm-modal .preview-list {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  max-height: 180px;
  overflow-y: auto;
  font-size: 13px;
}
.confirm-modal .preview-list ul { margin: 0; padding-left: 18px; color: #4b5563; }
.confirm-modal .preview-list li { margin: 3px 0; }
.confirm-modal .modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px;
}
.confirm-modal .modal-actions button {
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 7px;
  cursor: pointer;
}
.confirm-modal .modal-cancel {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
}
.confirm-modal .modal-cancel:hover { background: #f9fafb; }

/* Pagination */
.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 13px;
  color: #6b7280;
}
.pagination-info strong { color: #111827; font-weight: 600; }
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-controls button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}
.pagination-controls button:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.pagination-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination-controls button.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}
.pagination-controls .pagination-ellipsis {
  padding: 0 6px;
  color: #9ca3af;
  font-size: 13px;
}
.pagination-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
}
.pagination-size select {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

/* File input — custom styled */
.file-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  overflow: hidden;
}
.file-input-label {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  cursor: pointer;
  border-right: 1px solid #e5e7eb;
  transition: background 0.15s;
  font-weight: 500;
  white-space: nowrap;
}
.file-input-label:hover { background: #f3f4f6; }
.file-input-name {
  padding: 0 12px;
  font-size: 12px;
  color: #9ca3af;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-input-name.has-file {
  color: #059669;
  font-weight: 500;
}

/* ========== AI Prompt buttons (team2 + team3) ========== */
.prompt-split {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}
.prompt-split .prompt-copy,
.prompt-split .prompt-edit {
  border: none;
  border-right: 1px solid #e5e7eb;
  padding: 6px 10px;
  font-size: 12px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  border-radius: 0;
}
.prompt-split .prompt-copy:last-child,
.prompt-split .prompt-edit:last-child {
  border-right: none;
}
.prompt-split .prompt-copy:hover,
.prompt-split .prompt-edit:hover {
  background: #f3f4f6;
}
.prompt-split .prompt-copy.with-image {
  background: #EEF2FF;
  color: #4338CA;
  font-weight: 500;
}
.prompt-split .prompt-copy.with-image:hover {
  background: #C7D2FE;
}
.prompt-split .prompt-edit {
  font-size: 11px;
  padding: 6px 8px;
  color: #6b7280;
}
.prompt-split .prompt-edit:hover {
  color: #2563eb;
}

.section-heading-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-heading-actions h3 {
  margin: 0;
}
.section-heading-actions .prompt-split {
  flex: 0 0 auto;
  margin-left: 0;
}
@media (max-width: 720px) {
  .section-heading-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

.variant-name-row {
  align-items: end;
}
.variant-input-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}
.variant-input-actions input {
  min-width: 0;
}
.variant-input-actions .prompt-split {
  flex: 0 0 auto;
  margin-left: 0;
  align-self: stretch;
}
.variant-input-actions .prompt-split button {
  min-height: 34px;
}
@media (max-width: 900px) {
  .variant-name-row {
    display: grid;
    grid-template-columns: 1fr;
  }
  .variant-input-actions {
    grid-template-columns: 1fr;
  }
  .variant-input-actions .prompt-split {
    justify-self: start;
  }
}

/* team3 QA cards AI buttons */
.ai-btn-group {
  display: inline-flex;
  gap: 4px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}
.ai-btn-group button {
  border: none;
  border-right: 1px solid #e5e7eb;
  padding: 4px 8px;
  font-size: 11px;
  background: #fff;
  cursor: pointer;
}
.ai-btn-group button:last-child { border-right: none; }
.ai-btn-group .ai-copy-img {
  background: #EEF2FF;
  color: #4338CA;
  font-weight: 500;
}
.ai-btn-group .ai-copy-img:hover { background: #C7D2FE; }
.ai-btn-group button:hover { background: #f3f4f6; }

/* Hidden helper */
.hidden { display: none !important; }

/* Settings menu in header (admin) */
.settings-menu {
  position: relative;
  display: inline-block;
}
.settings-menu-btn {
  background: #EEEDFE;
  color: #3C3489;
  border: none;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
}
.settings-menu-btn:hover { background: #DDD6FE; }
.settings-menu-dropdown {
  display: none;
  position: absolute;
  right: 0; top: 110%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 4px;
  min-width: 180px;
  z-index: 100;
}
.settings-menu.open .settings-menu-dropdown { display: block; }
.settings-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 5px;
}
.settings-menu-dropdown button:hover { background: #f3f4f6; }


/* AI image generation reminder (Team 2) */
.ai-image-card-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -2px 0 8px;
  padding: 6px 8px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.ai-image-card-badge small {
  color: #9a3412;
  font-weight: 500;
  white-space: nowrap;
}
.ai-image-status-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-left: 4px solid #f97316;
  border-radius: 8px;
  background: #fff7ed;
}
.ai-image-status-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ffedd5;
  flex: 0 0 auto;
}
.ai-image-status-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ai-image-status-text strong {
  color: #c2410c;
  font-size: 13px;
}
.ai-image-status-text span {
  color: #9a3412;
  font-size: 12px;
}
.ai-image-status-btn {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}
.ai-image-done {
  border-color: #059669;
  background: #059669;
  color: #fff;
}
.ai-image-done:hover {
  background: #047857;
}
.ai-image-clear {
  border-color: #fecaca;
  background: #fff;
  color: #b91c1c;
}
.ai-image-clear:hover {
  background: #fef2f2;
}
@media (max-width: 720px) {
  .ai-image-status-panel {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .ai-image-status-panel .spacer {
    display: none;
  }
  .ai-image-status-btn {
    flex: 1 1 auto;
  }
}


/* Variant builder UI v20260517r */
.variant-builder-panel {
  background: #f7f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 12px;
}
.variant-builder-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.variant-builder-title {
  font-weight: 700;
  font-size: 13px;
}
.variant-builder-sub {
  color: #6b7280;
  font-size: 12px;
  margin-top: 3px;
}
.variant-builder-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.variant-chip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.variant-chip,
.variant-more,
.variant-empty-note {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  padding: 4px 8px;
  font-size: 12px;
}
.variant-empty-note {
  color: #9ca3af;
  border-style: dashed;
}
.variant-bulk-row {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(90px, 120px) minmax(120px, 1fr) auto minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.variant-bulk-row input {
  min-width: 0;
}
.variant-bulk-hint {
  color: #6b7280;
  font-size: 12px;
}
#variantTable {
  min-width: 1120px;
}
#variantTable th,
#variantTable td {
  vertical-align: middle;
}
#variantTable td input {
  width: 100%;
  min-width: 0;
}
.variant-img-cell {
  width: 62px;
}
.variant-img-button {
  width: 46px;
  height: 46px;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #ef4b36;
  font-size: 11px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}
.variant-img-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.variant-source-cell {
  color: #6b7280;
  font-size: 12px;
  max-width: 210px;
}
.variant-source-cell div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.variant-row-actions {
  width: 54px;
  text-align: center;
}
.row-added {
  background: #fffdf5;
}
@media (max-width: 900px) {
  .variant-builder-main {
    flex-direction: column;
  }
  .variant-builder-actions {
    justify-content: flex-start;
  }
  .variant-bulk-row {
    grid-template-columns: 1fr 1fr;
  }
  .variant-bulk-row .variant-bulk-hint {
    grid-column: 1 / -1;
  }
}


/* Shopee preview modal v20260517t */
.shopee-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.sp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .58);
}
.sp-modal-panel {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 22px 80px rgba(0,0,0,.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sp-modal-head {
  height: 54px;
  padding: 0 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.sp-modal-head > div {
  display: flex;
  gap: 8px;
}
.sp-modal-body,
.preview-body {
  background: #f2f3f5;
  overflow: auto;
  padding: 18px;
}
.preview-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}
.shopee-phone {
  width: min(430px, 100%);
  margin: 0 auto;
  background: #fff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(0,0,0,.12);
}
.sp-topbar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid #f1f1f1;
  background: #fff;
}
.sp-cover {
  aspect-ratio: 1 / 1;
  background: #f6f7f8;
}
.sp-cover img,
.sp-noimg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: #9ca3af;
}
.sp-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 8px solid #f5f5f5;
}
.sp-thumb {
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}
.sp-thumb.active {
  border-color: #ee4d2d;
  box-shadow: 0 0 0 1px #ee4d2d inset;
}
.sp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sp-section {
  padding: 12px 14px;
  border-bottom: 8px solid #f5f5f5;
}
.sp-section h1 {
  margin: 6px 0 8px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
}
.sp-section h2 {
  margin: 0 0 10px;
  font-size: 14px;
}
.sp-price {
  color: #ee4d2d;
  font-size: 24px;
  font-weight: 700;
}
.sp-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #6b7280;
  font-size: 12px;
}
.sp-variants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sp-chip {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 12px;
  background: #fff;
}
.sp-muted {
  color: #9ca3af;
  font-size: 12px;
}
.sp-desc {
  white-space: normal;
  line-height: 1.65;
  font-size: 13px;
  color: #374151;
}
.sp-bottom {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}
.sp-bottom button {
  border: 1px solid #ee4d2d;
  color: #ee4d2d;
  background: #fff;
  border-radius: 4px;
  padding: 10px;
  font-weight: 600;
}
.sp-bottom .buy {
  color: #fff;
  background: #ee4d2d;
}
@media (max-width: 640px) {
  .shopee-preview-modal {
    padding: 0;
  }
  .sp-modal-panel {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }
  .sp-modal-body {
    padding: 10px;
  }
}


/* Shopee shared preview v20260518a */
.sp-chip {
  cursor: pointer;
}
.sp-chip.active {
  border-color: #ee4d2d;
  color: #ee4d2d;
  background: #fff7f4;
  box-shadow: 0 0 0 1px #ee4d2d inset;
}
.sp-price[data-sp-price] {
  min-height: 34px;
}

/* QA Workbench v20260518b */
.qa-workbench-page {
  max-width: 1480px;
  padding-bottom: 86px;
}
.qa-workbench-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.qa-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}
.qa-side-head,
.qa-ready-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.qa-side-head > div,
.qa-ready-head {
  font-size: 16px;
}
.qa-side-head span,
.qa-ready-head span {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}
.qa-queue-list,
.qa-ready-list {
  display: grid;
  gap: 8px;
}
.qa-ready-head {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}
.qa-queue-item,
.qa-ready-item {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 9px;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}
.qa-queue-item.active {
  border-color: #f59e0b;
  background: #fff7ed;
  box-shadow: inset 3px 0 0 #f59e0b;
}
.qa-queue-thumb,
.qa-ready-item span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f4f6;
}
.qa-queue-thumb img,
.qa-ready-item img,
.qa-hero-thumb img,
.qa-mini-img img,
.qa-export-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qa-queue-text,
.qa-ready-item strong {
  min-width: 0;
}
.qa-queue-text strong,
.qa-ready-item strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
}
.qa-queue-text em,
.qa-ready-item em {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 11px;
  font-style: normal;
}
.qa-empty {
  padding: 8px 2px;
}
.qa-main-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
}
.qa-product-hero {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}
.qa-hero-thumb {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
}
.qa-hero-info h2 {
  margin: 0 0 5px;
  font-size: 18px;
  line-height: 1.4;
}
.qa-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qa-hero-meta > span:first-child {
  color: #ee4d2d;
  font-weight: 800;
  font-size: 18px;
}
.qa-score-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 800;
  white-space: nowrap;
}
.qa-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.qa-section-head h3,
.qa-notes-card h3 {
  margin: 0;
  font-size: 17px;
}
.qa-section-head p {
  margin: 3px 0 0;
}
.qa-compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.qa-mini-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
}
.qa-mini-strip.ready {
  background: #f0fdf4;
}
.qa-mini-img {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
}
.qa-mini-img span {
  position: absolute;
  right: 3px;
  bottom: 3px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #fff;
  background: rgba(17, 24, 39, .75);
  font-size: 11px;
}
.qa-check-rows {
  display: grid;
  gap: 8px;
}
.qa-check-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto 132px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.qa-check-row.pass {
  border-color: #86efac;
  background: #f0fdf4;
}
.qa-check-row.warn {
  border-color: #fdba74;
  background: #fff7ed;
}
.qa-check-row.fail {
  border-color: #fca5a5;
  background: #fef2f2;
}
.qa-check-title {
  display: grid;
  grid-template-columns: 24px minmax(90px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.qa-check-title em {
  color: #6b7280;
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qa-row-tools {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}
.qa-check-row select {
  width: 100%;
}
.qa-notes-card textarea {
  width: 100%;
}
.qa-actions-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.qa-export-bar {
  position: fixed;
  left: 22px;
  right: 22px;
  bottom: 18px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: #fff;
  background: #059669;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(5, 150, 105, .25);
}
.qa-export-bar > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.qa-export-bar span {
  color: #dcfce7;
  font-size: 12px;
}
.qa-export-bar button {
  margin-left: auto;
  color: #047857;
  background: #fff;
  border-color: #fff;
  font-weight: 800;
}
.qa-export-modal,
.qa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
}
.qa-export-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .55);
}
.qa-export-panel {
  position: relative;
  width: min(900px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  margin: 18px auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.qa-export-head,
.qa-export-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}
.qa-export-head h2 {
  margin: 0 0 3px;
}
.qa-export-list {
  overflow: auto;
  padding: 12px 16px;
  display: grid;
  gap: 10px;
}
.qa-export-item {
  display: grid;
  grid-template-columns: 22px 66px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.qa-export-thumb {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: #f3f4f6;
}
.qa-export-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.qa-export-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qa-export-info em,
.qa-export-done {
  color: #6b7280;
  font-size: 12px;
  font-style: normal;
}
.qa-export-done {
  color: #059669;
}
.qa-export-foot {
  border-top: 1px solid #e5e7eb;
  border-bottom: 0;
}
.qa-lightbox {
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, .78);
}
.qa-lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 88vh;
  border-radius: 8px;
  background: #fff;
}
.qa-lightbox-close {
  position: fixed;
  right: 26px;
  top: 24px;
  z-index: 1;
}
@media (max-width: 980px) {
  .qa-workbench-shell {
    grid-template-columns: 1fr;
  }
  .qa-sidebar {
    position: static;
    max-height: none;
  }
  .qa-queue-list,
  .qa-ready-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .qa-product-hero {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .qa-score-pill {
    grid-column: 1 / -1;
    width: max-content;
  }
  .qa-compare-row {
    grid-template-columns: 1fr;
  }
  .qa-check-row {
    grid-template-columns: 1fr;
  }
  .qa-actions-row {
    flex-wrap: wrap;
  }
  .qa-export-item {
    grid-template-columns: 22px 54px minmax(0, 1fr);
  }
  .qa-export-item button {
    grid-column: 3;
    justify-self: start;
  }
}

/* QA Export inline preview v20260518c */
.qa-export-panel {
  width: min(1180px, calc(100vw - 28px));
}
.qa-export-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(390px, 1fr) 430px;
  overflow: hidden;
}
.qa-export-body .qa-export-list {
  max-height: calc(100vh - 190px);
  overflow: auto;
  border-right: 1px solid #e5e7eb;
}
.qa-export-item {
  grid-template-columns: 22px 64px minmax(0, 1fr);
  position: relative;
}
.qa-export-item.active {
  border-color: #2f80ed;
  background: #f8fbff;
  box-shadow: inset 3px 0 0 #2f80ed;
}
.qa-export-item > button[data-export-preview] {
  grid-column: 3;
  justify-self: start;
  margin-top: 4px;
  padding: 5px 10px;
  font-size: 12px;
}
.qa-export-preview-pane {
  min-height: 540px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 14px;
  background: #f3f4f6;
}
.qa-export-preview-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  text-align: center;
  color: #6b7280;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.qa-export-preview-title {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}
.qa-export-preview-title span {
  color: #6b7280;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qa-export-preview-pane .shopee-phone {
  width: 100%;
  max-width: 390px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
}
.qa-export-preview-pane .sp-cover {
  max-height: 390px;
}
.qa-export-preview-pane .sp-bottom {
  display: none;
}
@media (max-width: 980px) {
  .qa-export-body {
    grid-template-columns: 1fr;
  }
  .qa-export-body .qa-export-list {
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    max-height: 42vh;
  }
  .qa-export-preview-pane {
    min-height: 360px;
    max-height: 48vh;
  }
}

/* QA UI polish v20260518d */
.qa-workbench-page {
  --qa-blue: #2563eb;
  --qa-green: #059669;
  --qa-amber: #d97706;
  --qa-red: #dc2626;
  --qa-line: #e5e7eb;
  --qa-soft: #f8fafc;
  max-width: 1520px;
}
.qa-workbench-shell {
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
}
.qa-sidebar {
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .05);
}
.qa-side-head,
.qa-ready-head {
  padding: 0 2px;
}
.qa-side-head strong,
.qa-ready-head strong {
  font-size: 17px;
}
.qa-side-head span,
.qa-ready-head span {
  background: #e8f0ff;
  color: #1d4ed8;
}
.qa-queue-item,
.qa-ready-item {
  border-radius: 10px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.qa-queue-item:hover,
.qa-ready-item:hover {
  transform: translateY(-1px);
  border-color: #bfdbfe;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .08);
}
.qa-queue-item.active {
  border-color: #f59e0b;
  background: linear-gradient(90deg, #fff7ed, #ffffff);
}
.qa-product-hero {
  grid-template-columns: 92px minmax(0, 1fr) auto;
  padding: 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 70%, #f1f5ff 100%);
}
.qa-hero-thumb {
  width: 92px;
  height: 92px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
}
.qa-hero-kicker {
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}
.qa-hero-info h2 {
  max-width: 920px;
  font-size: 21px;
}
.qa-hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.qa-hero-facts span {
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #475569;
  font-size: 12px;
}
.qa-score-pill {
  display: grid;
  place-items: center;
  min-width: 88px;
  height: 64px;
  border-radius: 14px;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}
.qa-score-pill strong {
  color: #047857;
  font-size: 20px;
  line-height: 1;
}
.qa-score-pill span {
  color: #047857;
  font-size: 12px;
}
.qa-compact-card,
.qa-notes-card {
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}
.qa-section-head {
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
}
.qa-primary-outline {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 700;
}
.qa-compare-row {
  margin-top: 12px;
}
.qa-mini-strip {
  min-height: 82px;
  background: #f8fafc;
  border-color: #e2e8f0;
}
.qa-mini-strip.ready {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.qa-mini-img {
  flex-basis: 76px;
  width: 76px;
  height: 76px;
  border-radius: 8px;
}
.qa-check-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.qa-check-summary span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}
.qa-check-summary .pass { color: #047857; background: #ecfdf5; border: 1px solid #bbf7d0; }
.qa-check-summary .warn { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; }
.qa-check-summary .fail { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
.qa-check-summary .pending { color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; }
.qa-check-row {
  grid-template-columns: minmax(260px, 1fr) auto 150px;
  padding: 11px 12px;
  border-radius: 10px;
  border-left-width: 4px;
}
.qa-check-row.pass {
  border-left-color: #22c55e;
  background: #f7fff9;
}
.qa-check-row.warn {
  border-left-color: #f59e0b;
  background: #fffaf0;
}
.qa-check-row.fail {
  border-left-color: #ef4444;
  background: #fff7f7;
}
.qa-check-title {
  grid-template-columns: 42px minmax(96px, auto) minmax(0, 1fr);
}
.qa-check-title > span {
  width: 34px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
}
.qa-check-title strong {
  font-size: 14px;
}
.qa-row-tools .btn-small {
  height: 30px;
  padding: 4px 9px;
}
.qa-check-row select {
  height: 34px;
  border-radius: 8px;
}
.qa-notes-card textarea {
  min-height: 92px;
  border-radius: 10px;
  background: #fbfdff;
}
.qa-actions-row {
  padding-top: 10px;
  border-top: 1px solid #eef2f7;
}
.qa-export-bar {
  left: 18px;
  right: 18px;
  bottom: 16px;
  padding: 10px 14px;
  color: #064e3b;
  background: #ffffff;
  border: 1px solid #bbf7d0;
  border-left: 6px solid #059669;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .13);
}
.qa-export-bar strong {
  color: #065f46;
}
.qa-export-bar span {
  color: #64748b;
}
.qa-export-bar button {
  color: #fff;
  background: #059669;
  border-color: #059669;
}
.qa-export-head {
  background: linear-gradient(135deg, #ffffff, #f8fbff);
}
.qa-export-panel {
  border-radius: 12px;
}
.qa-export-item {
  border-radius: 10px;
  background: #fff;
}
.qa-export-item.active {
  background: #f8fbff;
}
.qa-export-preview-pane {
  background: #f8fafc;
}
.qa-export-preview-title {
  border-radius: 10px;
}
@media (max-width: 980px) {
  .qa-workbench-shell {
    grid-template-columns: 1fr;
  }
  .qa-product-hero,
  .qa-check-summary {
    grid-template-columns: 1fr;
  }
  .qa-check-row {
    grid-template-columns: 1fr;
  }
}

/* QA Export modal polish v20260518e */
.qa-export-modal {
  padding: 18px;
}
.qa-export-panel {
  width: min(1240px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  margin: 0 auto;
}
.qa-export-head {
  padding: 16px 18px;
}
.qa-export-head h2 {
  font-size: 22px;
}
.qa-export-body {
  grid-template-columns: minmax(460px, .96fr) 420px;
  gap: 0;
  background: #f8fafc;
}
.qa-export-body .qa-export-list {
  align-content: start;
  max-height: calc(100vh - 186px);
  padding: 14px;
  background: #f8fafc;
}
.qa-export-list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
}
.qa-export-list-summary span {
  color: #64748b;
  font-size: 12px;
}
.qa-export-item {
  grid-template-columns: 24px 78px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border-color: #dfe6f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}
.qa-export-item.active {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .11), inset 4px 0 0 #2563eb;
}
.qa-export-check {
  width: 16px;
  height: 16px;
}
.qa-export-thumb {
  width: 78px;
  height: 78px;
  border-radius: 10px;
}
.qa-export-info {
  gap: 7px;
}
.qa-export-info strong {
  font-size: 15px;
  line-height: 1.35;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qa-export-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.qa-export-metrics b,
.qa-export-metrics i {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  background: #f1f5f9;
  color: #475569;
}
.qa-export-metrics b {
  color: #dc2626;
  background: #fff1f2;
}
.qa-export-item > button[data-export-preview] {
  grid-column: 4;
  align-self: center;
  justify-self: end;
  margin: 0;
  min-width: 92px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}
.qa-export-preview-pane {
  max-height: calc(100vh - 186px);
  padding: 14px;
  background: #eef2f7;
}
.qa-export-preview-title {
  margin-bottom: 12px;
  border-color: #dbeafe;
}
.qa-export-preview-title strong {
  color: #1d4ed8;
}
.qa-export-preview-pane .shopee-phone {
  max-width: 370px;
}
.qa-export-preview-pane .sp-cover {
  max-height: 370px;
}
.qa-export-foot {
  padding: 13px 18px;
  background: #fff;
}
@media (max-width: 980px) {
  .qa-export-body {
    grid-template-columns: 1fr;
  }
  .qa-export-item {
    grid-template-columns: 24px 64px minmax(0, 1fr);
  }
  .qa-export-item > button[data-export-preview] {
    grid-column: 3;
    justify-self: start;
  }
}


/* QA horizontal overflow fix v20260518f */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.app-main.qa-workbench-page {
  width: 100%;
  max-width: min(1480px, calc(100vw - 24px));
  padding-left: 12px;
  padding-right: 12px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.qa-workbench-shell,
.qa-main-panel,
.qa-sidebar,
.qa-product-hero,
.qa-compact-card,
.qa-notes-card,
.qa-compare-row,
.qa-compare-row > div,
.qa-mini-strip,
.qa-check-summary,
.qa-check-rows,
.qa-check-row,
.qa-section-head,
.qa-hero-info,
.qa-hero-facts,
.qa-actions-row,
.qa-export-bar,
.qa-export-panel,
.qa-export-body,
.qa-export-list,
.qa-export-preview-pane {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.qa-workbench-shell {
  grid-template-columns: minmax(218px, 250px) minmax(0, 1fr);
}

.qa-main-panel {
  overflow: hidden;
}

.qa-product-hero,
.qa-compact-card,
.qa-notes-card {
  overflow: hidden;
}

.qa-product-hero {
  grid-template-columns: 92px minmax(0, 1fr) minmax(74px, auto);
}

.qa-hero-info h2 {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.qa-hero-facts {
  overflow: hidden;
}

.qa-hero-facts span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qa-compare-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.qa-mini-strip {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

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

.qa-check-row {
  grid-template-columns: minmax(210px, 1fr) minmax(0, auto) minmax(118px, 136px);
}

.qa-check-title {
  min-width: 0;
  grid-template-columns: 42px minmax(74px, auto) minmax(0, 1fr);
}

.qa-check-title strong,
.qa-check-title em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.qa-row-tools {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.qa-row-tools .btn-small {
  white-space: nowrap;
}

.qa-check-row select {
  min-width: 118px;
}

.qa-export-bar {
  left: 12px;
  right: 12px;
  max-width: calc(100vw - 24px);
}

.qa-export-panel {
  width: min(1160px, calc(100vw - 28px));
}

.qa-export-modal,
.qa-export-body,
.qa-export-preview-pane {
  overflow-x: hidden;
}

@media (max-width: 1180px) {
  .app-main.qa-workbench-page {
    max-width: calc(100vw - 18px);
    padding-left: 9px;
    padding-right: 9px;
  }

  .qa-workbench-shell {
    grid-template-columns: minmax(190px, 220px) minmax(0, 1fr);
    gap: 12px;
  }

  .qa-product-hero {
    grid-template-columns: 76px minmax(0, 1fr) minmax(68px, auto);
  }

  .qa-hero-thumb {
    width: 76px;
    height: 76px;
  }

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

  .qa-check-row {
    grid-template-columns: minmax(180px, 1fr) minmax(0, auto) 124px;
  }

  .qa-row-tools .btn-small {
    padding-left: 7px;
    padding-right: 7px;
  }
}

@media (max-width: 900px) {
  .app-main.qa-workbench-page {
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .qa-workbench-shell,
  .qa-product-hero,
  .qa-compare-row,
  .qa-check-row {
    grid-template-columns: 1fr;
  }

  .qa-score-pill {
    justify-self: start;
  }

  .qa-row-tools {
    justify-content: flex-start;
  }

  .qa-export-bar {
    left: 8px;
    right: 8px;
    max-width: calc(100vw - 16px);
  }
}
/* END QA horizontal overflow fix v20260518f */


/* Home dashboard redesign v20260518b */
.app-main.home-page {
  width: 100%;
  max-width: min(1480px, calc(100vw - 28px));
  padding: 20px 14px 96px;
  box-sizing: border-box;
}

.home-page,
.home-page * {
  box-sizing: border-box;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin: 0 0 16px;
  padding: 8px 2px;
}

.home-eyebrow {
  display: inline-flex;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-hero h1 {
  margin: 0;
  color: #0f172a;
  font-size: 28px;
  line-height: 1.2;
}

.home-hero p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 14px;
}

.home-live-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.home-sync-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.home-sync-badge.ok {
  background: #ecfdf5;
  color: #047857;
}

.home-sync-badge.syncing {
  background: #eff6ff;
  color: #1d4ed8;
}

.home-sync-badge.error {
  background: #fff7ed;
  color: #c2410c;
}

.home-refresh-btn,
.home-queue-card button,
.home-product-foot button {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-weight: 700;
}

.home-refresh-btn {
  min-height: 34px;
  padding: 7px 12px;
}

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

.home-queue-card {
  position: relative;
  display: grid;
  min-height: 124px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .04);
}

.home-queue-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #94a3b8;
}

.home-queue-card.blue::before { background: #2563eb; }
.home-queue-card.purple::before { background: #7c3aed; }
.home-queue-card.amber::before { background: #f59e0b; }
.home-queue-card.green::before { background: #059669; }
.home-queue-card.red::before { background: #ef4444; }

.home-queue-card.active {
  border-color: #bfdbfe;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .09);
}

.home-queue-card span {
  display: block;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.home-queue-card strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 30px;
  line-height: 1;
}

.home-queue-card p {
  min-height: 34px;
  margin: 8px 0 12px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.home-queue-card button {
  justify-self: start;
  align-self: end;
  padding: 7px 10px;
}

.home-workspace {
  display: grid;
  gap: 12px;
}

.home-workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 14px;
  align-items: end;
}

.home-workspace h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
}

.home-workspace p {
  margin: 4px 0 0;
}

.home-search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

.home-filter-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.home-filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-weight: 700;
  white-space: nowrap;
}

.home-filter-tab span {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
}

.home-filter-tab.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.home-filter-tab.active span {
  background: #dbeafe;
  color: #1d4ed8;
}

.home-products-grid.products-grid {
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 14px;
}

.home-product-card.product-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.home-product-card.product-card:hover {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 12px 24px rgba(15, 23, 42, .10);
}

.home-product-thumb {
  aspect-ratio: 1;
  background: #f8fafc;
  overflow: hidden;
}

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

.home-product-thumb span {
  display: grid;
  place-items: center;
  height: 100%;
  color: #94a3b8;
  font-size: 12px;
}

.home-product-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.home-product-title {
  min-height: 40px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-product-meta,
.home-product-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.home-product-meta {
  color: #64748b;
  font-size: 11px;
}

.home-product-foot button {
  padding: 6px 9px;
  font-size: 12px;
}

.home-pagination.pagination-row {
  border-radius: 10px;
}

.home-system-tools {
  margin-top: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.home-system-tools summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 800;
}

.home-system-tools summary small {
  color: #64748b;
  font-weight: 500;
}

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

.home-system-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.home-system-card strong {
  color: #0f172a;
}

.home-system-card p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.home-file-wrap {
  min-width: 0;
  flex-wrap: wrap;
}

.home-bulk-banner.bulk-mode-banner {
  margin-top: 14px;
}

.home-empty,
.home-loading {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 1180px) {
  .home-queue-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-main.home-page {
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .home-hero,
  .home-workspace-head,
  .home-system-grid {
    grid-template-columns: 1fr;
  }

  .home-live-panel {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .home-queue-board {
    grid-template-columns: 1fr;
  }
}
/* END Home dashboard redesign v20260518b */


/* Team queue list UI v20260518a */
.app-main.team-queue-page {
  width: 100%;
  max-width: min(1460px, calc(100vw - 28px));
  padding: 20px 14px 80px;
}

.team-queue-page,
.team-queue-page * {
  box-sizing: border-box;
}

.team-queue-shell {
  display: grid;
  gap: 14px;
}

.team-queue-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}

.team1-hero {
  border-left: 5px solid #2563eb;
}

.team2-hero {
  border-left: 5px solid #7c3aed;
}

.team-queue-kicker {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.team-queue-hero h1 {
  margin: 4px 0 4px;
  color: #0f172a;
  font-size: 26px;
  line-height: 1.2;
}

.team-queue-hero p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

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

.team-queue-actions button,
.team-queue-actions a,
.team-queue-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.team-queue-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.team1-queue-page .team-queue-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.team-queue-stat {
  min-height: 70px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.team-queue-stat span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.team-queue-stat strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 26px;
  line-height: 1;
}

.team-queue-stat.all { border-left: 4px solid #2563eb; }
.team-queue-stat.missing_category,
.team-queue-stat.generating { border-left: 4px solid #f59e0b; }
.team-queue-stat.ready_category,
.team-queue-stat.new { border-left: 4px solid #059669; }
.team-queue-stat.working { border-left: 4px solid #7c3aed; }
.team-queue-stat.rejected { border-left: 4px solid #ef4444; }

.team-queue-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.team-queue-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.team-queue-tabs button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.team-queue-tabs button.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

#queueSearchInput {
  width: 100%;
  height: 38px;
  padding: 0 13px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

.team-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.team-queue-grid.sparse {
  grid-template-columns: minmax(0, 760px);
}

.team-queue-grid.sparse .team-queue-card {
  grid-template-columns: 220px minmax(0, 1fr);
}

.team-queue-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.team-queue-card:hover {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 12px 24px rgba(15, 23, 42, .10);
}

.team-queue-thumb {
  aspect-ratio: 1;
  min-height: 180px;
  background: #f8fafc;
  overflow: hidden;
}

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

.team-queue-thumb span {
  height: 100%;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 13px;
}

.team-queue-card-body {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 11px;
}

.team-queue-card-top,
.team-queue-meta,
.team-queue-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.team-queue-card-top > span {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
}

.team-queue-card h3 {
  margin: 0;
  min-height: 42px;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.team-queue-meta {
  color: #64748b;
  font-size: 12px;
}

.team-queue-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.queue-chip.ok {
  background: #ecfdf5;
  color: #047857;
}

.queue-chip.warn,
.queue-chip.ai {
  background: #fff7ed;
  color: #c2410c;
}

.team-queue-card button {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.team-queue-empty,
.team-queue-loading {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.team-queue-empty.small {
  min-height: 160px;
}

.team-queue-empty strong {
  color: #0f172a;
  font-size: 18px;
}

.team-queue-empty p {
  margin: 0;
  color: #64748b;
}

.team-queue-empty a {
  color: #2563eb;
  font-weight: 700;
}

.team-queue-shell .pagination-row {
  margin-top: 2px;
  border-radius: 10px;
}

.team-queue-card .ai-image-card-badge {
  position: static;
  margin: -2px 0 0;
  border-radius: 8px;
  background: #fff7ed;
  color: #c2410c;
}

@media (max-width: 1100px) {
  .team-queue-stats,
  .team1-queue-page .team-queue-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-queue-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-main.team-queue-page {
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  .team-queue-hero,
  .team-queue-grid.sparse .team-queue-card {
    grid-template-columns: 1fr;
  }

  .team-queue-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .team-queue-stats,
  .team1-queue-page .team-queue-stats {
    grid-template-columns: 1fr;
  }
}
/* END Team queue list UI v20260518a */


/* Team2 detail back queue button v20260518a */
.team2-detail-back,
.team2-back-queue-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.team2-detail-back:hover,
.team2-back-queue-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

#productHeader .team2-detail-back {
  flex: 0 0 auto;
  margin-left: 8px;
}

.bs-sticky-bar .team2-back-queue-btn {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  #productHeader .flex {
    flex-wrap: wrap;
  }

  #productHeader .team2-detail-back {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
  }

  .bs-sticky-bar .team2-back-queue-btn {
    order: 2;
  }
}
/* END Team2 detail back queue button v20260518a */


/* Home bulk manage UI v20260518a */
.home-workspace-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.home-manage-toggle {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  white-space: nowrap;
}

.home-manage-toggle.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, .18);
}

.home-system-note {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  background: #fff;
  font-size: 12px;
}

.home-bulk-banner.bulk-mode-banner.home-bulk-panel {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #f8fbff;
  color: #0f172a;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
}

.home-bulk-banner.bulk-mode-banner.home-bulk-panel.visible {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.home-bulk-panel-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.home-bulk-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 900;
}

.home-bulk-panel-main strong {
  display: block;
  font-size: 14px;
}

.home-bulk-panel-main p {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 12px;
}

.home-bulk-panel-main span {
  font-weight: 800;
  color: #1d4ed8;
}

.home-bulk-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.home-bulk-panel-actions button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.home-bulk-panel-actions .btn-primary-mini {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.home-bulk-panel-actions .bulk-danger-action {
  border-color: #fecaca;
  background: #fee2e2;
  color: #b91c1c;
}

.home-bulk-panel-actions .bulk-light-action {
  background: #f8fafc;
}

.home-bulk-panel-actions button:disabled,
.home-selection-dock button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.home-products-grid.products-grid.bulk-mode {
  padding-top: 0 !important;
}

.home-products-grid.bulk-mode .home-product-card {
  cursor: pointer;
}

.home-product-card .bulk-checkbox.home-card-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 7px;
  width: auto;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, .65);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .14);
}

.home-product-card .bulk-checkbox.home-card-select::after {
  content: 'เลือก';
}

.home-product-card .bulk-checkbox.home-card-select span {
  display: block;
  width: 15px;
  height: 15px;
  border: 2px solid #94a3b8;
  border-radius: 5px;
  background: #fff;
}

.home-products-grid.bulk-mode .home-product-card .bulk-checkbox.home-card-select {
  display: inline-flex;
}

.home-product-card.product-card.bulk-selected {
  outline: none;
  transform: none;
  border-color: #2563eb;
  background: #f8fbff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16), 0 12px 24px rgba(15, 23, 42, .10);
}

.home-product-card.bulk-selected .bulk-checkbox.home-card-select {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.home-product-card.bulk-selected .bulk-checkbox.home-card-select::after {
  content: 'เลือกแล้ว';
}

.home-product-card.bulk-selected .bulk-checkbox.home-card-select span {
  border-color: #fff;
  background: #fff;
  position: relative;
}

.home-product-card.bulk-selected .bulk-checkbox.home-card-select span::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 5px;
  height: 9px;
  border: solid #2563eb;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.bulk-action-bar.home-selection-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 130;
  width: min(720px, calc(100vw - 32px));
  margin: 0;
  transform: translateX(-50%);
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .28);
}

.bulk-action-bar.home-selection-dock.visible {
  display: flex;
}

.bulk-action-bar.home-selection-dock .bulk-count {
  font-size: 14px;
  font-weight: 800;
}

.bulk-action-bar.home-selection-dock .bulk-count-num {
  background: #2563eb;
  color: #fff;
}

.bulk-action-bar.home-selection-dock button {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 800;
}

.bulk-action-bar.home-selection-dock button.btn-confirm {
  background: #fee2e2;
  color: #b91c1c;
}

@media (max-width: 860px) {
  .home-workspace-tools,
  .home-bulk-banner.bulk-mode-banner.home-bulk-panel.visible {
    grid-template-columns: 1fr;
  }

  .home-bulk-panel-actions {
    justify-content: flex-start;
  }
}
/* END Home bulk manage UI v20260518a */

/* Home import panel v20260518a */
.home-import-tools {
  margin-top: 18px;
}

.home-import-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(239, 246, 255, .92), rgba(255, 255, 255, .98) 46%, rgba(240, 253, 244, .78));
  box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

.home-import-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.home-import-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e0ecff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
}

.home-import-copy h3 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.25;
}

.home-import-copy p {
  max-width: 620px;
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.65;
}

.home-import-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.home-import-steps span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.home-import-drop {
  display: grid;
  gap: 10px;
  align-content: center;
  min-width: 0;
}

.home-import-file {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px;
  border: 1px dashed #93c5fd;
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.home-import-file:hover {
  border-color: #2563eb;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .12);
  transform: translateY(-1px);
}

.home-import-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.home-import-file-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.home-import-file-text strong {
  color: #0f172a;
  font-size: 14px;
}

.home-import-file-text small {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-import-file-text small.has-file {
  color: #047857;
  font-weight: 900;
}

.home-import-btn {
  min-height: 42px;
  border-radius: 10px;
  font-weight: 900;
}

@media (max-width: 860px) {
  .home-import-card {
    grid-template-columns: 1fr;
    padding: 14px;
  }
}
/* END Home import panel v20260518a */

/* Import wizard modal v20260518a */
.import-wizard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .56);
}

.import-wizard-modal {
  width: min(1320px, calc(100vw - 42px));
  max-height: calc(100vh - 42px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .35);
}

.import-wizard-head,
.import-wizard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #eef2f7;
}

.import-wizard-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.import-wizard-head p,
.import-wizard-foot small,
.import-wizard-checks p,
.import-wizard-toolbar small,
.import-step small,
.import-file-box small,
.import-product-cell small {
  color: #64748b;
  font-size: 12px;
}

.import-wizard-close,
.import-secondary,
.import-primary,
.import-wizard-toolbar button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-weight: 800;
}

.import-wizard-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr) 265px;
  background: #f8fafc;
}

.import-wizard-steps,
.import-wizard-checks {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow: auto;
}

.import-step,
.import-file-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #e5eaf2;
  border-radius: 12px;
  background: #fff;
}

.import-step {
  grid-template-columns: 34px 1fr;
  align-items: center;
}

.import-step span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #e2e8f0;
  font-weight: 900;
}

.import-step b,
.import-file-box b {
  color: #0f172a;
}

.import-step.done {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.import-step.done span {
  background: #10b981;
  color: #fff;
}

.import-step.active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.import-step.active span {
  background: #2563eb;
  color: #fff;
}

.import-file-box {
  border-style: dashed;
  border-color: #93c5fd;
}

.import-file-box strong {
  overflow: hidden;
  color: #1d4ed8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-wizard-preview {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid #eef2f7;
  border-right: 1px solid #eef2f7;
  background: #fff;
}

.import-wizard-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px;
  border-bottom: 1px solid #eef2f7;
}

.import-wizard-toolbar > div {
  min-width: 220px;
  margin-right: auto;
}

.import-wizard-toolbar strong {
  display: block;
}

.import-wizard-toolbar button.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.import-wizard-toolbar button.ok {
  color: #047857;
}

.import-wizard-toolbar button.warn {
  color: #b45309;
}

.import-wizard-toolbar button.bad {
  color: #b91c1c;
}

.import-table-wrap {
  min-height: 0;
  overflow: auto;
}

.import-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

.import-table-wrap th,
.import-table-wrap td {
  padding: 11px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
}

.import-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}

.import-product-cell {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 320px;
}

.import-product-thumb {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 10px;
}

.import-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.import-product-cell strong {
  display: block;
  overflow: hidden;
  color: #0f172a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-check-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.import-check-chip.ok,
.import-metrics b.ok,
.import-rules span.ok {
  color: #047857;
}

.import-check-chip.ok {
  background: #ecfdf5;
}

.import-check-chip.warn,
.import-metrics b.warn,
.import-rules span.warn {
  color: #b45309;
}

.import-check-chip.warn {
  background: #fffbeb;
}

.import-check-chip.bad,
.import-metrics b.bad,
.import-rules span.bad {
  color: #b91c1c;
}

.import-check-chip.bad {
  background: #fef2f2;
}

.import-issue-text {
  display: block;
  margin-top: 4px;
  max-width: 220px;
  overflow: hidden;
  color: #64748b;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-wizard-checks {
  background: #f8fafc;
}

.import-wizard-checks > strong {
  font-size: 16px;
}

.import-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.import-metrics div {
  padding: 11px;
  border: 1px solid #e5eaf2;
  border-radius: 12px;
  background: #fff;
}

.import-metrics span {
  display: block;
  color: #64748b;
  font-size: 12px;
}

.import-metrics b {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 24px;
}

.import-rules {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.import-rules li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e5eaf2;
  border-radius: 12px;
  background: #fff;
}

.import-rules span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #f1f5f9;
  font-weight: 900;
}

.import-rules span.ok {
  background: #ecfdf5;
}

.import-rules span.warn {
  background: #fffbeb;
}

.import-rules span.bad {
  background: #fef2f2;
}

.import-rules b {
  display: block;
  font-size: 13px;
}

.import-rules small {
  color: #64748b;
  font-size: 11px;
}

.import-wizard-foot {
  border-top: 1px solid #eef2f7;
  border-bottom: 0;
  background: #fff;
}

.import-wizard-foot > div {
  margin-right: auto;
}

.import-wizard-foot strong,
.import-wizard-foot small {
  display: block;
}

.import-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.import-secondary:disabled,
.import-primary:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.import-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: #64748b;
}

@media (max-width: 1100px) {
  .import-wizard-body {
    grid-template-columns: 1fr;
  }

  .import-wizard-steps,
  .import-wizard-checks {
    display: none;
  }

  .import-wizard-preview {
    border: 0;
  }

  .import-wizard-foot {
    align-items: stretch;
    flex-direction: column;
  }
}
/* END Import wizard modal v20260518a */



/* Team1 price calculator v20260518a */
.team1-price-calc {
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 62%, #ecfdf5 100%);
  border-radius: 8px;
}
.price-calc-head,
.price-calc-body,
.price-calc-formulas {
  display: flex;
  gap: 12px;
  align-items: center;
}
.price-calc-head {
  justify-content: space-between;
  margin-bottom: 12px;
}
.price-calc-kicker {
  display: block;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.price-calc-head h3 {
  margin: 0;
  font-size: 18px;
}
.price-calc-head p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 13px;
}
.price-calc-primary {
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}
.price-calc-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  flex: 1 1 auto;
}
.price-calc-mode {
  text-align: left;
  border: 1px solid #dbe4f0;
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.price-calc-mode.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.price-calc-mode strong,
.price-calc-mode span {
  display: block;
}
.price-calc-mode strong {
  font-size: 14px;
  color: #0f172a;
}
.price-calc-mode span {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}
.price-calc-inputs {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  gap: 10px;
}
.price-calc-inputs label {
  display: grid;
  gap: 4px;
  color: #475569;
  font-size: 12px;
}
.price-calc-inputs input {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0 10px;
  font-weight: 700;
}
.price-calc-inputs input:disabled {
  background: #eef2f7;
  color: #94a3b8;
}
.price-calc-formulas {
  margin-top: 12px;
  flex-wrap: wrap;
}
.price-calc-formulas span {
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}
.price-calc-formulas span + span {
  background: #dcfce7;
  color: #166534;
}
.team1-cost-pill {
  display: inline-flex;
  min-width: 74px;
  justify-content: flex-end;
  border-radius: 7px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  padding: 6px 8px;
  font-weight: 700;
}
@media (max-width: 900px) {
  .price-calc-head,
  .price-calc-body {
    display: grid;
  }
  .price-calc-modes,
  .price-calc-inputs {
    grid-template-columns: 1fr;
  }
}

/* DATA page v20260518a */
.data-page {
  max-width: 1280px;
}
.data-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 16px;
  padding: 22px 24px;
  border: 1px solid #dbe4f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #fff;
}
.data-kicker {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.data-hero h1 {
  margin: 4px 0;
  font-size: 28px;
}
.data-hero p {
  margin: 0;
  color: #64748b;
}
.data-hero button,
.data-open-btn {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #0f172a;
  padding: 9px 12px;
  font-weight: 700;
  text-decoration: none;
}
.data-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.data-kpis article {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  padding: 14px 16px;
}
.data-kpis span {
  display: block;
  color: #64748b;
  font-size: 12px;
}
.data-kpis strong {
  display: block;
  margin-top: 5px;
  font-size: 30px;
  color: #0f172a;
}
.data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.data-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.data-tabs button {
  border: 1px solid #dbe4f0;
  background: #fff;
  border-radius: 999px;
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 700;
}
.data-tabs button.active {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
}
#dataSearchInput {
  width: min(420px, 100%);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
}
.data-table-card {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  overflow: hidden;
}
.data-table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}
.data-product-cell {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 320px;
}
.data-product-thumb {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #f1f5f9;
  overflow: hidden;
  flex: 0 0 auto;
}
.data-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.data-product-cell strong,
.data-product-cell small {
  display: block;
}
.data-product-cell small {
  margin-top: 4px;
  color: #64748b;
}
.data-chip {
  display: inline-flex;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}
.data-chip.ok {
  background: #dcfce7;
  color: #047857;
}
.data-chip.warn {
  background: #fef3c7;
  color: #b45309;
}
.data-chip.done {
  background: #e0f2fe;
  color: #0369a1;
}
.data-empty {
  padding: 44px;
  text-align: center;
}
@media (max-width: 900px) {
  .data-hero,
  .data-toolbar {
    display: grid;
  }
  .data-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Team1 total CNY + formula editor v20260518a */
.price-calc-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.price-calc-secondary {
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #fff;
  color: #1d4ed8;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
.price-calc-secondary:hover {
  background: #eff6ff;
}
.price-calc-inputs {
  grid-template-columns: repeat(4, minmax(115px, 1fr));
  min-width: 520px;
}
.price-calc-inputs label:first-child {
  color: #0f172a;
}
.price-calc-inputs label:first-child input {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.14);
}
.formula-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.48);
  padding: 24px;
}
.formula-editor-modal.hidden {
  display: none;
}
.formula-editor-dialog {
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  padding: 20px;
}
.formula-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.formula-editor-head h3 {
  margin: 0;
  font-size: 22px;
}
.formula-editor-head p {
  margin: 4px 0 0;
  color: #64748b;
}
.formula-close {
  border: 1px solid #d8dee8;
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.formula-editor-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.formula-editor-tabs button {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}
.formula-editor-tabs button.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.formula-field {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  font-weight: 700;
  color: #334155;
}
.formula-field textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.45;
}
.formula-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}
.formula-vars span {
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.formula-test-result {
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-weight: 700;
}
.formula-test-result.ok {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}
.formula-test-result.bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.formula-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .price-calc-inputs {
    min-width: 0;
  }
  .price-calc-actions,
  .formula-editor-actions {
    flex-wrap: wrap;
  }
  .formula-editor-tabs {
    grid-template-columns: 1fr;
  }
}


/* Category paste assist v20260518a */
.cat-link-assist {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #CFE2FF;
  border-radius: 8px;
  background: linear-gradient(180deg, #F8FBFF, #FFFFFF);
}
.cat-link-assist-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.cat-link-assist-copy strong {
  font-size: 13px;
  color: #174EA6;
}
.cat-link-assist-copy span {
  font-size: 12px;
  color: var(--text-muted);
}
.cat-link-assist-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.cat-link-assist-row input {
  height: 36px;
  border-color: #BBD3FF;
}
.cat-link-detect {
  height: 36px;
  background: #2563EB;
  border-color: #2563EB;
  color: #fff;
  font-weight: 700;
}
.cat-link-detect:hover {
  background: #1D4ED8;
}
.cat-link-suggestions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.cat-link-suggestion {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #DCE7FA;
  border-radius: 8px;
  background: #fff;
}
.cat-link-suggestion:first-child {
  border-color: #2563EB;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .08);
}
.cat-link-suggestion p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text);
}
.cat-link-suggestion small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
}
.cat-link-suggestion button {
  white-space: nowrap;
  color: #174EA6;
  border-color: #BBD3FF;
  background: #F8FBFF;
}
.cat-link-best {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #DCFCE7;
  color: #166534;
  font-size: 11px;
  font-weight: 700;
}
.cat-link-empty {
  padding: 10px 12px;
  border: 1px dashed #F59E0B;
  border-radius: 8px;
  background: #FFFBEB;
  color: #92400E;
  font-size: 13px;
}
@media (max-width: 720px) {
  .cat-link-assist-copy,
  .cat-link-assist-row,
  .cat-link-suggestion {
    grid-template-columns: 1fr;
  }
  .cat-link-assist-copy {
    display: grid;
  }
}


/* Category assist modal fit v20260518b */
.cat-modal-search {
  display: grid;
  gap: 10px;
}
.cat-link-assist {
  background: linear-gradient(135deg, #F8FAFF 0%, #EEF6FF 100%);
}


/* Team 1 send readiness guard v20260518a */
.team1-send-readiness {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #D7E2F0;
  border-radius: 8px;
  background: #F8FAFC;
  display: grid;
  gap: 8px;
}
.team1-send-readiness .send-ready-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.team1-send-readiness strong {
  font-size: 14px;
}
.team1-send-readiness span,
.team1-send-readiness li {
  font-size: 12px;
}
.team1-send-readiness ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}
.team1-send-readiness.blocked {
  border-color: #FDBA74;
  background: #FFF7ED;
  color: #9A3412;
}
.team1-send-readiness.ready {
  border-color: #86EFAC;
  background: #F0FDF4;
  color: #166534;
}
.send-ready-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.send-ready-pills span {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #DCFCE7;
  color: #166534;
  font-weight: 700;
}
.team1-footer-actions {
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#sendBtn.is-blocked {
  background: #64748B;
  border-color: #64748B;
}
@media (max-width: 720px) {
  .team1-send-readiness .send-ready-title {
    display: grid;
  }
}


/* Team 1 send in-flight lock v20260518a */
#sendBtn.is-sending {
  cursor: progress;
  opacity: 0.86;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
#sendBtn:disabled,
#saveBtn:disabled {
  cursor: not-allowed;
}


/* Supabase Google auth panel v20260520a */
.auth-panel {
  max-width: 980px;
  margin: 18px auto;
  border-color: #BFDBFE;
  background: linear-gradient(135deg, #EFF6FF 0%, #F8FBFF 55%, #FFFFFF 100%);
}
.auth-panel h3 {
  margin-bottom: 6px;
}
.auth-actions-google {
  display: flex;
  margin-top: 14px;
}
.google-login-main {
  min-height: 42px;
  padding: 0 18px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}
.google-login-main::before {
  content: "G";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  background: #fff;
  color: #2563EB;
  font-weight: 900;
}
.auth-magic-fallback {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #DBEAFE;
}
.auth-magic-fallback summary {
  width: fit-content;
  cursor: pointer;
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
}
.auth-magic-fallback .auth-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}
@media (max-width: 720px) {
  .auth-magic-fallback .auth-actions,
  .auth-actions-google {
    grid-template-columns: 1fr;
  }
  .google-login-main {
    width: 100%;
    justify-content: center;
  }
}


/* THAISURE app-login mode */
.app-login-panel {
  max-width: 980px;
  margin: 24px auto 18px;
  padding: 0 16px;
}
.app-login-card {
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.08);
}
.app-login-kicker {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.app-login-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.app-login-card p {
  margin: 0 0 12px;
  color: #334155;
}
.app-login-actions {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}
.app-login-actions input {
  height: 40px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
}
.auth-reason {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 2px 0 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
}
.app-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 12px;
}
.app-user-pill button {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}
.app-user-pill button:hover {
  border-color: #ef4444;
  color: #b91c1c;
}
@media (max-width: 720px) {
  .app-login-actions { grid-template-columns: 1fr; }
}
