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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.back-link {
  font-size: 14px;
  color: #1a56db;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* Hero */
.q-hero {
  background: linear-gradient(135deg, rgba(26,86,219,0.85) 0%, rgba(59,130,246,0.75) 50%, rgba(96,165,250,0.7) 100%),
              url('vibe_images/construct-hero-bg.png') center/cover no-repeat;
  padding: 50px 0 40px;
  text-align: center;
}

.q-hero-title {
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 10px;
}

.q-hero-sub {
  color: rgba(255,255,255,0.8);
  font-size: 15px;
}

/* Main */
.q-main {
  padding: 30px 0 60px;
}

/* Filter panel */
.q-filter-panel {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}

.q-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.q-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.q-filter-label {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
  font-weight: 500;
}

.q-filter-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 140px;
}

.q-filter-select:focus {
  border-color: #1a56db;
}

.q-filter-select:hover {
  border-color: #9ca3af;
}

.q-filter-search-group {
  display: flex;
  flex: 1;
  min-width: 200px;
}

.q-search-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.q-search-input:focus {
  border-color: #1a56db;
}

.q-search-btn {
  padding: 8px 20px;
  background: #1a56db;
  color: #fff;
  border: none;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.q-search-btn:hover {
  background: #1547b0;
}

.q-reset-btn {
  padding: 8px 18px;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.q-reset-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.q-merge-btn {
  padding: 8px 18px;
  background: #1a56db;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.q-merge-btn:hover {
  background: #1547b0;
}

.q-merge-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Merge comparison table */
.q-modal-wide {
  width: 85%;
  max-width: 1100px;
}

.q-merge-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.q-merge-table th,
.q-merge-table td {
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
}

.q-merge-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.q-merge-table th:first-child {
  width: 140px;
  background: #f3f4f6;
}

.q-merge-table td.q-merge-max {
  background: #eff6ff;
  font-weight: 600;
  color: #1a56db;
}

.q-merge-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin: 20px 0 10px;
  padding-left: 10px;
  border-left: 3px solid #1a56db;
}

.q-merge-section-title:first-child {
  margin-top: 0;
}

.q-merge-scope-list {
  padding-left: 0;
  list-style: none;
}

.q-merge-scope-list li {
  padding: 6px 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 13px;
  color: #4b5563;
}

.q-merge-scope-list li:last-child {
  border-bottom: none;
}

.q-merge-scope-label {
  display: inline-block;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.q-merge-empty {
  text-align: center;
  color: #9ca3af;
  padding: 40px 0;
  font-size: 14px;
}

/* Multi-select dropdown */
.q-multiselect {
  position: relative;
  min-width: 140px;
}

.q-multiselect-trigger {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.2s;
  outline: none;
}

.q-multiselect-trigger:hover {
  border-color: #9ca3af;
}

.q-multiselect.open .q-multiselect-trigger {
  border-color: #1a56db;
}

.q-multiselect-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 200;
  padding: 4px 0;
}

.q-multiselect.open .q-multiselect-dropdown {
  display: block;
}

.q-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  transition: background 0.15s;
  white-space: nowrap;
}

.q-multiselect-item:hover {
  background: #f3f4f6;
}

.q-multiselect-item input[type="checkbox"] {
  accent-color: #1a56db;
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.q-multiselect-item.q-multiselect-all {
  font-weight: 500;
  color: #1a56db;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 2px;
}

/* Result info */
.q-result-info {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 16px;
  padding-left: 2px;
}

/* Card layout */
.q-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.q-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.15s;
  border: 1px solid #f0f0f0;
  cursor: pointer;
}

.q-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.q-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.q-card-cat {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}

.q-card-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.q-card-level {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.q-card-level-special { background: #fef3c7; color: #92400e; }
.q-card-level-1 { background: #dbeafe; color: #1e40af; }
.q-card-level-2 { background: #e0f2fe; color: #0369a1; }
.q-card-level-3 { background: #f0fdf4; color: #166534; }
.q-card-level-none { background: #f3f4f6; color: #6b7280; }

.q-card-seq {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.q-card-seq-general { background: #ede9fe; color: #6d28d9; }
.q-card-seq-prof { background: #fef3c7; color: #92400e; }
.q-card-seq-labor { background: #fce7f3; color: #be185d; }

.q-card-scope {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.7;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

/* Empty state */
.q-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
}

.q-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.q-empty-text {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 6px;
}

.q-empty-hint {
  font-size: 13px;
  color: #9ca3af;
}

/* Pagination */
.q-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
}

.q-page-btn {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.q-page-btn:hover {
  border-color: #1a56db;
  color: #1a56db;
}

.q-page-btn.active {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}

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

.q-page-ellipsis {
  padding: 0 4px;
  color: #9ca3af;
  font-size: 13px;
}

/* Detail modal */
.q-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.q-modal-overlay.q-modal-open {
  display: flex;
}

.q-modal {
  background: #fff;
  border-radius: 14px;
  width: 75%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: qModalIn 0.2s ease-out;
}

@keyframes qModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.q-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.q-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.q-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.q-modal-close:hover {
  background: #e5e7eb;
  color: #374151;
}

.q-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
}

.q-detail-section {
  margin-bottom: 20px;
}

.q-detail-section:last-child {
  margin-bottom: 0;
}

.q-detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a56db;
  padding-left: 10px;
  border-left: 3px solid #1a56db;
  margin-bottom: 8px;
  line-height: 1.4;
}

.q-detail-section-content {
  font-size: 14px;
  color: #374151;
  line-height: 1.8;
  padding-left: 13px;
}

.q-detail-scope-only {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.8;
}

.footer {
  background: #1f2937;
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 24px 0;
  font-size: 13px;
}

@media (max-width: 768px) {
  .q-hero-title {
    font-size: 24px;
  }
  .q-cards {
    grid-template-columns: 1fr;
  }
  .q-filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .q-filter-group {
    width: 100%;
  }
  .q-filter-select {
    flex: 1;
    min-width: 0;
  }
  .q-filter-search-group {
    min-width: 0;
  }
  .q-modal {
    width: 95%;
    max-height: 90vh;
  }
  .q-modal-header {
    padding: 16px 18px 12px;
  }
  .q-modal-body {
    padding: 16px 18px 20px;
  }
}
