/* ===== 全局样式 ===== */
* {
  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: #1f2937;
  line-height: 1.6;
}

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

/* ===== Tab 导航 ===== */
.tabs {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tab-btn {
  padding: 14px 24px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #667eea;
  background: #f9fafb;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  font-weight: 600;
}

/* ===== 工具栏 ===== */
.toolbar {
  margin: 24px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.filter-btn {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.filter-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* ===== 统计 ===== */
.stats {
  margin-bottom: 16px;
  font-size: 13px;
  color: #6b7280;
}

.stats strong {
  color: #667eea;
}

/* ===== 表格 ===== */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin: 24px 0 12px;
  padding-left: 10px;
  border-left: 4px solid #667eea;
}

.table-wrapper {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow-x: auto;
  margin-bottom: 24px;
}

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

.data-table th {
  background: #f9fafb;
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table th small {
  font-weight: 400;
  color: #9ca3af;
  font-size: 11px;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* 分类列样式 */
.data-table td:first-child {
  font-weight: 600;
  color: #667eea;
  white-space: nowrap;
}

.data-table td:nth-child(2) {
  color: #374151;
  font-weight: 500;
  white-space: nowrap;
}

/* 高亮匹配文本 */
.highlight {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

/* 空值样式 */
.empty-cell {
  color: #d1d5db;
}

/* 价格提示 */
.price-note {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 24px;
  font-size: 13px;
  color: #92400e;
}

/* ===== 页脚 ===== */
.footer {
  background: #1f2937;
  color: #9ca3af;
  padding: 20px 0;
  text-align: center;
  font-size: 12px;
  margin-top: 40px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .tab-btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
  }
}

/* ===== 模型比价 Tab ===== */
body.price-mode .toolbar,
body.price-mode #stats {
  display: none;
}

.price-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: white;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #4b5563;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.price-meta strong { color: #667eea; }
.pm-badge {
  display: inline-block;
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 20px;
  padding: 2px 12px;
  margin-right: 8px;
  font-size: 12px;
  font-weight: 600;
}
.pm-warn { color: #b45309; font-weight: 600; }
.pm-ok { color: #059669; font-weight: 600; }
.pm-new { color: #7c3aed; font-weight: 700; }

.new-badge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  cursor: help;
}

.price-table th { white-space: nowrap; text-align: center; }
.price-table td.model-name {
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  min-width: 150px;
}
.price-table td { text-align: center; min-width: 128px; }

.price-card {
  position: relative;
  text-align: left;
  background: #fafbff;
  border: 1px solid #eef0fb;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 2px 0;
  cursor: help;
  transition: box-shadow 0.15s;
}
.price-card:hover { box-shadow: 0 2px 8px rgba(102,126,234,0.15); }

.pl-main { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pl-line { font-size: 13px; color: #1f2937; white-space: nowrap; }
.pl-line em {
  font-style: normal;
  color: #9ca3af;
  font-size: 11px;
  margin-right: 3px;
}
.pl-line b { color: #4338ca; font-size: 14px; }

.pl-tiers { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.pl-tier {
  background: #f3f4f6;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #4b5563;
  white-space: nowrap;
}
.pl-tier em { font-style: normal; color: #9ca3af; margin-right: 3px; }

.pl-unit { margin-top: 5px; font-size: 11px; color: #6b7280; }
.pl-note {
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pl-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}
.conf-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.conf-dot.high { background: #10b981; }
.conf-dot.mid { background: #f59e0b; }
.conf-dot.low { background: #ef4444; }
.warn-badge {
  background: #fef3c7;
  color: #b45309;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  cursor: help;
}
.src-link { font-size: 12px; text-decoration: none; }
.row-hidden { display: none; }

.price-loading, .price-error {
  background: white;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  color: #6b7280;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.price-error { color: #b91c1c; }

/* ===== 滚动条美化 ===== */
.ds-caption { color: #6b7280; font-size: 13px; margin: 8px 0 14px; }
.ds-table { min-width: 100%; }
.ds-table-wrapper, .price-table-wrapper { max-height: 70vh; overflow: auto; }
.ds-table thead, .price-table thead { position: sticky; top: 0; z-index: 5; background: #f9fafb; box-shadow: 0 2px 3px rgba(0,0,0,0.12); }
.price-table thead th, .ds-table tbody th { position: static; }
.ds-table-wrapper:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
.ds-direct-badge { display: inline-block; padding: 3px 8px; border: 1px solid #a78bfa; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-weight: 700; white-space: nowrap; }
.cost-open { display: block; margin: 10px auto 0; padding: 6px 12px; border: 1px solid #c7d2fe; border-radius: 6px; color: #4338ca; background: #eef2ff; cursor: pointer; white-space: nowrap; }
.cost-dialog { margin: auto; padding: 0; border: 0; border-radius: 16px; width: min(760px, 94vw); max-height: 90vh; color: #1f2937; box-shadow: 0 24px 80px #0004; }
.cost-dialog::backdrop { background: #11182799; }
.cost-panel { padding: 24px; }
.cost-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.cost-heading h2 { margin: 0; font-size: 22px; }
.cost-heading button { border: 0; background: #f3f4f6; border-radius: 6px; font-size: 24px; width: 36px; height: 36px; cursor: pointer; }
.cost-model { margin: 12px 0 18px; font-weight: 600; overflow-wrap: anywhere; }
.cost-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cost-dialog label { display: block; font-size: 13px; font-weight: 500; }
.cost-dialog input, .cost-dialog select { display: block; width: 100%; box-sizing: border-box; padding: 9px; margin-top: 6px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: white; color: #111827; }
.cost-dialog input:focus, .cost-dialog select:focus { outline: 2px solid #818cf8; }
.cost-help, .cost-method { color: #6b7280; font-size: 12px; line-height: 1.7; margin: 12px 0; }
.cost-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 12px; }
.cost-totals div { background: #eef2ff; padding: 16px; border-radius: 10px; font-size: 13px; }
.cost-totals strong { display: block; color: #4338ca; font-size: 23px; margin-top: 8px; overflow-wrap: anywhere; }
.cost-breakdown { font-size: 13px; margin: 12px 0; }
.cost-breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; }
.cost-breakdown dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.cost-error { color: #b91c1c; background: #fef2f2; padding: 14px; border-radius: 8px; }
.cost-method summary { cursor: pointer; }
@media (max-width: 520px) { .cost-grid, .cost-totals { grid-template-columns: 1fr; } .cost-panel { padding: 16px; } }
.ds-table thead th { position: static; text-align: center; white-space: nowrap; }
.ds-table th.ds-model { background: #fafbff; color: #374151; min-width: 230px; text-align: left; font-weight: 600; }
.ds-table td { vertical-align: top; text-align: center; min-width: 105px; }
.ds-table td.ds-vendor { white-space: nowrap; font-weight: 600; }
.ds-table td.ds-channel { min-width: 170px; overflow-wrap: anywhere; }
.ds-table td.ds-rules { min-width: 180px; text-align: left; }
.ds-table .ds-rules details { margin-top: 0; }
.ds-table small { display: block; font-weight: 400; font-size: 11px; color: #6b7280; margin-top: 6px; }
.ds-table details { font-size: 12px; font-weight: 400; white-space: normal; max-width: 270px; margin-top: 10px; }
.ds-table summary { cursor: pointer; color: #4f46e5; }
.ds-rate { white-space: nowrap; height: 30px; line-height: 30px; border-bottom: 1px solid #eef0f4; }
.capability-toggle { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; padding: 8px 16px; min-width: 200px; text-align: left; }
.capability-toggle small { display: inline; color: inherit; margin-left: 8px; }
.capability-toggle:focus-visible { outline: 2px solid #6366f1; outline-offset: -2px; }
.ds-table .capability-group { background: #e8edff; color: #3730a3; padding: 0; text-align: left; }
.ds-table .capability-cell { background: #f8faff; min-width: 120px; }
.ds-table .capability-summary { display: none; }
.ds-table.capabilities-collapsed .capability-cell { display: none; }
.ds-table.capabilities-collapsed .capability-summary { display: table-cell; color: #6b7280; }

.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 左侧栏目导航：窄屏保留紧凑侧栏，不挤压表格自身的横向滚动。 */
body { background: #f8f9f7; --sidebar-width: 248px; --nav-accent: #177783; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); background: #fcfdfc; border-right: 1px solid #dfe5e3; padding: 34px 20px; overflow-y: auto; z-index: 100; }
.sidebar-brand { padding: 0 12px 30px; border-bottom: 1px solid #dfe5e3; color: #202b31; font-size: 29px; font-weight: 750; letter-spacing: 2px; white-space: nowrap; }
.sidebar-brand span { color: var(--nav-accent); }
.sidebar .tabs { position: static; border: 0; box-shadow: none; background: transparent; margin-top: 28px; }
.nav-label { color: #849094; font-size: 12px; letter-spacing: 2px; padding: 0 14px; margin-bottom: 14px; }
.sidebar .tab-btn { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; margin-bottom: 8px; padding: 14px; border: 0; border-radius: 11px; text-align: left; color: #5c6870; font-size: 16px; white-space: nowrap; }
.tab-btn svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .tab-btn:hover { background: #f0f4f2; color: var(--nav-accent); }
.sidebar .tab-btn.active { background: #e6eeee; color: var(--nav-accent); font-weight: 650; }
.tab-btn:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: 2px; }
.main-content { max-width: none; min-width: 0; margin-left: var(--sidebar-width); padding: 36px 36px 0; }
.page-title { font-size: 30px; font-weight: 700; color: #202b31; margin-bottom: 24px; }
.footer { margin-left: var(--sidebar-width); }
.filter-btn.active { background: var(--nav-accent); border-color: var(--nav-accent); }
.filter-btn:hover, .stats strong { color: var(--nav-accent); }
.filter-btn.active:hover { color: white; }
.filter-btn:hover, .search-input:focus { border-color: var(--nav-accent); }
.search-input:focus { box-shadow: 0 0 0 3px #17778314; }
.section-title { border-left-color: var(--nav-accent); }
@media (max-width: 1000px) {
  body { --sidebar-width: 208px; }
  .sidebar { padding: 26px 12px; }
  .sidebar-brand { font-size: 25px; }
  .sidebar .tab-btn { font-size: 14px; gap: 10px; }
  .main-content { padding: 28px 22px 0; }
}
@media (max-width: 600px) {
  body { --sidebar-width: 76px; }
  .sidebar { padding: 22px 8px; }
  .sidebar-brand { padding: 0 4px 20px; font-size: 17px; letter-spacing: 1px; white-space: normal; text-align: center; }
  .sidebar-brand span { display: block; }
  .nav-label { display: none; }
  .sidebar .tab-btn { flex-direction: column; gap: 5px; padding: 10px 2px; font-size: 10px; }
  .main-content { padding: 22px 14px 0; }
  .page-title { font-size: 24px; margin-bottom: 18px; }
  .footer .container { padding: 0 14px; }
}
