* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --hover-bg: #f1f5f9;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 10px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-light);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  width: 180px;
  background: linear-gradient(160deg, #4361ee, #3a0ca3);
  color: white;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 16px rgba(0,0,0,0.1);
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

.sidebar h2 {
  font-size: 1rem;
  margin-bottom: 14px;
  opacity: 0.9;
}

.brand-list {
  list-style: none;
  flex: 1;
}

.brand-item {
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  background: rgba(255,255,255,0.1);
  font-size: 0.95rem;
}

.brand-item:hover {
  background: rgba(255,255,255,0.2);
}

.brand-item.active {
  background: white;
  color: var(--primary);
}

.main-content {
  flex: 1;
  padding: 24px;
  position: relative;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.top-filters {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  background: var(--card-bg);
  padding: 6px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: calc(100% - 260px);
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 0.78rem;
  z-index: 10;
}

.filter-group {
  display: flex;
  flex-direction: column;
  color: var(--text-light);
  min-width: 48px;
}

.filter-group label {
  margin-bottom: 2px;
  font-weight: 500;
  font-size: 0.74rem;
}

.filter-input {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.78rem;
  text-align: center;
  transition: border 0.2s;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.12);
}

.price-group {
  min-width: 96px;
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 3px;
}

.filter-input.small {
  flex: 1;
  min-width: 0;
  height: 24px;
  font-size: 0.76rem;
  padding: 0 5px;
}

.multi-select {
  position: relative;
}

.select-header {
  min-height: 26px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.78rem;
  background: white;
  color: var(--text);
}

.select-header::before {
  color: var(--text-light);
  font-style: italic;
}

.select-header.has-selection::before {
  display: none;
}

.selected-tag {
  background: var(--primary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  gap: 2px;
}

.selected-tag .remove {
  cursor: pointer;
  font-weight: bold;
  margin-left: 2px;
}

.select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  z-index: 20;
  max-height: 180px;
  overflow-y: auto;
  display: none;
  padding: 4px 0;
  font-size: 0.8rem;
}

.select-dropdown.show {
  display: block;
}

.select-option {
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.select-option:hover {
  background: var(--hover-bg);
}

.select-option input {
  margin: 0;
  width: 14px;
  height: 14px;
}

.table-container {
  margin-top: 8px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  table-layout: auto;
}

@media (min-width: 769px) {
  .data-table {
    table-layout: fixed;
  }
  .data-table th:nth-child(1), .data-table td:nth-child(1) { width: 10%; }
  .data-table th:nth-child(2), .data-table td:nth-child(2) { width: 8%;  }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { width: 9%;  }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { width: 10%; }
  .data-table th:nth-child(5), .data-table td:nth-child(5) { width: 10%; }
  .data-table th:nth-child(6), .data-table td:nth-child(6) { width: 10%; }
  .data-table th:nth-child(7), .data-table td:nth-child(7) { width: 14%; }
  .data-table th:nth-child(8), .data-table td:nth-child(8) { width: 12%; }
  .data-table th:nth-child(9), .data-table td:nth-child(9) { width: 12%; }
  .data-table th:nth-child(10), .data-table td:nth-child(10) { width: 5%; }
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table th {
  background: #fafbfd;
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background: var(--hover-bg);
}

.buy-link {
  display: inline-block;
  padding: 4px 8px;
  background: var(--primary);
  color: white !important;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.2s;
  white-space: nowrap;
  min-width: 40px;
  text-align: center;
}

.buy-link:hover {
  background: var(--primary-dark);
}

/* —————— 移动端适配 —————— */
.mobile-brand-wrapper {
  display: none;
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    padding: 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(160deg, #4361ee, #3a0ca3);
  }

  .logo {
    font-size: 1.2rem;
    margin-bottom: 0;
  }

  .brand-list {
    display: none !important;
  }

  .mobile-brand-wrapper {
    display: block;
  }

  .mobile-brand-select {
    background: white; /* 修复：不再用透明背景 */
    color: #333; /* 修复：深色文字，确保可见 */
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
    padding-right: 24px;
  }

  .main-content {
    padding: 16px 12px 12px;
    margin-top: 10px;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .top-filters {
    position: relative;
    top: 0;
    right: 0;
    max-width: 100%;
    margin-top: 12px;
    justify-content: flex-start;
    padding: 8px 10px;
  }

  .filter-group {
    min-width: auto;
    flex: 1;
    max-width: 120px;
  }

  .price-group {
    min-width: auto;
    max-width: 160px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .buy-link {
    padding: 5px 10px;
    font-size: 0.85rem;
    min-width: 48px;
  }
}