/**
 * 美承数码 ERP 智能系统 — 公共样式
 */
:root {
  --brand: #0b5fff;
  --brand-dark: #0847c7;
  --brand-soft: #e8f0ff;
  --sidebar: #0f1c33;
  --sidebar-hover: #1a2d4d;
  --accent: #ff6a00;
  --price: #e4393c;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(15, 28, 51, 0.08);
  --radius: 12px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
}

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(11, 95, 255, 0.25), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(255, 106, 0, 0.18), transparent 35%),
    linear-gradient(145deg, #0b1b36 0%, #12305c 45%, #0b5fff 100%);
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  padding: 40px 36px 32px;
  backdrop-filter: blur(8px);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), #4f8cff);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
}

.login-brand h1 {
  font-size: 22px;
  font-weight: 700;
  color: #0f1c33;
  line-height: 1.4;
}

.login-brand p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 95, 255, 0.15);
}

.login-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.btn-primary {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(11, 95, 255, 0.35);
}

.login-tips {
  margin-top: 18px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.login-tips code {
  background: #eef2ff;
  color: var(--brand);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- 布局壳 ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.45;
}

.sidebar-brand .domain {
  margin-top: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.nav-menu {
  padding: 16px 12px;
  flex: 1;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: #64748b;
  padding: 8px 10px 10px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  color: #cbd5e1;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  opacity: 0.9;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.logout-link {
  color: var(--muted);
}

.logout-link:hover {
  color: var(--danger);
}

.content {
  padding: 22px 24px 40px;
  flex: 1;
}

/* ---------- 首页卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 13px;
  color: var(--muted);
}

.stat-card .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.stat-card .hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ok);
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.quick-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.action-btn.secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid #c7d7fe;
}

.welcome-banner {
  background: linear-gradient(120deg, #0b5fff, #2563eb 50%, #38bdf8);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.welcome-banner h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.welcome-banner p {
  opacity: 0.92;
  font-size: 14px;
}

/* ---------- 选品页（电商列表） ---------- */
.search-bar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
  display: flex;
  border: 2px solid var(--accent);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.search-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
}

.search-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0 22px;
  font-weight: 700;
  cursor: pointer;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
}

.chip.active {
  background: #fff7ed;
  color: var(--accent);
  border: 1px solid #fed7aa;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.result-meta strong {
  color: var(--accent);
}

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

.product-card {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid transparent;
  box-shadow: 0 2px 10px rgba(15, 28, 51, 0.05);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: #ffd8b5;
  box-shadow: 0 10px 24px rgba(255, 106, 0, 0.12);
}

.product-thumb {
  height: 168px;
  display: grid;
  place-items: center;
  color: #fff;
  position: relative;
}

.product-thumb .phone {
  width: 72px;
  height: 128px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  position: relative;
}

.product-thumb .phone::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.product-body {
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-title {
  font-size: 13px;
  line-height: 1.45;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.spec-tag {
  font-size: 11px;
  background: #f3f4f6;
  color: #4b5563;
  padding: 2px 6px;
  border-radius: 4px;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}

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

.price::before {
  content: "¥";
  font-size: 13px;
  margin-right: 1px;
}

.original-price {
  color: #9ca3af;
  font-size: 12px;
  text-decoration: line-through;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

.shop-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid #ffd8b5;
  padding: 1px 5px;
  border-radius: 3px;
}

.pagination {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  color: #374151;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.page-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 1400px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .sidebar {
    display: none;
  }
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
