/* 知件 · 斯巴鲁零件电子目录 —— 样式 v4（对齐原版 snaponepc 中文版流程） */
:root {
  --red: #C8102E;
  --blue: #2F5B94;          /* 原版钢蓝主色 */
  --link: #1155CC;          /* 原版零件号链接蓝 */
  --ink: #1F2329;
  --paper: #D9E0EA;         /* 原版页底灰蓝 */
  --line: #A8BBD4;          /* 面板描边（原版钢蓝细线） */
  --line-soft: #D5DEEB;
  --muted: #5B6B80;
  --band: #D7E3F2;          /* 工具横条 */
  --band2: #E2EBF7;         /* 次级横条 */
  --thead: #DCE6F5;         /* 表头浅蓝 */
  --selrow: #B6CDE8;        /* 选中行蓝 */
  --grid-card: #CBD8EA;
  --grid-card-h: #B7C8E0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 13px; color: var(--ink); background: var(--paper);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}

/* ---------------- 登录页 ---------------- */
.login-body { display: flex; flex-direction: column; min-height: 100vh; height: auto; overflow: auto; }
.login-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 36px; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; border-radius: 6px; padding: 2px 4px; }
.brand:hover { background: rgba(200, 16, 46, 0.08); }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.brand-sub { font-size: 13px; color: var(--muted); }
.login-top-right { font-size: 13px; color: var(--muted); }
.login-main { flex: 1; display: flex; gap: 40px; padding: 48px 72px; }
.login-hero { flex: 1.3; }
.login-hero h1 { font-size: 40px; line-height: 1.35; letter-spacing: 2px; font-weight: 700; }
.hero-sub { margin: 18px 0 30px; color: var(--muted); font-size: 15px; }
.feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 40px; }
.feat { border-top: 1px solid var(--line); padding-top: 12px; }
.feat .no { color: var(--muted); font-size: 12px; margin-right: 8px; }
.feat b { font-size: 15px; }
.feat small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.login-card {
  width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 28px 28px 20px; align-self: flex-start;
}
.login-card h2 { margin: 12px 0 6px; font-size: 22px; }
.card-hint { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.tabs { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.tab { flex: 1; padding: 9px 0; border: 0; background: #F2EFE7; cursor: pointer; font-size: 14px; }
.tab-on { background: var(--blue); color: #fff; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.ipt input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; background: #fff;
}
.ipt input:focus { outline: none; border-color: var(--blue); }
.btn-login {
  width: 100%; margin-top: 20px; padding: 12px 0; border: 0; border-radius: 6px;
  background: var(--blue); color: #fff; font-size: 15px; cursor: pointer;
}
.btn-login:disabled { background: #A9B4C2; cursor: not-allowed; }
.card-msg { margin-top: 10px; font-size: 13px; min-height: 18px; color: #3B6D11; }
.card-msg.err { color: var(--red); }
.card-note { margin-top: 14px; font-size: 12px; color: var(--muted); }
.card-foot { margin-top: 10px; font-size: 12px; }
.card-foot a { color: var(--muted); margin-right: 14px; }
.login-foot { padding: 14px 36px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------------- 顶栏 / 徽章 ---------------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 4px 10px;
  background: var(--band); border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.topbar .brand-name { font-size: 15px; letter-spacing: 1px; color: var(--blue); }
.search-wrap { flex: 1; display: flex; gap: 6px; min-width: 0; }
.search-wrap input {
  flex: 1; max-width: 640px; min-width: 0; padding: 4px 10px; font-size: 13px; height: 26px;
  border: 1px solid var(--line); border-radius: 3px; background: #fff;
}
.search-wrap input:focus { outline: none; border-color: var(--blue); }
.search-wrap button {
  padding: 0 16px; height: 26px; border: 1px solid #7E97B8; border-radius: 3px;
  background: linear-gradient(#4C79AC, #3D6B9E); color: #fff; font-size: 12.5px; cursor: pointer;
}
.search-wrap button.ghost {
  background: linear-gradient(#F2F6FB, #E2EBF7); color: var(--ink);
}
.top-right { display: flex; gap: 8px; }
.badge {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis;
  background: #F2EFE7; color: var(--muted); white-space: nowrap; cursor: default;
}
.badge.vip { background: #FBEDEA; color: var(--red); cursor: pointer; }

/* ---------------- 面包屑（原版同款） ---------------- */
.crumb-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 10px; background: var(--band2); border-bottom: 1px solid var(--line);
  flex: 0 0 auto; min-height: 28px; overflow: hidden;
}
.crumb-trail { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; font-size: 12.5px; }
.crumb-item { color: var(--blue); cursor: pointer; padding: 1px 5px; }
.crumb-item:hover { text-decoration: underline; background: none; }
.crumb-item.cur { color: var(--ink); font-weight: 700; cursor: default; }
.crumb-item.cur:hover { background: none; }
.crumb-sep { color: #98A2B0; }
.crumb-right { display: flex; align-items: center; gap: 8px; }
.crumb-page { font-size: 12px; color: var(--muted); }
.mini-btn {
  padding: 2px 10px; height: 24px; border: 1px solid #7E97B8; border-radius: 3px;
  background: linear-gradient(#F2F6FB, #E2EBF7); color: var(--ink); font-size: 12px; cursor: pointer;
}
.mini-btn:hover { border-color: var(--blue); color: var(--blue); }

/* 车辆解析信息条（VIN 定位后） */
.vehicle-info {
  padding: 3px 10px; background: #FFF9EC; border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink); flex: 0 0 auto;
  font-family: Consolas, "Microsoft YaHei", monospace;
}
.vehicle-info b { color: var(--blue); }

/* ---------------- 层级卡片网格 ---------------- */
.flow { flex: 1; display: flex; min-height: 0; min-width: 0; position: relative; background: var(--paper); overflow: hidden; }
.grid-page {
  flex: 1; overflow-y: auto; background: #fff;
  padding: 18px 22px 30px; display: block;
}
.grid-hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* 年款大卡（原版：浅蓝灰网格） */
.year-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
}
.year-cell {
  height: 84px; background: var(--grid-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; cursor: pointer; border: 1px solid #9FB3CE;
}
.year-cell:hover { background: var(--grid-card-h); border-color: #9FB0C2; }
.year-cell.none { color: #98A2B0; cursor: default; }
.year-cell.none:hover { background: var(--grid-card); border-color: transparent; }

/* 车型/总成/图示页 缩略卡片 */
.thumb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.tcard {
  background: #fff; border: 1px solid var(--line);
  overflow: hidden; cursor: pointer; text-align: center;
  display: flex; flex-direction: column;
}
.tcard:hover { border-color: var(--blue); outline: 2px solid #9FB9DC; }
.tcard.sel { border-color: var(--blue); outline: 2px solid var(--blue); }
.tcard .timg {
  height: 120px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fff; padding: 6px;
}
.tcard .timg img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tcard .timg.noimg { color: var(--muted); font-size: 12px; }
.tcard .tname {
  padding: 8px 10px 10px; font-size: 13px; line-height: 1.4;
  word-break: break-all;
}
.tcard .tcode { font-size: 15px; font-weight: 700; padding: 10px 10px 2px; }
.tcard .tpages { font-size: 11px; color: var(--muted); padding-bottom: 8px; }

/* ---------------- 零件页：左图右表 ---------------- */
#pg-detail { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.detail-row { display: flex; flex: 0 0 auto; min-height: 0; overflow: hidden; }
.detail-spacer { flex: 1 1 auto; background: var(--paper); }
.detail-left {
  flex: 0 0 60%; max-width: 60%; display: flex; flex-direction: column;
  background: #fff; overflow: hidden;
}
.divider {
  flex: 0 0 6px; cursor: col-resize; background: #C4D2E5;
}
.divider:hover, .divider.on { opacity: 1; background: var(--blue); }
.detail-right {
  flex: 1 1 auto; min-width: 0; overflow: scroll; background: #fff; height: 100%;
}
/* 零件表滚动条（上下左右均可滚动） */
.detail-right::-webkit-scrollbar { width: 12px; height: 12px; }
.detail-right::-webkit-scrollbar-track { background: #F4F2EB; }
.detail-right::-webkit-scrollbar-thumb { background: #C9C2B2; border-radius: 6px; border: 2px solid #F4F2EB; }
.detail-right::-webkit-scrollbar-thumb:hover { background: #A89F8A; }
.detail-right::-webkit-scrollbar-corner { background: #F4F2EB; }
/* 零件详情浮动卡（选中才出现，不占常驻空间） */
#fig-pop {
  position: absolute; left: 10px; bottom: 10px; z-index: 7;
  width: 380px; max-height: 55%; overflow-y: auto;
  background: #fff; border: 1px solid #7E97B8; box-shadow: 0 4px 14px rgba(0,0,0,.18);
  font-size: 12.5px;
}
.fig-pop-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 10px; background: var(--thead); border-bottom: 1px solid #8CA6C8;
  position: sticky; top: 0;
}
.fig-pop-head button { border: 0; background: none; cursor: pointer; font-size: 13px; }
#fig-pop-body { padding: 8px 12px 10px; }
#fig-pop-body h4 { margin: 8px 0 3px; font-size: 12px; color: var(--muted); }
#fig-pop-body table { width: 100%; border-collapse: collapse; }
#fig-pop-body td { padding: 3px 5px; border-bottom: 1px solid #E4EAF2; }
#fig-pop-body .price-main { font-size: 15px; font-weight: 700; color: var(--red); }
.fig-wrap {
  position: relative; flex: 0 0 auto; overflow: auto; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.fig-wrap.dragging { cursor: grabbing; }
.fig-wrap.dragging { cursor: grabbing; }
#fig-inner { position: relative; flex: 0 0 auto; }
.fig-wrap img { width: 100%; height: 100%; display: block; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay circle.hs { fill: rgba(200,16,46,.16); stroke: var(--red); stroke-width: 2.5; cursor: pointer; }
#overlay circle.hs.dim { fill: rgba(200,16,46,.05); stroke: rgba(200,16,46,.55); stroke-width: 1.2; }
#overlay circle.hs.on { fill: rgba(200,16,46,.22); stroke: var(--red); stroke-width: 3.5; }
#fig-tip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.fig-tools {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--band2); border-bottom: 1px solid var(--line);
  padding: 3px 8px; font-size: 12px; color: var(--muted);
}
.fig-tools button {
  border: 1px solid #7E97B8; background: linear-gradient(#F2F6FB, #E2EBF7); border-radius: 3px;
  padding: 1px 9px; height: 22px; cursor: pointer; font-size: 12px; color: var(--ink);
}
.fig-tools button:hover { border-color: var(--blue); color: var(--blue); }
#zoom-label { min-width: 40px; text-align: center; }

/* ---------------- 零件表（原版列序 + 行内替代链展开） ---------------- */
.tbl {
  width: max-content; border-collapse: collapse; font-size: 12.5px;
}
.tbl th, .tbl td { white-space: nowrap; }
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--thead); box-shadow: 0 1px 0 var(--line);
  border-right: 1px solid #C3D2E8;
}
.tbl th {
  position: sticky; top: 0; background: var(--thead); text-align: left;
  padding: 5px 8px; border-bottom: 1px solid #8CA6C8; z-index: 2; white-space: nowrap;
}
.tbl td { padding: 4px 8px; border-bottom: 1px solid #E4EAF2; border-right: 1px solid #EDF1F7; vertical-align: top; }
.tbl tr.row { cursor: pointer; height: 26px; }
.tbl tr.row:hover { background: #EAF1FA; }
.tbl tr.row.on { background: var(--selrow); }
.tbl td.pn { font-family: Consolas, monospace; }
.tbl td.pn a { color: var(--link); text-decoration: underline; cursor: pointer; }
.tbl td.co { font-family: Consolas, monospace; }
.tbl td.add {
  width: 26px; text-align: center; cursor: pointer; color: var(--blue);
  font-size: 14px; font-weight: 700; user-select: none; line-height: 1;
}
.tbl td.add:hover { color: #fff; background: var(--blue); }
.tbl td.add.done { color: #2E7D32; background: #E5F3E2; }
tr.subrow td {
  background: #F8FAFC; font-size: 12px; padding: 4px 10px 4px 26px; color: var(--muted);
}
.tbl-empty { padding: 80px 30px; text-align: center; color: var(--muted); font-size: 15px; line-height: 2; }
.tbl-empty .big { font-size: 20px; color: var(--ink); }

/* ---------------- 详情浮层 ---------------- */
.detail {
  position: absolute; right: 0; top: 0; bottom: 0; z-index: 6;
  width: 0; transition: width .15s; background: #fff;
  border-left: 1px solid var(--line); box-shadow: -6px 0 16px rgba(0,0,0,.08);
  display: flex; flex-direction: column; overflow: hidden;
}
.detail.open { width: 320px; }
.detail-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.detail-head button { border: 0; background: none; cursor: pointer; font-size: 15px; }
#detail-body { padding: 12px 14px; overflow-y: auto; font-size: 13px; }
#detail-body h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
#detail-body table { width: 100%; border-collapse: collapse; }
#detail-body td { padding: 5px 4px; border-bottom: 1px solid #F0EDE4; }
.price-main { font-size: 17px; font-weight: 700; color: var(--red); }
.kv { color: var(--muted); }
.mono { font-family: Consolas, monospace; }

/* ---------------- 状态栏 ---------------- */
.status {
  display: flex; justify-content: space-between; align-items: center; padding: 3px 10px;
  border-top: 1px solid var(--line); background: var(--band);
  font-size: 12px; color: var(--muted); flex: 0 0 auto; min-height: 26px;
}

/* ---------------- 订阅页 ---------------- */
.sub-body { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
.sub-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sub-head h1 { font-size: 22px; }
.sub-state { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; margin-bottom: 20px; }
.sub-state .st-main { font-size: 17px; font-weight: 700; }
.sub-state .st-main.red { color: var(--red); }
.sub-state .st-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0 24px; }
.plan {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 20px 16px; text-align: center; cursor: pointer;
}
.plan:hover { border-color: var(--blue); }
.plan.on { border-color: var(--blue); background: #F2F6FB; }
.plan b { font-size: 16px; display: block; }
.plan .days { color: var(--muted); font-size: 12px; margin: 6px 0; }
.plan .price { font-size: 22px; font-weight: 700; color: var(--red); }
.pay-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; margin-bottom: 20px; }
.pay-box h3 { font-size: 15px; margin-bottom: 12px; }
.pay-qr { width: 180px; height: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #FBFAF6; display: block; }
.pay-note { color: var(--muted); font-size: 13px; margin: 10px 0; }
.pay-row { display: flex; gap: 10px; }
.pay-row input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.btn-blue { padding: 9px 22px; border: 0; border-radius: 6px; background: var(--blue); color: #fff; cursor: pointer; font-size: 14px; }
.btn-ghost { padding: 9px 22px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; }
.red-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.order-tip { color: #3B6D11; font-size: 13px; margin-top: 8px; min-height: 18px; }
.logout-row { text-align: center; margin-top: 26px; }

/* 年份网格"更多"按钮 */
.year-cell.more-cell {
  background: #fff; border: 1px dashed #9FB0C2; color: var(--blue);
  font-weight: 700;
}
.year-cell.more-cell:hover { background: #EDF2F8; }

/* ---------------- 底部配件篮（原版布局） ---------------- */
.tray {
  flex: 1 1 auto; min-height: 96px; border-top: 1px solid var(--line); background: #fff;
  display: flex; flex-direction: column;
}
.tray-actions {
  display: flex; align-items: center; gap: 5px; padding: 3px 8px;
  background: var(--band2); border-bottom: 1px solid var(--line);
}
.tray-actions button {
  border: 1px solid #7E97B8; background: linear-gradient(#F2F6FB, #E2EBF7);
  border-radius: 3px; padding: 1px 9px; height: 22px; cursor: pointer;
  font-size: 12px; color: var(--ink);
}
.tray-actions button:hover { background: linear-gradient(#E2EBF7, #D7E3F2); }
.tray-right { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.tray-right select {
  height: 22px; border: 1px solid #7E97B8; border-radius: 3px; font-size: 12px; background: #fff;
}
.tray-right b { color: var(--blue); }
.tray-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.tray-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.tray-scroll::-webkit-scrollbar-track { background: #F4F2EB; }
.tray-scroll::-webkit-scrollbar-thumb { background: #C9C2B2; border-radius: 6px; border: 2px solid #F4F2EB; }
.tray-tbl { font-size: 12px; }
.tray-tbl thead th { background: var(--thead); padding: 4px 8px; border-bottom: 1px solid #8CA6C8; position: sticky; top: 0; }
.tray-tbl td { padding: 2px 8px; border-bottom: 1px solid #E4EAF2; }
.tray-total td {
  background: #EDF2F9; font-weight: 700; color: var(--blue);
  border-top: 1px solid #8CA6C8; padding: 4px 8px;
}
.tray-del { color: #98A2B0; cursor: pointer; text-align: center; width: 26px; }
.tray-del:hover { color: var(--red); }


/* ---------------- 打印：A4 竖版配件清单 ---------------- */
#print-sheet { display: none; }
@page { size: A4 portrait; margin: 14mm 12mm; }
@media print {
  html, body { height: auto; overflow: visible !important; background: #fff; }
  body.printing > *:not(#print-sheet) { display: none !important; }
  body.printing #print-sheet {
    display: block !important;
    position: absolute; left: 0; top: 0; width: 100%;
    color: #000; font-size: 12px;
  }
}
#print-sheet h1 { font-size: 20px; letter-spacing: 6px; margin-bottom: 2px; }
#print-sheet .ps-brand { font-size: 11px; color: #444; margin-bottom: 10px; }
#print-sheet .ps-info { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
#print-sheet .ps-info td { border: 1px solid #999; padding: 4px 8px; }
#print-sheet .ps-info td.k { width: 90px; background: #EEF2F8; font-weight: 700; }
#print-sheet .ps-tbl { width: 100%; border-collapse: collapse; table-layout: auto; }
#print-sheet .ps-tbl th, #print-sheet .ps-tbl td {
  border: 1px solid #999; padding: 4px 6px; text-align: left;
  white-space: normal; word-break: break-all; vertical-align: top;
}
#print-sheet .ps-tbl th { background: #EEF2F8; font-size: 11.5px; }
#print-sheet .ps-tbl td.mono { font-family: Consolas, monospace; }
#print-sheet .ps-total td { background: #EEF2F8; font-weight: 700; }
#print-sheet .ps-foot { margin-top: 10px; font-size: 10.5px; color: #444; }

.fig-tools-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.fig-tools .mini-btn { height: 22px; padding: 1px 9px; }

/* 托盘列宽自适应（覆盖 .tbl 的 nowrap/max-content） */
.tray-tbl { width: 100% !important; min-width: 0 !important; table-layout: auto; }
.tray-tbl th, .tray-tbl td { white-space: normal !important; word-break: break-word; }
.tray-tbl .qty-in {
  width: 56px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 3px;
  font-size: 12.5px; text-align: center; background: #fff;
}
.tray-tbl .qty-in:focus { outline: none; border-color: var(--blue); }
#overlay rect.hl { pointer-events: none; }

#overlay rect.figref { cursor: pointer; fill: transparent; }
#overlay rect.figref:hover { fill: rgba(0,255,0,.18); }

.veh-chip {
  background: #E7F0DA !important; color: #3B6D11 !important;
  font-weight: 700; cursor: pointer; max-width: 320px;
}
.veh-chip:hover { background: #D8E8C8 !important; }

.tray-tbl a.tray-link { color: var(--link); cursor: pointer; text-decoration: underline; }
.tray-tbl a.tray-link:hover { color: var(--blue); }
