/* =========================================================================
 * app.css —— 汽车蓄电池型号查询系统 样式
 * 设计目标：电脑端直播间客服快速查看，主结果醒目、相似车型弱化
 * ========================================================================= */

:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --ink: #182233;
  --ink-2: #445068;
  --muted: #7d8798;
  --muted-2: #98a1b0;
  --line: #e3e8f0;
  --line-2: #d6dce7;
  --primary: #1450d8;
  --primary-dark: #0f3fae;
  --primary-soft: #eaf0ff;
  --amber: #b7791f;
  --amber-soft: #fff8e8;
  --red: #c0392b;
  --red-soft: #fdecea;
  --green: #1e7a4f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(17, 30, 55, .05), 0 6px 18px rgba(17, 30, 55, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

h1, h2, h3, h4 { margin: 0; }

/* ============================== 顶部栏 ============================== */
.topbar {
  background: linear-gradient(120deg, #0e2745 0%, #14375f 60%, #173e6b 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(9, 24, 45, .18);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 26px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 330px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: linear-gradient(160deg, #ffb648, #ff7a00);
  color: #25324a;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.logo-text h1 {
  font-size: 18px;
  letter-spacing: .5px;
  font-weight: 700;
}

.logo-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #a9bdd8;
}

.tabs {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, .08);
  padding: 4px;
  border-radius: 9px;
}

.tab {
  border: 0;
  background: transparent;
  color: #c6d5ea;
  padding: 7px 20px;
  border-radius: 7px;
  font-size: 14px;
  transition: all .15s;
}

.tab:hover { color: #fff; }

.tab.active {
  background: #fff;
  color: #12305c;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.data-meta {
  margin-left: auto;
  font-size: 12px;
  color: #9fb4cf;
  letter-spacing: .3px;
}

/* ============================== 布局 ============================== */
.layout {
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px 24px 40px;
}

.page { display: none; }
.page.active { display: block; }

/* ============================== 总搜索栏 ============================== */
.quick-search {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 10px;
  margin-bottom: 14px;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-icon {
  font-size: 17px;
  opacity: .6;
  flex-shrink: 0;
}

#quickInput {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

#quickInput:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 80, 216, .09);
}

.quick-btn {
  height: 44px;
  padding: 0 30px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #1b5ae8, #1146c2);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(20, 80, 216, .25);
  transition: background .15s, transform .1s;
}

.quick-btn:hover { background: linear-gradient(180deg, #2a67f0, #1450d8); }
.quick-btn:active { transform: translateY(1px); }

.quick-hint {
  margin: 7px 2px 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-2);
}

@media (max-width: 720px) {
  .quick-row { flex-wrap: wrap; }
  #quickInput { flex: 1 1 100%; }
  .quick-btn { width: 100%; }
}

.query-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.side-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 84px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 18px;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
  line-height: 1.2;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel-head .panel-title { margin-bottom: 0; }

/* ============================== 表单 ============================== */
.field {
  display: block;
  margin-bottom: 13px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 5px;
  font-weight: 600;
}

.field-label em {
  color: var(--red);
  font-style: normal;
}

.field-label small {
  color: var(--muted-2);
  font-weight: 400;
  margin-left: 4px;
}

.field input:not([type=radio]):not([type=checkbox]) {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fbfcfe;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:not([type=radio]):not([type=checkbox]):focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 80, 216, .09);
}

.field-tip {
  display: block;
  min-height: 0;
  font-size: 12px;
  color: var(--red);
  margin-top: 3px;
}

.type-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.type-select label {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  background: #fbfcfe;
  transition: all .12s;
}

.type-select label:hover { border-color: #b9c8e6; }

.type-select input { accent-color: var(--primary); margin: 0; }

.type-select label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.btn-query {
  width: 100%;
  height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #1b5ae8, #1146c2);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  box-shadow: 0 6px 14px rgba(20, 80, 216, .28);
  transition: transform .1s, box-shadow .15s, background .15s;
}

.btn-query:hover {
  background: linear-gradient(180deg, #2a67f0, #1450d8);
  box-shadow: 0 8px 18px rgba(20, 80, 216, .34);
}

.btn-query:active { transform: translateY(1px); }

.btn-query:disabled {
  opacity: .7;
  cursor: default;
  box-shadow: none;
  letter-spacing: 1px;
}

.btn-ghost {
  width: 100%;
  height: 34px;
  margin-top: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}

.btn-ghost:hover { color: var(--ink); border-color: #b9c8e6; }

.form-hint {
  margin: 11px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-2);
}

/* ============================== 历史记录 ============================== */
.history-panel { padding-bottom: 12px; }

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px;
  border-radius: 6px;
  cursor: pointer;
  border-bottom: 1px dashed #eef1f6;
  transition: background .12s;
}

.history-item:hover { background: #f4f7fd; }

.history-main { display: flex; flex-direction: column; min-width: 0; }

.history-brand {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-detail {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-size: 11px;
  color: var(--muted-2);
  flex-shrink: 0;
}

.history-empty {
  margin: 6px 0 2px;
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
}

/* ============================== 查询结果 ============================== */
.results { min-width: 0; }

.empty-state,
.no-result {
  background: var(--panel);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 70px 30px;
  text-align: center;
  color: var(--muted);
}

.empty-icon, .no-result-icon { font-size: 34px; margin-bottom: 8px; }

.empty-state h3, .no-result h3 {
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 6px;
}

.empty-state p, .no-result p { margin: 4px 0; font-size: 13px; }

.empty-note { color: var(--muted-2); font-size: 12.5px; }

.loading {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 60px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #dbe4f4;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.query-summary {
  font-size: 12.5px;
  color: var(--muted);
  margin: 2px 2px 12px;
}

.query-summary b { color: var(--ink-2); }

.notice {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

.notice-info {
  background: var(--amber-soft);
  border: 1px solid #f0dfb8;
  color: var(--amber);
}

/* 主结果卡片 */
.result-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  margin-bottom: 16px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.result-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  margin-bottom: 4px;
}

.model-name {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.25;
  color: #10203a;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 12px;
  color: var(--ink-2);
  background: #f2f5fa;
  border: 1px solid #e6ebf4;
  border-radius: 4px;
  padding: 2px 8px;
}

.tag-maker {
  color: #8a5a12;
  background: var(--amber-soft);
  border-color: #f0dcb4;
  font-weight: 600;
}

.btn-copy {
  flex-shrink: 0;
  border: 1px solid #b9cdf5;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  transition: all .12s;
}

.btn-copy:hover { background: #dbe7ff; border-color: var(--primary); }

.safe-banner {
  margin-top: 14px;
  background: var(--red-soft);
  border: 1px solid #f3cbc6;
  color: #a52f22;
  font-size: 12.5px;
  border-radius: 7px;
  padding: 8px 12px;
}

/* 原厂参数 */
.oem-block {
  margin-top: 16px;
  background: #f8fafd;
  border: 1px solid #e6ecf6;
  border-radius: 8px;
  padding: 13px 15px 14px;
}

.oem-block h3 {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 10px;
  font-weight: 700;
}

.oem-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 16px;
}

.oem-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.oem-item span {
  font-size: 11.5px;
  color: var(--muted);
}

.oem-item b {
  font-size: 15px;
  color: #14233b;
  font-weight: 700;
  word-break: break-all;
}

.oem-item b:empty::after { content: '未标注'; color: var(--muted-2); font-weight: 400; }

.note-box {
  margin-top: 12px;
  background: var(--amber-soft);
  border: 1px solid #f0dfb8;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #8a6116;
  line-height: 1.6;
}

/* 推荐电池 */
.rec-block { margin-top: 18px; }

.rec-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.rec-head h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.rec-head span { font-size: 11.5px; color: var(--muted-2); }

.rec-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.rec-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid #eef2f8;
  background: #fff;
}

.rec-item:last-child { border-bottom: 0; }

.rec-item.upgrade { background: #fbfcff; }

.rec-brand {
  width: 76px;
  flex-shrink: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--primary-dark);
  padding-top: 1px;
}

.rec-main { flex: 1; min-width: 0; }

.rec-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.rec-model {
  font-family: "Consolas", "Microsoft YaHei", monospace;
  letter-spacing: .2px;
}

.rec-params {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 2px;
}

.rec-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}

.rec-fit {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--green);
  background: #eaf6f0;
  border-radius: 4px;
  padding: 2px 7px;
  margin-top: 2px;
}

.rec-item.upgrade .rec-fit {
  color: #5a4bb3;
  background: #efedfb;
}

.rec-empty {
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fbfcfe;
}

/* 类型标签 */
.type-tag,
.type-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 7px;
  line-height: 1.6;
  white-space: nowrap;
}

.type-tag { font-size: 12px; padding: 2px 9px; }

.t-normal { background: #eef1f6; color: #5c6b82; border: 1px solid #dfe5ee; }
.t-agm { background: #e8f0ff; color: #1746b8; border: 1px solid #cfdffd; }
.t-efb { background: #e6f7f3; color: #0f6b58; border: 1px solid #c8ece2; }
.t-other { background: #f4ecff; color: #6a3cb5; border: 1px solid #e2d3f8; }

.upgrade-pill {
  font-size: 10.5px;
  color: #5a4bb3;
  background: #efedfb;
  border: 1px solid #ddd8f6;
  border-radius: 4px;
  padding: 0 6px;
  font-weight: 400;
}

/* 相似车型（弱化） */
.similar-section {
  margin-top: 26px;
  padding: 14px 16px 6px;
  background: #f7f8fa;
  border: 1px solid #ebedf1;
  border-radius: 8px;
}

.similar-title {
  font-size: 12px;
  font-weight: 700;
  color: #9aa3b1;
  letter-spacing: 1px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8eaee;
  margin-bottom: 4px;
}

.similar-title span {
  font-weight: 400;
  color: #b0b7c2;
  letter-spacing: 0;
}

.similar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.similar-item {
  padding: 7px 0;
  border-bottom: 1px dashed #e9ebef;
}

.similar-item:last-child { border-bottom: 0; }

.similar-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.similar-name {
  font-size: 12.5px;
  font-weight: 400;
  color: #8b94a3;
}

.similar-meta {
  font-size: 11.5px;
  color: #a6adb9;
}

.similar-rec {
  font-size: 11.5px;
  color: #9aa3b1;
  margin-top: 1px;
}

.similar-note {
  font-size: 11px;
  color: #b0b7c2;
  margin-top: 1px;
}

.similar-section .link.mini {
  font-size: 11px;
  color: #8fa6cc;
  padding: 0;
}

.similar-section .link.mini:hover { color: var(--primary); }

.warn-text { color: #c08a2e; }

.disclaimer {
  margin: 18px 2px 0;
  font-size: 11.5px;
  color: #a6adb9;
  line-height: 1.6;
  text-align: center;
}

/* ============================== 按钮与链接 ============================== */
.link {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12.5px;
  padding: 0;
}

.link:hover { text-decoration: underline; }

.link.danger, .cell-actions .danger { color: var(--red); }

.btn-sm {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  border-radius: 6px;
  font-size: 12.5px;
}

.btn-sm:hover { border-color: #b9c8e6; color: var(--ink); }

.btn-sm.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.btn-sm.primary:hover { background: var(--primary-dark); }

.btn-sm.danger {
  color: var(--red);
  border-color: #edc9c4;
  background: #fffafa;
}

.btn-sm.danger:hover { background: var(--red-soft); }

/* ============================== 后台管理 ============================== */
.admin-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  background: #fafbfd;
}

.subtab {
  border: 0;
  background: transparent;
  padding: 13px 18px;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.subtab:hover { color: var(--ink); }

.subtab.active {
  color: var(--primary-dark);
  font-weight: 700;
  border-bottom-color: var(--primary);
  background: #fff;
}

.subpage { display: none; padding: 16px; }
.subpage.active { display: block; }

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-search {
  width: 280px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  outline: none;
  background: #fbfcfe;
}

.admin-search:focus { border-color: var(--primary); background: #fff; }

.admin-select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #fff;
  outline: none;
}

.spacer { flex: 1; }

.count-text { font-size: 12px; color: var(--muted); }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 62vh;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 1050px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f7fb;
  color: var(--ink-2);
  text-align: left;
  font-weight: 700;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f6;
  color: var(--ink-2);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #f8faff; }

.cell-model { color: var(--ink); font-weight: 600; }

.cell-sub { font-size: 11px; color: var(--muted-2); }

.cell-size { white-space: nowrap; }

.cell-note {
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
}

.cell-actions { white-space: nowrap; }

.cell-actions .link { margin-right: 10px; }

.table-empty {
  text-align: center;
  color: var(--muted-2);
  padding: 40px 10px !important;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0 2px;
}

.pager-btn {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 6px;
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.pager-btn:not(:disabled):hover { border-color: var(--primary); color: var(--primary); }

.pager-btn:disabled { opacity: .45; cursor: default; }

.pager-info { font-size: 12px; color: var(--muted); }

/* 导入导出 */
.data-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  align-items: start;
}

.data-grid .panel { box-shadow: none; }

.muted-text { font-size: 12.5px; color: var(--muted); margin: 6px 0; }

.muted-text.small { font-size: 11.5px; color: var(--muted-2); }

.import-block {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  margin: 12px 0;
  background: #fbfcfe;
}

.import-block h4 { font-size: 13px; margin-bottom: 4px; color: var(--ink); }

.field-doc {
  font-size: 11.5px;
  color: var(--muted);
  margin: 2px 0 8px;
  line-height: 1.6;
}

.import-block input[type="file"] { font-size: 12px; }

.import-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.radio-inline {
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.import-result { margin-top: 12px; }

.import-report {
  background: #f5fbf7;
  border: 1px solid #d5ecdf;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #256b48;
  margin-bottom: 8px;
  line-height: 1.7;
}

.import-warn {
  color: var(--amber);
  font-size: 12px;
}

.import-error {
  color: var(--red);
  font-size: 12px;
  background: var(--red-soft);
  border: 1px solid #f3cbc6;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  line-height: 1.7;
}

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.file-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0 12px;
}

/* ============================== 弹窗 ============================== */
.dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: 660px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(10, 25, 48, .28);
}

.dialog::backdrop { background: rgba(12, 24, 42, .42); }

.dialog-form { padding: 20px 22px 18px; }

.dialog-form h3 {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--ink);
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.dialog-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-2);
}

.dialog-grid label.wide { grid-column: 1 / -1; }

.dialog-grid input,
.dialog-grid select,
.dialog-grid textarea {
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fbfcfe;
  outline: none;
  font-size: 13px;
  resize: vertical;
}

.dialog-grid input:focus,
.dialog-grid select:focus,
.dialog-grid textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ============================== Toast ============================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 20px);
  background: #14233b;
  color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 7px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(10, 25, 48, .3);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.toast.error { background: #a52f22; }

/* ========================= 结果操作区（复制参数 / 话术） ========================= */
.result-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 132px;
}

.result-actions .btn-copy { width: 100%; }

.btn-copy.ghost {
  background: #fff;
  border-color: var(--line-2);
  color: var(--ink-2);
  font-weight: 600;
}

.btn-copy.ghost:hover {
  background: #f4f7fc;
  border-color: #b9c6da;
  color: var(--ink);
}

.rec-price {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 800;
  color: #b7791f;
  white-space: nowrap;
  padding-top: 1px;
  min-width: 92px;
  text-align: right;
}

.rec-price small {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted-2);
  text-align: right;
}

/* ============================ 推荐设置页 ============================ */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-grid .panel { box-shadow: none; }

.brand-setting-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.brand-setting-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid #eef2f8;
  background: #fff;
  font-size: 13px;
}

.brand-setting-item:last-child { border-bottom: 0; }

.brand-setting-item:hover { background: #f8fafd; }

.brand-check {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.brand-check input { width: 15px; height: 15px; accent-color: var(--primary); }

.brand-rank {
  font-size: 11.5px;
  color: var(--muted-2);
  min-width: 34px;
  text-align: right;
}

.brand-setting-item .link {
  min-width: 26px;
  text-align: center;
  font-size: 14px;
  line-height: 1;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

#maxPrimaryInput {
  width: 90px;
  padding: 9px 11px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #fff;
}

/* ============================== 响应式 ============================== */
@media (max-width: 1200px) {
  .query-grid { grid-template-columns: 300px minmax(0, 1fr); }
  .oem-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .data-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .logo { min-width: auto; }
  .data-meta { display: none; }
  .query-grid { grid-template-columns: 1fr; }
  .side-col { position: static; }
  .oem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-name { font-size: 22px; }
  .result-head { flex-direction: column; }
  .admin-toolbar { flex-wrap: wrap; }
  .admin-search { width: 100%; }
  .layout { padding: 14px; }
  .dialog-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ============================== 苹果手机（iPhone）适配 ==============================
   iPhone 逻辑宽度 ≤ 430px，这里覆盖到 600px 兼容小屏安卓。
   要点：输入框字号 ≥16px 避免 iOS 聚焦自动放大、点击区域 ≥44px、
   刘海屏 / 底部横条使用 env(safe-area-inset-*)。 */
@media (max-width: 600px) {
  html { -webkit-text-size-adjust: 100%; }
  body { -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px; }

  /* 顶部栏：刘海安全区 + 两行排列（第一行标题，第二行页签） */
  .topbar { padding-top: env(safe-area-inset-top); }
  .topbar-inner { padding: 9px 12px 10px; gap: 8px; }
  .logo { min-width: 0; gap: 8px; flex: 1; }
  .logo-mark { width: 34px; height: 34px; font-size: 17px; border-radius: 8px; }
  .logo-text h1 { font-size: 15px; letter-spacing: 0; }
  .logo-text p { display: none; }
  .tabs { width: 100%; margin: 2px 0 0; padding: 3px; }
  .tab { flex: 1; padding: 8px 12px; font-size: 14px; text-align: center; }

  .layout { padding: 10px 10px calc(30px + env(safe-area-inset-bottom)); }

  /* 总搜索栏 */
  .quick-search { padding: 10px; border-radius: 10px; margin-bottom: 10px; }
  .quick-row { flex-wrap: nowrap; gap: 8px; }
  .quick-icon { display: none; }
  #quickInput { flex: 1 1 auto; min-width: 0; padding: 11px 12px; }
  .quick-btn { width: auto; flex-shrink: 0; padding: 11px 18px; font-size: 15px; }
  .quick-hint { display: none; }

  /* 检索条件面板 */
  .panel { padding: 14px 12px; border-radius: 10px; }
  .field input { padding: 11px 12px; }
  .type-select { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .type-select label { padding: 11px 12px; justify-content: flex-start; font-size: 14px; }
  .type-select label span { white-space: nowrap; overflow: hidden; }
  .btn-query, .btn-ghost { width: 100%; min-height: 46px; font-size: 16px; border-radius: 9px; }
  .btn-ghost { margin-top: 8px; }
  .form-hint { font-size: 11.5px; }

  /* 结果卡片 */
  .result-card { padding: 14px 13px 16px; margin-bottom: 12px; border-radius: 10px; }
  .model-name { font-size: 20px; }
  .result-head { gap: 10px; }
  .btn-copy { width: 100%; padding: 10px; font-size: 14px; }
  .tag { font-size: 11.5px; }
  .oem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .oem-item b { font-size: 14px; }

  /* 推荐电池列表：品牌独占一行，价格与达标标记靠右 */
  .rec-item { flex-wrap: wrap; gap: 6px 10px; padding: 11px 12px; }
  .rec-brand { width: auto; padding-top: 0; }
  .rec-brand::after { content: '·'; margin-left: 8px; color: var(--line-2); font-weight: 400; }
  .rec-main { flex: 1 1 60%; }
  .rec-price { text-align: right; }
  .rec-fit { margin-left: auto; }

  /* 历史记录 */
  .history-list li { padding: 10px 10px; }

  /* 后台管理 */
  .admin-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .subtab { padding: 9px 14px; font-size: 13.5px; white-space: nowrap; }
  .admin-toolbar { gap: 8px; }
  .admin-toolbar .btn-sm { flex: 1; min-height: 40px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 760px; }
  .pager button { min-width: 40px; min-height: 40px; }

  /* 弹窗：占满屏幕宽度，底部安全区留白 */
  .dialog { width: calc(100vw - 24px); max-width: none; max-height: 88vh; }
  .dialog-form { padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
  .dialog-actions button { flex: 1; min-height: 44px; font-size: 15px; }

  /* 复制提示 */
  .toast { max-width: calc(100vw - 32px); }
}
