:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #e2e7ed;
  --line-strong: #d3dae3;
  --text: #1d2733;
  --text-2: #4f5b68;
  --muted: #7c8794;
  --primary: #00a79d;
  --primary-strong: #008f87;
  --primary-soft: #e6f7f5;
  --danger: #d64545;
  --danger-soft: #fdf0f0;
  --warning: #d9822b;
  --warning-soft: #fff7e9;
  --success: #2e9e5b;
  --success-soft: #eaf7ef;
  --media: #3d7fbf;
  --media-soft: #eaf4ff;
  --activity: #7b5cd6;
  --activity-soft: #f1edff;
  --shadow: 0 1px 2px rgba(20, 31, 43, 0.05), 0 8px 24px rgba(20, 31, 43, 0.05);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #1d2733;
  color: #fff;
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand-text {
  min-width: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
}

.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

.chip-button svg,
.header-chip svg {
  width: 15px;
  height: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: #f5f7f9;
  border-color: #b9c4cf;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn-ghost:hover {
  background: #eef1f4;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #bd3a3a;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  flex: 0 0 auto;
}

.icon-btn:hover {
  background: #edf0f3;
  color: var(--text);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.main {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.batch-panel {
  padding: 18px 20px 16px;
  border-left: 4px solid var(--primary);
}

.batch-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.batch-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.batch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  flex: 0 0 auto;
}

.batch-icon svg {
  width: 23px;
  height: 23px;
}

.batch-title strong {
  display: block;
  font-size: 17px;
}

.batch-title span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.batch-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.batch-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.batch-progress {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.progress-caption {
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e7ebef;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.progress-count {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-width: 0;
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: 0 0 auto;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.icon-neutral {
  background: #eef1f4;
  color: #4f5b68;
}

.icon-success {
  background: var(--success-soft);
  color: var(--success);
}

.icon-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.icon-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-media {
  background: var(--media-soft);
  color: var(--media);
}

.icon-activity {
  background: var(--activity-soft);
  color: var(--activity);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.activity-panel {
  padding: 16px 18px;
}

.activity-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.activity-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  background: #fcfdfe;
}

.activity-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.activity-name {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--activity-soft);
  color: var(--activity);
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}

.activity-rule {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.activity-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.activity-actions {
  display: flex;
  gap: 8px;
}

.activity-actions .btn {
  flex: 1;
}

.products-section {
  padding: 16px 18px;
}

.list-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.selected-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 420px;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: #fbfcfd;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.14);
  background: #fff;
}

.select-control {
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfd;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c8794' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.14);
  background-color: #fff;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.product-table th {
  background: #f7f9fb;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.product-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  min-width: 0;
}

.product-table tbody tr:last-child td {
  border-bottom: 0;
}

.product-table tbody tr {
  transition: background-color 0.12s ease;
}

.product-table tbody tr:hover {
  background: #f7fafb;
}

.product-table tbody tr.status-attention {
  background: #fffaf0;
}

.product-table tbody tr.status-attention:hover {
  background: #fff5df;
}

.product-table tbody tr.status-failed {
  background: #fdf4f4;
}

.product-table tbody tr.status-failed:hover {
  background: #fbeaea;
}

.product-table tbody tr.row-selected {
  box-shadow: inset 3px 0 0 var(--primary);
  background: #f1fbfa;
}

.col-check {
  width: 40px;
}

.col-id {
  width: 64px;
}

.col-media {
  width: 190px;
}

.col-price {
  width: 150px;
}

.col-stock {
  width: 90px;
}

.col-activity {
  width: 140px;
}

.col-status {
  width: 150px;
}

.col-actions {
  width: 156px;
}

.product-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.product-table input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.serial {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.product-name {
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.product-spec {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  margin-top: 5px;
  border-radius: 5px;
  background: #eef1f4;
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
}

.product-intro {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-tiles {
  display: flex;
  align-items: center;
  gap: 5px;
}

.media-tile {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #eef1f4;
  flex: 0 0 auto;
}

.media-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-tile.video-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(18, 25, 33, 0.42);
}

.media-tile.video-tile .play-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
}

.play-mark svg {
  width: 16px;
  height: 16px;
}

.media-count {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.price-original {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 12px;
}

.price-sell {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.discount-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  margin-left: 6px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 600;
}

.activity-price {
  color: var(--activity);
  font-size: 12px;
  margin-top: 3px;
}

.stock-text {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stock-low {
  color: var(--warning);
}

.activity-name-cell {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--activity-soft);
  color: var(--activity);
  font-size: 12px;
  font-weight: 600;
}

.no-activity {
  color: var(--muted);
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge svg {
  width: 13px;
  height: 13px;
}

.status-success {
  background: var(--success-soft);
  color: var(--success);
}

.status-attention {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-reason {
  margin-top: 5px;
  max-width: 220px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-tip] {
  position: relative;
}

[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  max-width: 240px;
  padding: 6px 9px;
  border-radius: 6px;
  background: #1d2733;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(20, 31, 43, 0.2);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.row-actions .icon-btn {
  width: 30px;
  height: 30px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #eef1f4;
  color: var(--muted);
  margin-bottom: 4px;
}

.empty-icon svg {
  width: 25px;
  height: 25px;
}

.empty-state strong {
  color: var(--text-2);
  font-size: 15px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--muted);
  font-size: 12px;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover {
  background: #f2f5f7;
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 0 2px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 31, 43, 0.48);
  backdrop-filter: blur(2px);
}

.modal {
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(20, 31, 43, 0.28);
}

.upload-modal {
  max-width: 760px;
}

.edit-modal {
  max-width: 920px;
}

.activity-modal {
  max-width: 860px;
}

.settings-modal {
  max-width: 560px;
}

.confirm-modal {
  max-width: 420px;
  padding: 26px;
  text-align: center;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.modal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.upload-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 20px;
}

.upload-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.upload-block-head strong {
  display: block;
  font-size: 14px;
}

.upload-block-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 130px;
  padding: 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fafbfc;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #eef1f4;
  color: var(--text-2);
}

.dropzone-icon svg {
  width: 21px;
  height: 21px;
}

.dropzone strong {
  font-size: 13px;
  color: var(--text-2);
}

.dropzone span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  color: var(--text-2);
  font-size: 13px;
  min-width: 0;
}

.file-chip svg:first-child {
  width: 16px;
  height: 16px;
  color: var(--media);
  flex: 0 0 auto;
}

.file-chip span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  padding: 18px 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field > span {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: #fbfcfd;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.14);
  background: #fff;
}

.field input[readonly] {
  background: #eef1f4;
  color: var(--muted);
}

.edit-media-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fafbfc;
}

.edit-media-panel h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.media-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.media-match-row:last-child {
  border-bottom: 0;
}

.media-match-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.media-match-name svg {
  width: 15px;
  height: 15px;
  color: var(--media);
  flex: 0 0 auto;
}

.media-match-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-state {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
}

.match-ok {
  color: var(--success);
}

.match-warn {
  color: var(--warning);
}

.match-err {
  color: var(--danger);
}

.issue-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  border: 1px solid #f4d8d8;
}

.issue-box.warning-box {
  background: var(--warning-soft);
  border-color: #f0ddbe;
}

.issue-box h5 {
  margin: 0 0 6px;
  font-size: 13px;
}

.issue-box p {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.activity-modal-body {
  padding: 14px 20px 18px;
}

.activity-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  color: var(--text-2);
  font-size: 13px;
}

.activity-summary strong {
  color: var(--text);
}

.activity-product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.activity-product-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1.2fr) minmax(90px, 0.6fr) minmax(90px, 0.6fr) minmax(70px, 0.4fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.activity-product-row .row-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-product-row .row-meta {
  color: var(--muted);
  font-size: 12px;
}

.activity-product-row .row-price {
  font-variant-numeric: tabular-nums;
}

.activity-product-row .row-margin {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.margin-low {
  color: var(--danger);
}

.margin-ok {
  color: var(--success);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: 460px;
  max-width: 94vw;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(20, 31, 43, 0.18);
  animation: drawer-in 0.18s ease;
}

@keyframes drawer-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  margin: 0;
  font-size: 17px;
}

.drawer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px 16px 0;
}

.drawer-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  color: var(--text-2);
  font-weight: 600;
}

.drawer-tab svg {
  width: 15px;
  height: 15px;
}

.drawer-tab.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}

.drawer-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 16px;
}

.batch-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.batch-section-title {
  font-weight: 700;
  font-size: 13px;
}

.batch-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.serial-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 6px 0 9px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.serial-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 167, 157, 0.15);
  color: inherit;
}

.serial-chip button svg {
  width: 11px;
  height: 11px;
}

.manual-serial {
  width: 100%;
  min-height: 66px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  resize: vertical;
  outline: none;
  background: #fbfcfd;
  font-size: 13px;
}

.manual-serial:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.14);
  background: #fff;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.radio-row input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.radio-row label {
  flex: 1;
  cursor: pointer;
}

.radio-row label strong {
  display: block;
  font-size: 13px;
}

.radio-row label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f9fb;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
}

.preview-box strong {
  color: var(--text);
}

.preview-box .danger-text {
  color: var(--danger);
  font-weight: 600;
}

.apply-result {
  margin-top: 4px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--success-soft);
  color: var(--success);
  font-size: 13px;
  line-height: 1.6;
}

.apply-result.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.settings-body {
  padding: 18px 20px;
}

.settings-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #eef4ff;
  color: var(--media);
  font-size: 12px;
  line-height: 1.5;
}

.settings-tip svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  margin-bottom: 12px;
}

.confirm-icon svg {
  width: 24px;
  height: 24px;
}

.confirm-modal h3 {
  margin: 0 0 6px;
}

.confirm-modal p {
  margin: 0;
  color: var(--text-2);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #1d2733;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(20, 31, 43, 0.25);
  animation: toast-in 0.2s ease;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.toast.success svg {
  color: #5ad99a;
}

.toast.warning svg {
  color: #f6c15b;
}

.toast.error svg {
  color: #ff8b8b;
}

.toast.info svg {
  color: #7cc7ff;
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

  .activity-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }

  .topbar-actions {
    width: 100%;
  }

  .main {
    padding: 16px;
  }

  .batch-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .batch-actions {
    width: 100%;
  }

  .batch-actions .btn {
    flex: 1;
  }

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

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .list-actions {
    width: 100%;
    justify-content: space-between;
  }

  .edit-layout {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .activity-product-row {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .activity-product-row .row-meta,
  .activity-product-row .row-price,
  .activity-product-row .row-margin {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .topbar-actions {
    flex-wrap: wrap;
  }

  .topbar-actions .btn span {
    display: none;
  }

  .topbar-actions .btn {
    width: 40px;
    padding: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    max-width: none;
  }

  .modal {
    max-height: calc(100vh - 20px);
  }

  .modal-backdrop {
    padding: 10px;
  }

  .drawer {
    width: 100vw;
    max-width: 100vw;
  }
}
