*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #eef2f7;
  --border: #dde3ec;
  --text: #1a2332;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  line-height: 1.2;
  white-space: nowrap;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.hot-products-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.25rem 2.5rem 2.5rem;
  min-height: calc(100vh - 56px);
}

body.page-hot-products {
  overflow-x: hidden;
  font-size: 16px;
}

.hot-products-page .page-header {
  display: block;
  margin-bottom: 1rem;
}

.hot-products-top-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hot-products-top-row h1 {
  margin: 0;
  font-size: 1.75rem;
}

.hot-products-page .hot-product-table .item-no-col,
.hot-products-page .hot-product-table .item-no-cell {
  width: 120px;
  min-width: 120px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hot-products-top-row .result-info {
  margin: 0;
  margin-left: auto;
}

.hot-products-status-filter {
  display: inline-flex;
  align-items: center;
}

.hot-products-pnk-search {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.hot-products-pnk-search .search-input-sm {
  width: 160px;
  min-width: 120px;
  flex: 0 1 auto;
  padding: 0.45rem 0.65rem;
}

.status-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.status-filter-select {
  min-width: 120px;
  padding: 0.45rem 0.65rem;
}

.hot-products-page .table-wrap {
  width: 100%;
  max-width: none;
  border-radius: var(--radius);
}

.hot-products-page .hot-product-table {
  width: 100%;
  table-layout: fixed;
  font-size: 1rem;
}

.hot-products-page .hot-product-table th,
.hot-products-page .hot-product-table td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
}

.hot-products-page .hot-product-table .img-col,
.hot-products-page .hot-product-table .img-cell {
  width: 240px;
  min-width: 240px;
  box-sizing: border-box;
  overflow: hidden;
}

.hot-products-page .hot-product-table .price-col,
.hot-products-page .hot-product-table .price-cell {
  width: 96px;
  min-width: 96px;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
}

.hot-products-page .hot-product-table .action-col,
.hot-products-page .hot-product-table .action-cell {
  width: 84px;
  min-width: 84px;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
}

.hot-products-page .hot-product-table .img-cell img {
  display: block;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.hot-products-page .name-cell {
  max-width: none;
  white-space: normal;
  line-height: 1.55;
  word-break: break-word;
  font-size: 1rem;
}

.hot-products-page .result-info {
  font-size: 1rem;
  white-space: nowrap;
}

.product-library-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.product-library-list-toolbar .result-info {
  margin: 0;
}

.product-library-search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.product-library-search-form .search-input {
  flex: 0 1 auto;
  width: min(320px, 42vw);
  min-width: 180px;
}

.page-product-library .hot-product-table .img-col,
.page-product-library .hot-product-table .img-cell {
  width: 120px;
  min-width: 120px;
}

.page-product-library .hot-product-table .img-cell img {
  width: 96px;
  height: 96px;
  max-width: 96px;
  object-fit: cover;
  margin-left: auto;
  margin-right: auto;
}

.page-product-library .hot-product-table th,
.page-product-library .hot-product-table td {
  text-align: center;
}

.page-product-library .hot-product-table .name-cell {
  text-align: center;
}

.page-product-library .hot-product-table .metric-col,
.page-product-library .hot-product-table .metric-cell {
  text-align: center;
}

.page-product-library .hot-product-table .hs-code-col,
.page-product-library .hot-product-table .hs-code-cell {
  width: 120px;
  min-width: 120px;
  white-space: nowrap;
}

.hot-products-page .btn {
  font-size: 1rem;
  padding: 0.65rem 1.1rem;
}

.hot-products-page .btn-sm {
  font-size: 0.9375rem;
  padding: 0.45rem 0.75rem;
}

.hot-products-page .hot-product-table th {
  font-size: 1rem;
}

.hot-products-page .heat-badge,
.hot-products-page .commission-badge,
.hot-products-page .rating-badge,
.hot-products-page .pnk-tag {
  font-size: 0.9375rem;
  padding: 0.2rem 0.55rem;
}

.hot-products-page .heat-cell .heat-queried-at {
  font-size: 0.875rem;
}

.hot-products-page .weight-cell .weight-actual,
.hot-products-page .weight-cell .weight-volumetric {
  font-size: 0.9375rem;
}

.hot-products-page .weight-dim {
  font-size: 0.875rem;
}

.hot-products-page .price-cell .price-value {
  font-size: 1.05rem;
}

.hero {
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 1.75rem;
  margin-bottom: 0.4rem;
}

.hero p {
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.hint code {
  background: var(--surface2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.file-drop {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.file-drop input {
  display: none;
}

.drop-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.drop-text {
  color: var(--text-muted);
  display: block;
}

.drop-filename {
  display: block;
  margin-top: 0.5rem;
  color: var(--primary);
  font-size: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.toast-container {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 420px;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.16);
  border-left: 4px solid var(--success);
  opacity: 0;
  transform: translateX(calc(100% + 1.25rem));
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast.toast-hide {
  opacity: 0;
  transform: translateX(calc(100% + 1.25rem));
}

.toast.toast-error {
  border-left-color: var(--error);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.emag-form {
  max-width: 520px;
}

.masked-password {
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.empty-inline {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.search-input,
.select-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.search-input {
  flex: 1;
  min-width: 200px;
}

.select-input {
  min-width: 220px;
}

.result-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.img-cell img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface2);
}

.hot-product-table .img-cell img {
  width: 192px;
  height: 192px;
  object-fit: cover;
}

.name-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnk-tag {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.rating-badge {
  background: #fef9c3;
  color: #a16207;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.missing {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.link {
  color: var(--primary);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.nav-user {
  color: var(--text-muted);
  margin-left: 1.5rem;
  font-size: 0.9rem;
}

.nav-logout {
  color: var(--error) !important;
}

body.page-login {
  background-color: #0a1628;
  background-image: url("/static/bg.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

html:has(body.page-login) {
  overflow: hidden;
  height: 100%;
}

body.page-login .navbar {
  display: none;
}

body.page-login .login-main {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
}

body.page-login .login-wrap {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0 1.5rem;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

body.page-login .login-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 0;
  margin-top: clamp(22rem, 48vh, 31rem);
}

body.page-login .login-card .form-grid {
  margin-top: 0;
  gap: 0.85rem;
}

body.page-login .login-card .btn-primary {
  background: linear-gradient(135deg, #2d6a9f 0%, #1a4d73 100%);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(15, 40, 70, 0.28);
  transition: background 0.2s, box-shadow 0.2s;
}

body.page-login .login-card .btn-primary:hover {
  background: linear-gradient(135deg, #3578ab 0%, #205a82 100%);
  box-shadow: 0 6px 18px rgba(15, 40, 70, 0.38);
}

.login-card h1 {
  margin-bottom: 0.25rem;
}

.login-tip {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.form-field input,
.form-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.form-inline {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-block {
  width: 100%;
}

.admin-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-link-card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}

.admin-link-card:hover {
  border-color: var(--primary);
}

.admin-link-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.admin-link-card span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.badge-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-user {
  background: #e2e8f0;
  color: #475569;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
}

.badge-inactive {
  background: #fee2e2;
  color: #b91c1c;
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.edit-panel summary {
  cursor: pointer;
  list-style: none;
}

.edit-form {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 220px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.inline-form {
  display: inline;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background: #fecaca;
}

.heat-badge {
  background: #ffedd5;
  color: #c2410c;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.heat-cell .heat-queried-at {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.3;
  white-space: nowrap;
}

.commission-badge {
  background: #dcfce7;
  color: #15803d;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.running-card {
  border-color: #93c5fd;
}

.task-progress + .task-progress {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.task-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.progress-bar-wrap {
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.task-meta,
.task-message {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.price-cell {
  min-width: 88px;
}

.price-cell .price-value {
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.weight-cell {
  min-width: 120px;
}

.weight-cell .weight-actual,
.weight-cell .weight-volumetric {
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.35;
}

.weight-cell .weight-actual {
  font-weight: 600;
}

.weight-dim {
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.hot-products-page .hot-product-table .metric-col,
.hot-products-page .hot-product-table .metric-cell {
  width: 80px;
  min-width: 80px;
  box-sizing: border-box;
  text-align: right;
  white-space: nowrap;
}

.hot-products-page .hot-product-table .roi-col,
.hot-products-page .hot-product-table .roi-cell-wrap {
  width: 140px;
  min-width: 140px;
  text-align: center;
  white-space: normal;
}

.hot-products-page .hot-product-table .status-col,
.hot-products-page .hot-product-table .status-cell {
  width: 96px;
  min-width: 96px;
  text-align: center;
  white-space: nowrap;
}

.hot-products-page .roi-value {
  font-size: 1.05rem;
  text-align: center;
}

.hot-products-page .roi-actions {
  align-items: center;
}

.hot-products-page .metric-cell {
  font-size: 1rem;
}

.hot-products-page .status-badge {
  font-size: 0.875rem;
  padding: 0.2rem 0.5rem;
}

.hot-products-page .btn-status-action {
  font-size: 0.8125rem;
  padding: 0.22rem 0.5rem;
}

.hot-products-page .link {
  font-size: 1rem;
}

.metric-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.gross-profit-cell {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: rgba(100, 116, 139, 0.45);
  text-underline-offset: 0.2em;
}

.roi-value {
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.roi-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.btn-status-action {
  padding: 0.12rem 0.35rem;
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.status-badge.status-pending {
  background: #e2e8f0;
  color: #475569;
}

.status-badge.status-processed {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-badge.status-no-profit {
  background: #fee2e2;
  color: #b91c1c;
}

.status-badge.status-no-source {
  background: #fef9c3;
  color: #a16207;
}

.btn-edit-price,
.btn-edit-product {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
}

body.modal-open {
  overflow: hidden;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.modal-panel {
  position: relative;
  width: min(960px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

.modal-panel-sm {
  width: min(420px, 100%);
}

.modal-header-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}

.modal-header-checkbox {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
}

.modal-header-checkbox input {
  width: 1rem;
  height: 1rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.modal-form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field-full {
  grid-column: 1 / -1;
}

.image-url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.image-url-row .form-input {
  min-width: 0;
}

.image-url-row .btn {
  white-space: nowrap;
}

.form-field-spacer {
  min-height: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-error {
  margin: 0;
  color: var(--error);
  font-size: 0.875rem;
}

.modal-error.hidden {
  display: none;
}

/* ── 商品模块 ── */
.modal-panel-lg {
  width: min(920px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.form-field-wide {
  grid-column: span 1;
}

.goods-header .goods-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.goods-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.goods-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.goods-list-toolbar .result-info {
  margin: 0;
}

.goods-filter-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.goods-filter-form .search-input {
  width: min(280px, 40vw);
  min-width: 160px;
}

.goods-bulk-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.goods-bulk-bar.hidden {
  display: none;
}

.goods-table .check-col,
.goods-table .check-cell {
  width: 40px;
  text-align: center;
}

.goods-table .sku-col {
  min-width: 110px;
}

.sku-tag {
  font-size: 0.8125rem;
  padding: 0.15rem 0.45rem;
  background: var(--surface2);
  border-radius: 4px;
}

.goods-type-badge,
.goods-status-badge {
  display: inline-block;
  font-size: 0.8125rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

.goods-type-single { background: #e8f4fd; color: #1565c0; }
.goods-type-multi { background: #e8f5e9; color: #2e7d32; }
.goods-type-store { background: #fff3e0; color: #e65100; margin-left: 0.25rem; }

.price-cell .muted {
  color: #6b7280;
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.purchase-summary {
  margin: 0;
  color: #374151;
  font-weight: 600;
  line-height: 1.4;
}

.purchase-product-row {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin: 0 0 1rem;
}

.purchase-product-image {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}

.purchase-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.purchase-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #9ca3af;
}

.purchase-links-hint {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.85rem;
  color: #6b7280;
}

.supplier-name-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.supplier-name-row {
  line-height: 1.35;
}

.supplier-name-link {
  word-break: break-all;
}

.stock-lines {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: nowrap;
}

.action-cell .btn {
  margin: 0.15rem 0.15rem 0.15rem 0;
}

.settings-card {
  max-width: 480px;
}

.settings-card-wide {
  max-width: 640px;
  margin-top: 1.25rem;
}

.settings-subheading {
  margin: 1.25rem 0 0.25rem;
  font-size: 1.1rem;
}

.settings-hint {
  margin: 0 0 1.25rem;
  color: #6b7280;
}

.settings-form {
  display: grid;
  gap: 0.9rem;
}

.settings-actions {
  margin-top: 0.5rem;
}

.goods-status-draft { background: #f5f5f5; color: #616161; }
.goods-status-active { background: #e8f5e9; color: #2e7d32; }
.goods-status-inactive { background: #ffebee; color: #c62828; }

.combo-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.goods-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.goods-section.hidden {
  display: none;
}

.goods-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.supplier-row,
.combo-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

.btn-remove-row {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.btn-remove-row:hover {
  color: var(--error);
  border-color: var(--error);
}

.checkbox-field {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
}

.checkbox-field input[type="checkbox"] {
  width: auto;
}

.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  padding: 0.35rem 0;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--surface2);
}

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.35rem 0;
}

.file-label input[type="file"] {
  display: none;
}

.required {
  color: var(--error);
  font-style: normal;
}

.page-goods .goods-table .img-cell img {
  width: 64px;
  height: 64px;
  object-fit: cover;
}

.page-goods .action-cell {
  white-space: nowrap;
}

.page-goods .action-cell .btn {
  margin-bottom: 0.25rem;
}

