:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #eef3f7;
  --ink: #17202a;
  --muted: #687386;
  --line: #d8e0e8;
  --accent: #0f766e;
  --accent-2: #1d4ed8;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.is-loading {
  opacity: 0.68;
  transition: opacity 0.12s ease;
}

.is-loading::after {
  content: "加载中...";
  display: block;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(29, 78, 216, 0.10), transparent 40%),
    var(--bg);
}

.login-panel {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.16;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 24px;
}

.muted {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.login-options {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.nav-item {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

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

.secondary-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.danger-btn {
  background: #b91c1c;
  color: #fff;
  border-color: #b91c1c;
}

button:disabled,
a[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-btn svg,
.secondary-btn svg,
.ghost-btn svg,
.danger-btn svg,
.nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.error-text {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #111827;
  color: #fff;
  padding: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #14b8a6;
  color: #062f2b;
  font-weight: 900;
}

.brand-title {
  margin: 0;
  font-weight: 900;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.nav-item {
  justify-content: flex-start;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.sidebar-footer p {
  margin: 0;
}

.content {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
}

.top-actions input {
  width: 150px;
}

.notice {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #fff;
  padding: 12px 14px;
  color: var(--muted);
  font-weight: 700;
}

.notice.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.workspace {
  display: grid;
  gap: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: 150px 180px 110px 110px 130px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.wide-filter {
  min-width: 220px;
}

.candidate-filter-bar {
  grid-template-columns: 150px 140px minmax(240px, 1fr) auto auto;
}

.check-line {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  white-space: nowrap;
}

.check-line input {
  width: 18px;
  height: 18px;
  min-height: 0;
}

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

.list-head p {
  margin: 0;
  color: var(--muted);
}

.list-head select {
  width: 160px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.product-card {
  display: grid;
  grid-template-rows: 210px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.image-box {
  position: relative;
  display: grid;
  place-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-box .no-image {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 3px 8px;
  background: #e6f4f1;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.image-box .badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.card-body {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.title-link {
  min-height: 42px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  color: var(--accent-2);
  font-size: 20px;
  font-weight: 900;
}

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

.store-line,
.category-line {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mark-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
}

.mark-row textarea {
  min-height: 38px;
  height: 38px;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-row a {
  flex: 1;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 20px;
}

.bulk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 14px;
}

.store-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.table-title {
  min-width: 260px;
  max-width: 360px;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.table-action {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.confirm-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.confirm-panel {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 20px;
}

.confirm-panel h3 {
  margin: 0;
  font-size: 20px;
}

.confirm-count {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.ai-empty-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.ai-empty-panel h3 {
  margin: 4px 0 14px;
  font-size: 20px;
}

.ai-columns {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 110px 100px 120px minmax(180px, 1fr) 110px;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.settings-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.settings-panel h3 {
  margin: 0;
  font-size: 18px;
}

.user-create-row {
  display: grid;
  grid-template-columns: 150px 180px 160px 110px auto;
  gap: 10px;
  align-items: end;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td a {
  color: var(--accent-2);
  font-weight: 800;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

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

@media (max-width: 720px) {
  .content {
    padding: 14px;
  }

  .topbar,
  .list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .filter-bar,
  .user-create-row,
  .metric-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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