/* PROTOTYPE — Phase 2 shared shell. Match Phase-1 Ant Design tokens. */
:root {
  --primary: #1677FF;
  --primary-hover: #4096FF;
  --primary-light: #E6F4FF;
  --success: #52C41A;
  --success-light: #F6FFED;
  --warning: #FAAD14;
  --warning-light: #FFFBE6;
  --error: #FF4D4F;
  --error-light: #FFF2F0;
  --purple: #722ED1;
  --purple-light: #F9F0FF;
  --text-main: #1F1F1F;
  --text-secondary: #595959;
  --text-muted: #BFBFBF;
  --border-color: #D9D9D9;
  --border-color-split: #F0F0F0;
  --bg: #F5F5F5;
  --card-bg: #ffffff;
  --sidebar-w: 240px;
  --header-h: 64px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05), 0 1px 6px -1px rgba(0,0,0,0.03);
  --shadow-md: 0 6px 16px 0 rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05);
  --radius: 6px;
  --radius-lg: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
  background: var(--bg); color: var(--text-main); font-size: 14px;
  display: flex; height: 100vh; overflow: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--card-bg);
  border-right: 1px solid var(--border-color-split);
  display: flex; flex-direction: column; z-index: 10; flex-shrink: 0;
}
.logo {
  height: var(--header-h); display: flex; align-items: center;
  padding: 0 20px; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid var(--border-color-split); gap: 8px; flex-shrink: 0;
}
.logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg,#1677ff,#13c2c2);
  border-radius: 6px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: bold;
}
.logo-icon.admin { background: linear-gradient(135deg,#fa8c16,#faad14); }

/* Logo image style for 优美丝路 */
.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

.menu { flex: 1; overflow-y: auto; padding: 12px 0; }
.menu-title {
  padding: 12px 24px 6px 24px; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.menu-item {
  margin: 4px 12px; padding: 8px 12px; cursor: pointer;
  color: var(--text-main); border-radius: var(--radius);
  transition: all 0.1s ease; display: flex; align-items: center;
  gap: 10px; font-size: 14px; position: relative; text-decoration: none;
}
.menu-item i, .menu-item svg { width: 18px; height: 18px; text-align: center; flex-shrink: 0; font-size: 15px; }
.btn svg, .header-item svg, .page-note-chip svg, .prototype-scenario svg { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.menu-item:hover { color: var(--primary); background: #fafafa; }
.menu-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.menu-item.phase1-link { color: var(--text-secondary); }
.menu-item.phase1-link:hover { color: var(--primary); }
.menu-item.disabled {
  opacity: 0.5; cursor: not-allowed !important;
  color: var(--text-muted) !important; background: transparent !important;
}
.menu-badge {
  background: var(--error); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 8px; margin-left: auto;
}
.menu-tag-p1 {
  font-size: 10px; color: var(--text-muted); margin-left: auto;
  background: #fafafa; border: 1px solid var(--border-color-split);
  padding: 0 4px; border-radius: 4px; line-height: 16px;
}
.menu-tag-p2 {
  font-size: 10px; color: var(--primary); margin-left: auto;
  background: var(--primary-light); border: 1px solid #91d5ff;
  padding: 0 4px; border-radius: 4px; line-height: 16px;
}
.page-notes { display:inline-flex; gap:6px; margin-top:6px; }
.page-note-chip {
  display:inline-flex; align-items:center; justify-content:center;
  width:20px; height:20px; border-radius:50%;
  background:#f0f5ff; color:var(--primary); border:1px solid #adc6ff;
  font-size:11px; cursor:help;
}
.page-note-chip:hover { background:var(--primary); color:#fff; }

.menu-tag-low {
  font-size: 10px; color: #d46b08; margin-left: 4px;
  background: #fff7e6; border: 1px solid #ffd591;
  padding: 0 4px; border-radius: 4px; line-height: 16px;
}

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.header {
  height: var(--header-h); background: var(--card-bg);
  border-bottom: 1px solid var(--border-color-split);
  display: flex; justify-content: flex-end; align-items: center;
  padding: 0 24px; gap: 20px; color: var(--text-secondary); flex-shrink: 0;
}
.prototype-scenario {
  display: inline-flex; align-items: center; gap: 8px; margin-right: auto;
  color: var(--text-secondary); font-size: 13px;
}
.prototype-scenario select {
  height: 30px; border: 1px solid var(--border-color); border-radius: var(--radius);
  background: #fff; color: var(--text-main); padding: 0 28px 0 10px; font-size: 13px;
}
.prototype-scenario-static {
  cursor: default;
}
.prototype-scenario-static .tag {
  margin-left: 2px;
}
.scenario-panel[hidden] { display: none !important; }

.header-item {
  cursor: pointer; transition: color 0.1s;
  display: flex; align-items: center; gap: 8px;
}
.header-item:hover { color: var(--primary); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px;
}
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* Shared components */
.card {
  background: var(--card-bg); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color-split);
}
.card-title {
  font-size: 16px; font-weight: 600; margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.card + .card { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; height: 32px; padding: 0 15px; border-radius: var(--radius);
  cursor: pointer; transition: all 0.1s ease; font-size: 14px;
  font-weight: 400; border: none; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #ff7875; }
.btn:disabled, .btn-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-sm { height: 24px; padding: 0 7px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0; height: auto; }
.btn-lg { height: 40px; padding: 0 24px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tag {
  padding: 0 7px; border-radius: var(--radius); font-size: 12px;
  border: 1px solid; display: inline-block; height: 22px; line-height: 20px;
}
.tag-blue { background: var(--primary-light); border-color: #91d5ff; color: var(--primary); }
.tag-green { background: var(--success-light); border-color: #b7eb8f; color: var(--success); }
.tag-orange { background: var(--warning-light); border-color: #ffd591; color: #d46b08; }
.tag-red { background: var(--error-light); border-color: #ffa39e; color: var(--error); }
.tag-gray { background: #fafafa; border-color: var(--border-color); color: var(--text-secondary); }
.tag-purple { background: var(--purple-light); border-color: #d3adf7; color: var(--purple); }

.form-input {
  width: 100%; height: 32px; padding: 4px 11px;
  border: 1px solid var(--border-color); border-radius: var(--radius);
  font-size: 14px; outline: none; background: #fff; color: var(--text-main);
  transition: all 0.1s ease;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,0.2); }
.form-label { font-size: 14px; color: var(--text-main); margin-bottom: 6px; display: block; }
.form-required::after { content: ' *'; color: var(--error); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
select.form-input { padding: 0 11px; }
textarea.form-input { height: auto; min-height: 80px; padding: 8px 11px; resize: vertical; }

.ant-table { width: 100%; border-collapse: collapse; }
.ant-table th {
  padding: 12px 16px; background: #fafafa;
  border-bottom: 1px solid var(--border-color-split);
  color: var(--text-main); font-weight: 600; font-size: 14px;
  text-align: left; white-space: nowrap;
}
.ant-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border-color-split); font-size: 14px;
}
.ant-table tr:hover td { background: #fafafa; }
.ant-table tr:last-child td { border-bottom: none; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.metrics-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card { padding: 20px 24px; }
.metric-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.metric-value { font-size: 28px; font-weight: 600; }
.metric-footer { font-size: 12px; margin-top: 8px; color: var(--text-secondary); }

/* Compact Status & Quick Filter Strip */
.stat-filter-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 10px 14px; background: #fff;
  border: 1px solid var(--border-color-split); border-radius: var(--radius-lg);
}
.stat-filter-title {
  font-size: 13px; font-weight: 600; color: var(--text-main); margin-right: 4px;
  display: flex; align-items: center; gap: 6px;
}
.stat-filter-item {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 6px; background: #f7f8fa; border: 1px solid var(--border-color-split);
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s ease; user-select: none; text-decoration: none;
}
.stat-filter-item:hover {
  background: #e6f4ff; border-color: #91caff; color: var(--primary);
}
.stat-filter-item.active {
  background: #e6f4ff; border-color: var(--primary); color: var(--primary); font-weight: 500;
}
.stat-filter-item .stat-num {
  font-size: 13px; font-weight: 600; color: var(--text-main);
}
.stat-filter-item .stat-num.color-primary { color: var(--primary); }
.stat-filter-item .stat-num.color-success { color: var(--success); }
.stat-filter-item .stat-num.color-warning { color: #d46b08; }
.stat-filter-item .stat-num.color-error { color: var(--error); }
.stat-filter-item .stat-num.color-blue { color: #1677ff; }
.stat-filter-divider {
  width: 1px; height: 18px; background: var(--border-color-split); margin: 0 4px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.main-side { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }

.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border-color-split); margin-bottom: 20px; }
.tab-item {
  padding: 10px 20px; cursor: pointer; color: var(--text-secondary);
  font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.pagination {
  display: flex; gap: 8px; align-items: center;
  justify-content: flex-end; margin-top: 16px;
}
.pagination span {
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border-color-split); font-size: 13px;
}
.pagination span:hover { color: var(--primary); border-color: var(--primary); }
.pagination span.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 16px; padding: 16px; background: #fff;
  border: 1px solid var(--border-color-split); border-radius: var(--radius-lg);
}
.filter-bar .form-input { width: auto; min-width: 140px; }

.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--border-color-split);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: ''; position: absolute; left: -20px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item.done::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-item.error::before { background: var(--error); box-shadow: 0 0 0 2px var(--error); }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-time { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-text { font-size: 14px; }

.progress-bar { height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--primary); }
.progress-fill.green { background: var(--success); }
.progress-fill.orange { background: var(--warning); }
.progress-fill.red { background: var(--error); }

.banner {
  font-size: 12px; padding: 10px 14px; border-radius: 6px;
  margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px; line-height: 1.6;
}
.banner-info { background: #e6f4ff; border: 1px solid #91caff; color: var(--text-secondary); }
.banner-info i { color: #0958d9; margin-top: 2px; }
.banner-warn { background: var(--warning-light); border: 1px solid #ffd591; color: var(--text-secondary); }
.banner-warn i { color: #d46b08; margin-top: 2px; }
.banner-success { background: var(--success-light); border: 1px solid #b7eb8f; color: var(--text-secondary); }
.banner-success i { color: var(--success); margin-top: 2px; }

.phase1-stub {
  text-align: center; padding: 64px 24px;
  background: #fff; border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}
.phase1-stub .icon { font-size: 40px; color: var(--text-muted); margin-bottom: 16px; }
.phase1-stub h3 { font-size: 18px; margin-bottom: 8px; }
.phase1-stub p { color: var(--text-secondary); margin-bottom: 20px; max-width: 420px; margin-left: auto; margin-right: auto; }

.platform-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px; font-size: 12px;
  background: #fafafa; border: 1px solid var(--border-color-split);
}
.stepper { display: flex; gap: 0; margin-bottom: 24px; }
.stepper-item {
  flex: 1; text-align: center; position: relative; padding: 0 8px;
}
.stepper-item::after {
  content: ''; position: absolute; top: 14px; left: 50%; right: -50%;
  height: 2px; background: var(--border-color-split); z-index: 0;
}
.stepper-item:last-child::after { display: none; }
.stepper-dot {
  width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  background: #fafafa; border: 2px solid var(--border-color);
  font-size: 12px; font-weight: 600; position: relative; z-index: 1;
  color: var(--text-secondary);
}
.stepper-item.active .stepper-dot,
.stepper-item.done .stepper-dot {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.stepper-item.done .stepper-dot { background: var(--success); border-color: var(--success); }
.stepper-item.done::after { background: var(--success); }
.stepper-item.active::after { background: linear-gradient(90deg, var(--primary), var(--border-color-split)); }
.stepper-label { font-size: 12px; color: var(--text-secondary); }
.stepper-item.active .stepper-label { color: var(--primary); font-weight: 600; }

.modal-overlay,
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10000;
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.show,
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg); padding: 24px 32px;
  width: 560px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal.wide { width: 800px; }
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }


/* Shared multi-platform listing selector. It is rendered from the product master page. */
.modal.listing-modal {
  width: min(900px, 94vw);
  max-height: 88vh;
  padding: 24px 28px;
}
.modal.listing-modal h3 { margin-bottom: 8px; }
.listing-product-toolbar,
.listing-target-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  margin-bottom: 10px;
}
.listing-product-toolbar b,
.listing-target-toolbar b { font-size: 13px; }
.listing-product-toolbar .count,
.listing-target-toolbar .count {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 12px;
}
.listing-product-list,
.listing-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.listing-product-card,
.listing-target-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.listing-product-card:hover,
.listing-target-card:hover:not(.disabled) {
  border-color: #91caff;
  box-shadow: var(--shadow-sm);
}
.listing-product-card.selected,
.listing-target-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.listing-product-card input,
.listing-target-card input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--primary);
}
.listing-product-card > span,
.listing-target-card > span { min-width: 0; }
.listing-product-card .name,
.listing-target-card .name {
  display: block;
  overflow: hidden;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.listing-product-card .meta,
.listing-target-card .meta {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}
.listing-target-card .reason {
  display: block;
  margin-top: 5px;
  color: #d46b08;
  font-size: 11px;
  line-height: 1.45;
}
.listing-target-card.disabled {
  background: #fafafa;
  cursor: not-allowed;
  opacity: .72;
}
.listing-target-card.disabled .name,
.listing-target-card.disabled .meta { color: var(--text-muted); }
.modal.listing-modal #listingBatchSummary {
  margin-top: 14px !important;
  padding: 12px 14px;
  border-color: #91caff;
  background: #f7fbff;
  line-height: 1.6;
}
.modal.listing-modal #listingBatchSummary[hidden] { display: none !important; }
.modal.listing-modal .modal-footer {
  flex: 0 0 auto;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color-split);
}
@media (max-width: 700px) {
  .modal.listing-modal { padding: 20px; }
  .listing-product-list,
  .listing-target-grid { grid-template-columns: 1fr; }
  .listing-product-toolbar,
  .listing-target-toolbar { flex-wrap: wrap; }
  .listing-product-toolbar .count,
  .listing-target-toolbar .count { margin-left: 0; }
}

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 10000;
  display: none;
}
.drawer-overlay.show { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; width: 560px; max-width: 95vw;
  height: 100vh; background: #fff; z-index: 10001;
  box-shadow: var(--shadow-md); transform: translateX(100%);
  transition: transform 0.2s ease; display: flex; flex-direction: column;
}
.drawer.wide { width: 800px; max-width: 95vw; }
.drawer-overlay.show .drawer { transform: translateX(0); }
.drawer-header {
  padding: 16px 24px; border-bottom: 1px solid var(--border-color-split);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 600; flex-shrink: 0;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-color-split);
  display: flex; justify-content: flex-end; gap: 12px; flex-shrink: 0;
  background: #fff; position: relative; z-index: 10;
}

.toast-container {
  position: fixed; top: 24px; right: 24px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #fff; border: 1px solid var(--border-color-split);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px; min-width: 280px;
  animation: slideIn 0.2s ease;
}
.toast.success i { color: var(--success); }
.toast.error i { color: var(--error); }
.toast.info i { color: var(--primary); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.breadcrumb { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.bold { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.stat-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border-color-split); font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }

.store-card {
  border: 1px solid var(--border-color-split); border-radius: var(--radius-lg);
  padding: 20px; background: #fff; transition: border-color 0.15s;
}
.store-card:hover { border-color: var(--primary); }
.store-card .platform-logo {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 12px;
}
.plat-wb { background: #cb11ab; }
.plat-kaspi { background: #f14635; }
.plat-ym { background: #fc0; color: #333 !important; }
.plat-ozon { background: #005bff; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

.alert-strip {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: 6px; font-size: 12px; margin-top: 8px;
}
.alert-strip.error { background: var(--error-light); color: var(--error); }
.alert-strip.warn { background: var(--warning-light); color: #d46b08; }

.prototype-badge {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 50; background: #1f1f1f; color: #fff; font-size: 11px;
  padding: 6px 14px; border-radius: 20px; opacity: 0.75;
  pointer-events: none; letter-spacing: 0.3px;
}

/* Label print preview */
.label-preview-wrap {
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  padding: 16px; background: #fafafa; border-radius: 8px; border: 1px dashed var(--border-color);
}
.label-sheet {
  background: #fff; border: 1px solid #333; box-shadow: var(--shadow-sm);
  font-family: 'Courier New', monospace; position: relative; overflow: hidden;
}
.label-sheet.a4 {
  width: 100%; max-width: 420px; min-height: 280px; padding: 16px 18px;
}
.label-sheet.thermal {
  width: 220px; min-height: 140px; padding: 10px 12px;
  border: 2px solid #111;
}
.label-sheet .lp-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; letter-spacing: 0.5px; }
.label-sheet .lp-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 4px; gap: 8px; }
.label-sheet .lp-barcode {
  margin-top: 10px; height: 36px; background:
    repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 5px, #fff 5px 8px);
  border-radius: 2px;
}
.label-sheet .lp-code { text-align: center; font-size: 11px; margin-top: 4px; letter-spacing: 1px; }
.label-sheet .lp-qr {
  width: 48px; height: 48px; border: 2px solid #111;
  background:
    linear-gradient(45deg, #111 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(-45deg, #111 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(45deg, transparent 75%, #111 75%) -4px 0 / 8px 8px,
    linear-gradient(-45deg, transparent 75%, #111 75%) -4px 0 / 8px 8px;
  background-color: #fff;
}
.label-sheet.thermal .lp-title { font-size: 11px; }
.label-sheet.thermal .lp-row { font-size: 10px; }
.label-sheet.thermal .lp-barcode { height: 28px; }

/* Import validation result rows */
.import-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px;
}
.import-summary .cell {
  background: #fafafa; border: 1px solid var(--border-color-split);
  border-radius: 6px; padding: 10px 12px; text-align: center;
}
.import-summary .cell .n { font-size: 20px; font-weight: 600; line-height: 1.2; }
.import-summary .cell .l { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.row-ok td:first-child, .row-err td:first-child { border-left: 3px solid transparent; }
.row-ok td:first-child { border-left-color: var(--success); }
.row-err td:first-child { border-left-color: var(--error); }

/* Billing event chain */
.event-chain {
  display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 8px 0 4px;
}
.event-chain .node {
  flex: 0 0 auto; min-width: 140px; padding: 10px 12px;
  background: #fafafa; border: 1px solid var(--border-color-split); border-radius: 6px;
  font-size: 12px; position: relative;
}
.event-chain .node + .node { margin-left: 28px; }
.event-chain .node + .node::before {
  content: '→'; position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}
.event-chain .node .k { color: var(--text-muted); font-size: 11px; margin-bottom: 4px; }
.event-chain .node .v { font-weight: 600; word-break: break-all; }

/* Platform field blocks in listing */
.plat-field-block {
  border: 1px solid var(--border-color-split); border-radius: 6px;
  padding: 12px 14px; margin-bottom: 10px; background: #fafafa;
}
.plat-field-block .pf-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-weight: 600; font-size: 13px;
}

button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

@media (max-width: 1366px) {
  :root { --sidebar-w: 200px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .main-side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .two-col, .three-col, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .metrics-grid, .metrics-grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ─── i18n language-tab input component ────────────────────────────────────
   Usage:  <div class="i18n-input">
             <div class="i18n-tabs"> ... <button class="i18n-tab active"> </div>
             <div class="i18n-panels"> ... <div class="i18n-panel active"> </div>
           </div>
   Add class "i18n-compact" for use inside table cells.
   ────────────────────────────────────────────────────────────────────────── */
.i18n-input {
  border: 1px solid var(--border-color-split);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.i18n-tabs {
  display: flex;
  background: var(--bg-component);
  border-bottom: 1px solid var(--border-color-split);
  padding: 0 2px;
}
.i18n-tab {
  padding: 6px 14px;
  font-size: 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  margin-bottom: -1px;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.i18n-tab:hover { color: var(--primary); }
.i18n-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}
.i18n-required { color: var(--error); font-size: 11px; margin-left: 1px; }
.i18n-panel { display: none; }
.i18n-panel.active { display: block; }
.i18n-input .form-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}
.i18n-input .form-input:focus {
  outline: none;
  border-bottom: 1.5px solid var(--primary);
}
/* compact variant: tighter padding for table cells */
.i18n-compact .i18n-tab { padding: 4px 10px; font-size: 11px; }
.i18n-compact .form-input { font-size: 12px; padding: 5px 8px; }

/* ─── market multi-select chips ─────────────────────────────────────────────
   Usage: <div class="market-chips">
            <button class="market-chip selected" ...>KZ</button>
          </div>
   Toggle selection via JS toggleMarketChip(el).
   ────────────────────────────────────────────────────────────────────────── */
.market-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 120px; }
.market-chip {
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--border-color-split);
  border-radius: 4px;
  background: #fff;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.6;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.market-chip:hover { border-color: var(--primary); color: var(--primary); }
.market-chip.selected {
  background: #e6f4ff;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
}
/* file-upload button styled inline */
.compliance-upload {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; font-size: 12px;
  border: 1px solid var(--border-color-split); border-radius: 4px;
  background: #fff; color: var(--text-secondary);
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.compliance-upload:hover { border-color: var(--primary); color: var(--primary); }
.compliance-upload input[type="file"] { display: none; }

/* Domestic waybill product-list print preview */
.waybill-print-sheet {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 28px;
  color: #1f1f1f;
  background: #fff;
  font-size: 13px;
}
.waybill-print-sheet h1 {
  margin: 0 0 18px;
  font-size: 22px;
  text-align: center;
}
.waybill-print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  margin-bottom: 18px;
}
.waybill-print-sheet table {
  width: 100%;
  border-collapse: collapse;
}
.waybill-print-sheet th,
.waybill-print-sheet td {
  padding: 8px 10px;
  border: 1px solid #d9d9d9;
  text-align: left;
}
.waybill-print-sheet th { background: #fafafa; font-weight: 600; }
.waybill-print-footer {
  margin-top: 18px;
  color: #595959;
  font-size: 12px;
  text-align: right;
}
body.printing-domestic-waybill {
  display: block;
  height: auto;
  overflow: visible;
  background: #fff;
}
body.printing-domestic-waybill > :not(#domesticWaybillPrintSheet) {
  display: none !important;
}
body.printing-domestic-waybill > #domesticWaybillPrintSheet { display: block; }

@media print {
  @page { margin: 12mm; }
  body.printing-domestic-waybill {
    display: block;
    height: auto;
    overflow: visible;
    background: #fff;
  }
  body.printing-domestic-waybill > :not(#domesticWaybillPrintSheet) {
    display: none !important;
  }
  body.printing-domestic-waybill > #domesticWaybillPrintSheet {
    display: block !important;
    max-width: none;
    padding: 0;
  }
}

/* Unit Economics & Price Tier Styles */
.price-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 14px 0;
}
.price-tier-card {
  border: 1px solid var(--border-color-split);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.price-tier-card:hover {
  box-shadow: var(--shadow-sm);
}
.price-tier-card.active {
  background: #f0f7ff;
  border-color: #91caff;
  box-shadow: 0 2px 8px rgba(22,119,255,0.12);
}
.price-tier-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.price-tier-val {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  margin-bottom: 4px;
}
.cost-chain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cost-chain-table th, .cost-chain-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color-split);
  text-align: left;
}
.cost-chain-table th {
  background: #fafafa;
  color: var(--text-secondary);
  font-weight: 600;
}
.cost-chain-table tr:hover td {
  background: #fcfcfc;
}

/* --- AI Visual Studio Modal Styles --- */
.ai-style-chips, .ai-ratio-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ai-style-chip, .ai-ratio-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-secondary, #595959);
  background: #f5f5f5;
  border: 1px solid var(--border-color, #d9d9d9);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
  outline: none;
  user-select: none;
}

.ai-style-chip:hover, .ai-ratio-chip:hover {
  color: var(--primary, #1677ff);
  border-color: #91caff;
  background: #fafafa;
}

.ai-style-chip.selected, .ai-ratio-chip.selected {
  color: #fff;
  background: var(--primary, #1677ff);
  border-color: var(--primary, #1677ff);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(22, 119, 255, 0.2);
}

.ai-candidate-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .ai-candidate-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ai-candidate-card {
  position: relative;
  border: 1.5px solid var(--border-color-split, #f0f0f0);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.ai-candidate-card:hover {
  border-color: #91caff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.ai-candidate-card.selected {
  border-color: var(--primary, #1677ff);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2), 0 4px 12px rgba(22, 119, 255, 0.12);
  background: #f0f7ff;
}

.ai-candidate-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.2s ease;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
}

.ai-candidate-card.selected .ai-candidate-check {
  background: var(--primary, #1677ff);
  border-color: #fff;
  box-shadow: 0 2px 6px rgba(22, 119, 255, 0.4);
}

.ai-candidate-grid.single-select-mode .ai-candidate-card.selected .ai-candidate-check {
  background: var(--primary, #1677ff);
}

.ai-candidate-img {
  width: 100%;
  height: 135px;
  background: #f5f5f5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px 6px 0 0;
}

.ai-candidate-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}

.ai-candidate-card:hover .ai-candidate-img img {
  transform: scale(1.05);
}

.ai-candidate-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  background: #fff;
}

.ai-candidate-card.selected .ai-candidate-info {
  background: #f0f7ff;
}

.ai-candidate-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main, #262626);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-candidate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.ai-candidate-meta .tag {
  font-size: 10px;
  padding: 1px 6px;
  line-height: 16px;
  margin: 0;
}

.ai-candidate-order-badge {
  font-size: 10px;
  color: var(--text-muted, #8c8c8c);
  font-family: var(--font-mono, monospace);
}

/* --- AI Reference Image (Img2Img) Styles --- */
.ai-ref-image-box {
  border: 1px dashed var(--border-color, #d9d9d9);
  border-radius: 6px;
  background: #fafafa;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.ai-ref-image-box:hover {
  border-color: var(--primary, #1677ff);
  background: #f0f7ff;
}

.ai-ref-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  cursor: pointer;
  text-align: center;
  width: 100%;
}

.ai-ref-preview-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  width: 100%;
  background: #fff;
  border-radius: 6px;
  position: relative;
}

.ai-ref-preview-wrap img {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border-color-split, #f0f0f0);
  background: #f5f5f5;
  flex-shrink: 0;
}

.ai-ref-preview-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ai-ref-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main, #262626);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-ref-preview-desc {
  font-size: 11px;
  color: var(--text-secondary, #595959);
}

.ai-ref-chips {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.ai-ref-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--text-muted, #8c8c8c);
  cursor: pointer;
  padding: 2px;
}

.ai-ref-remove-btn:hover {
  color: var(--error, #ff4d4f);
}

/* --- AI Image Gallery & Preview Styles --- */
.ai-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 860px) {
  .ai-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ai-gallery-card {
  border: 1px solid var(--border-color-split, #f0f0f0);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  position: relative;
}

.ai-gallery-card:hover {
  border-color: #91caff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.ai-gallery-thumb {
  position: relative;
  width: 100%;
  height: 140px;
  background: #f5f5f5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ai-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}

.ai-gallery-card:hover .ai-gallery-thumb img {
  transform: scale(1.05);
}

.ai-gallery-thumb-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  backdrop-filter: blur(4px);
  z-index: 2;
}

.ai-gallery-thumb-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 2;
}

.ai-gallery-card:hover .ai-gallery-thumb-actions {
  opacity: 1;
  transform: translateY(0);
}

.ai-gallery-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main, #262626);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ai-gallery-action-btn:hover {
  background: var(--primary, #1677ff);
  color: #fff;
  border-color: var(--primary, #1677ff);
}

.ai-gallery-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  background: #fff;
}

.ai-gallery-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main, #262626);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-gallery-prompt {
  font-size: 11px;
  color: var(--text-secondary, #595959);
  line-height: 1.4;
  height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  background: #fafafa;
  padding: 4px 6px;
  border-radius: 4px;
}

.ai-gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted, #8c8c8c);
  margin-top: auto;
}

.ai-gallery-foot-btns {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color-split, #f0f0f0);
}



