/* 设计令牌：长城红为主色，中性灰为底 */
:root {
  --bg: #F4F5F7;
  --panel: #FFFFFF;
  --panel-2: #F2F3F5;
  --text: #1F2329;
  --muted: #6B7280;
  --line: #E2E4E8;
  --brand: #C8161D;          /* 长城红：主操作、选中、链接 */
  --brand-dark: #A01218;
  --link: #C8161D;
  --link-soft: #FCEEEE;      /* 选中/悬停的浅红底 */
  --part: #E8840C;           /* 爆炸图中选中零件的描色，与红色图号区分 */
  --part-soft: #FFF4E5;
  --ok: #2D9D70;
  --warn: #C98A12;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 41, .06), 0 4px 16px rgba(31, 35, 41, .05);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); border-top: 3px solid var(--brand);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .5px;
}
.brand strong { display: block; font-size: 16px; }
.brand div span { color: var(--muted); font-size: 12px; }
.topbar-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }


.connection { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.connection .dot { width: 9px; height: 9px; border-radius: 50%; background: #B8C4CB; }
.connection.ready .dot { background: var(--ok); }
.connection.waiting .dot { background: var(--warn); }
.connection.demo .dot { background: var(--link); }

/* ---------- 按钮 ---------- */
.primary, .secondary, .ghost {
  border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; font-weight: 600; white-space: nowrap;
}
.primary { background: var(--brand); color: #fff; }
.primary:hover { background: var(--brand-dark); }
.secondary { background: var(--panel); border-color: var(--line); }
.secondary:hover { border-color: var(--link); color: var(--link); }
.ghost { background: transparent; color: var(--link); padding: 6px 10px; }
.small { padding: 6px 12px; font-size: 13px; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.icon-button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  font-size: 18px; line-height: 1;
}

/* ---------- 首页：车架号输入 ---------- */
.landing { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px 16px 12vh; }
.landing-card { width: min(640px, 100%); text-align: center; }
.landing-card h1 { margin: 0 0 10px; font-size: 32px; letter-spacing: .5px; }
.landing-sub { margin: 0 0 28px; color: var(--muted); font-size: 15px; line-height: 1.6; }
#vin-form { display: flex; gap: 10px; }
.vin-field { position: relative; flex: 1; }
.vin-field input {
  width: 100%; padding: 15px 64px 15px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 20px; letter-spacing: 1.5px; box-shadow: var(--shadow);
}
.vin-field input:focus { border-color: var(--link); outline: 3px solid var(--link-soft); }
.vin-field span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
#vin-submit { padding: 0 30px; border-radius: 12px; font-size: 17px; min-width: 110px; }
.landing-status { min-height: 28px; margin-top: 16px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.landing-status.error { color: var(--brand); }
.landing-status a { color: var(--link); }
.spinner.small { width: 16px; height: 16px; border-width: 2px; margin: 0; }

/* ---------- 查询页：车型信息栏 ---------- */
.vehicle-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.vehicle-summary { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; }
.vehicle-summary div { display: flex; gap: 6px; align-items: baseline; }
.vehicle-summary dt { color: var(--muted); font-size: 12px; }
.vehicle-summary dd { margin: 0; font-weight: 600; }
.vehicle-summary div:first-child dd { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* ---------- 主体 ---------- */
.workspace {
  display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px;
  padding: 16px 20px 24px; align-items: start;
}
.tree-panel, .content-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tree-panel { position: sticky; top: 70px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.tree-heading { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.tree-heading .ghost { font-weight: 500; font-size: 12px; padding: 4px 8px; }
.tree { overflow: auto; padding: 6px 0 10px; }
.tree-empty { color: var(--muted); padding: 8px 14px; margin: 0; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 14px; }
.tree-node {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 12px; border: 0; background: none;
  text-align: left; border-radius: 6px; color: var(--text);
}
.tree-node:hover { background: var(--panel-2); }
.tree-node.active { background: var(--link-soft); color: var(--link); font-weight: 600; }
.tree-node .caret { width: 12px; color: var(--muted); font-size: 10px; flex: none; transition: transform .15s; }
.tree-node.open .caret { transform: rotate(90deg); }
.tree-node .count { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.tree-node.level-0 { font-weight: 600; }
.tree-hint { color: var(--muted); font-size: 12px; padding: 4px 12px 4px 30px; }

.content-panel { min-height: 520px; display: flex; flex-direction: column; min-width: 0; }
.breadcrumb {
  display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 12px 16px;
  border-bottom: 1px solid var(--line); font-size: 13px; min-height: 45px;
}
.breadcrumb li { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; color: #B8C4CB; }
.breadcrumb button { border: 0; background: none; color: var(--link); padding: 2px 4px; border-radius: 4px; }
.breadcrumb button:hover { background: var(--link-soft); }
.breadcrumb li:last-child { color: var(--text); font-weight: 600; }
.content { padding: 16px; flex: 1; }
.footnote { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head .meta { color: var(--muted); font-size: 13px; }


/* ---------- 内容区头部：目录按钮（手机）、上一级（手机）、面包屑 ---------- */
.content-head { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 0 12px 0 4px; min-height: 45px; }
.content-head .breadcrumb { border-bottom: 0; flex: 1; min-width: 0; }
.head-button {
  display: none; align-items: center; gap: 4px; flex: none; border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--text);
}
.head-button.invisible { visibility: hidden; }
.tree-mask { display: none; }

/* ---------- 列表卡片 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.node-card {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.node-card:hover { border-color: var(--link); box-shadow: var(--shadow); }
.node-card strong { font-size: 15px; }
.node-card span { color: var(--muted); font-size: 12px; }

.subsystem-list { display: grid; gap: 10px; }
.subsystem {
  display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
}
.subsystem h3 { margin: 0; font-size: 15px; }
.subsystem .code { color: var(--muted); font-size: 12px; }
.tab-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.tab-button {
  display: inline-flex; align-items: center; gap: 14px; min-width: 150px; justify-content: space-between;
  padding: 9px 12px 9px 14px; border-radius: 8px; text-align: left;
  border: 1.5px solid var(--link); background: var(--panel); color: var(--link); box-shadow: 0 1px 2px rgba(200, 22, 29, .12);
  transition: background .15s, color .15s, transform .15s;
}
.tab-button .tab-name { display: block; font-weight: 700; font-size: 14px; }
.tab-button small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.tab-button .tab-arrow { font-size: 22px; line-height: 1; font-weight: 400; transition: transform .15s; }
.tab-button:hover { background: var(--link); color: #fff; }
.tab-button:hover small { color: rgba(255, 255, 255, .85); }
.tab-button:hover .tab-arrow { transform: translateX(3px); }
.subsystem.single { cursor: pointer; }
.subsystem.single:hover { border-color: var(--link); background: #FFFAFA; }
.subsystem.single:hover .tab-button { background: var(--link); color: #fff; }
.subsystem.single:hover .tab-button small { color: rgba(255, 255, 255, .85); }
.tree-node.leaf { color: var(--text); }
.tree-node.leaf.active { color: var(--link); }
.tree-node.leaf .leaf-arrow { margin-left: auto; color: var(--link); font-size: 16px; line-height: 1; opacity: .7; }
.tree-node.leaf:hover .leaf-arrow { opacity: 1; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #FBF7F7; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
td.mono, td.nowrap { white-space: nowrap; }
.link-text { color: var(--link); font-weight: 600; }
.num { text-align: center; white-space: nowrap; }
.dim { color: var(--muted); }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; background: var(--panel-2); color: var(--muted); }
.tag.warn { background: #FBF1DE; color: #8A5E0B; }

/* ---------- 爆炸图 ---------- */
.atlas { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); gap: 14px; align-items: start; }
.viewer { position: sticky; top: 90px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.viewer-tools {
  display: flex; gap: 6px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.viewer-tools .hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.viewer-stage { height: min(68vh, 640px); cursor: grab; touch-action: none; user-select: none; }
.viewer-stage.dragging { cursor: grabbing; }
.viewer-stage svg { width: 100%; height: 100%; display: block; }
.viewer-empty { display: grid; place-items: center; height: 320px; color: var(--muted); }

.viewer-stage [data-callout] { cursor: pointer; }
.viewer-stage [data-callout]:hover path { fill: var(--link-soft); }
.viewer-stage .callout-hit path { fill: var(--brand) !important; stroke: var(--brand); }
.viewer-stage .callout-hit text { fill: #fff !important; font-weight: 700; }
.viewer-stage .callout-hit line { stroke: var(--brand); stroke-width: .3; }
.viewer-stage .part-hit * { stroke: var(--part) !important; }

.parts-table tr.row-hit td { background: var(--link-soft); }
.parts-table tr.row-hit td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.parts-table tr.row-selected td { background: var(--part-soft); }
.callout-cell { font-weight: 700; }
.group-start td { border-top: 2px solid var(--line); }
.info-button {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--link); color: var(--link);
  background: var(--panel); font-weight: 700; font-size: 12px; line-height: 1;
}
.info-button:hover { background: var(--link); color: #fff; }

/* ---------- 状态 ---------- */
.state { display: grid; place-items: center; text-align: center; padding: 60px 20px; color: var(--muted); }
.state h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.state p { margin: 0 0 14px; max-width: 460px; line-height: 1.6; }
.state .actions { display: flex; gap: 8px; justify-content: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--link);
  animation: spin .8s linear infinite; margin-bottom: 12px;
}
.state.error h3 { color: var(--brand); }
.steps { display: grid; gap: 6px; margin: 14px auto 0; text-align: left; max-width: 420px; }
.steps li { list-style: none; }

/* ---------- 详情抽屉 ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 40;
  background: var(--panel); box-shadow: -8px 0 32px rgba(23, 33, 43, .16); display: flex; flex-direction: column;
}
.drawer-mask { position: fixed; inset: 0; background: rgba(23, 33, 43, .25); z-index: 39; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.drawer-tabs button {
  border: 0; background: none; padding: 11px 10px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.drawer-tabs button[aria-selected="true"] { color: var(--link); border-bottom-color: var(--link); font-weight: 600; }
.drawer-tabs button .badge { margin-left: 3px; font-size: 11px; color: var(--muted); }
.drawer-body { padding: 16px 18px; overflow: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; line-height: 1.5; }
.empty-tab { color: var(--muted); padding: 24px 0; text-align: center; }
.raw-list { display: grid; gap: 8px; }
.raw-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }


/* ---------- 链接按钮、表单通用 ---------- */
a.primary, a.secondary { display: inline-block; text-decoration: none; }
a.brand { color: inherit; text-decoration: none; }
select, .modal-form input, .inline-form input {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font: inherit; min-width: 0;
}
.form-error { color: var(--brand); margin: 0; min-height: 1.2em; font-size: 13px; }
.hint-text { color: var(--muted); font-size: 12px; margin: 8px 0 0; line-height: 1.6; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- 登录页 ---------- */
.login-body { display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 28px 26px 22px;
}
.login-card .brand { margin-bottom: 22px; }
.modal-form { display: grid; gap: 12px; }
.modal-form label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.modal-form .primary { margin-top: 4px; padding: 11px 16px; }

/* ---------- 弹窗 ---------- */
.modal { border: 0; border-radius: 14px; padding: 24px; width: min(400px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(23, 33, 43, .25); }
.modal::backdrop { background: rgba(23, 33, 43, .35); }
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 用户菜单 ---------- */
.user-menu { position: relative; }
.user-menu summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px;
  border-radius: 999px; border: 1px solid var(--line);
}
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: #fff; font-weight: 700; font-size: 13px; }
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; z-index: 30; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid;
}
.menu-head { padding: 8px 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu a, .menu button { text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; background: none; border: 0; font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--panel-2); }

/* ---------- 管理后台 ---------- */
.admin-tabs { display: flex; gap: 4px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tabs button { border: 0; background: none; padding: 12px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap; }
.admin-tabs button[aria-selected="true"] { color: var(--link); border-bottom-color: var(--link); }
.admin-main { padding: 16px 20px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1280px; margin: 0 auto; }
.admin-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel-card { min-width: 0; }
.admin-panel th, .admin-panel td { white-space: nowrap; }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card-title { margin: 0 0 12px; font-size: 16px; }
.meta.good { color: var(--ok); font-weight: 600; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { font-size: 15px; }
.stat strong.bad { color: var(--brand); }
.remote { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; align-items: start; margin-top: 12px; }
.remote-screen { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); min-height: 200px; }
.remote-screen img { display: block; width: 100%; height: auto; cursor: crosshair; }
.remote-controls { display: grid; gap: 10px; }
.remote-controls label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.remote-controls input[type="text"], .remote-controls input[type="password"] { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.remote-controls label.check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.key-row { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }

@media (max-width: 820px) {
  .remote { grid-template-columns: 1fr; }
  .admin-main { padding: 12px 12px 24px; }
  .inline-form label, .inline-form input, .inline-form select { width: 100%; }
  .inline-form .primary { width: 100%; }
  .user-name { display: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .atlas { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .viewer-stage { height: 52vh; }
}
@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .content-panel { min-width: 0; }
  /* 目录树改为左侧滑出抽屉 */
  .tree-panel {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); max-height: none; z-index: 45;
    border-radius: 0 12px 12px 0; transform: translateX(-105%); transition: transform .22s ease;
  }
  body.tree-open .tree-panel { transform: none; }
  body.tree-open .tree-mask { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(23, 33, 43, .35); }
  body.tree-open { overflow: hidden; }
  .head-button { display: inline-flex; }
  .content-head { padding: 8px 10px; gap: 6px; }
  .content-head .breadcrumb {
    flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; padding: 0; min-height: 0; scrollbar-width: none;
  }
  .content-head .breadcrumb::-webkit-scrollbar { display: none; }
  .content-head .breadcrumb li { flex: none; }
  .content-panel { min-height: 60vh; }

  .topbar { flex-wrap: wrap; }
}
@media (max-width: 650px) {
  .topbar, .vehicle-bar { padding: 10px 16px; }
  .landing-card h1 { font-size: 26px; }
  .vin-field input { font-size: 16px; padding: 13px 56px 13px 14px; }
  .workspace { padding: 12px 16px 20px; }
  #vin-form { flex-direction: column; }
  #vin-submit { padding: 13px; }
  .subsystem { grid-template-columns: 1fr; }

  .brand div span { display: none; }
  .vehicle-bar { flex-wrap: nowrap; padding: 8px 12px; gap: 10px; }
  .vehicle-summary { flex-wrap: nowrap; gap: 8px; overflow: hidden; min-width: 0; }
  .vehicle-summary .extra, .vehicle-summary dt { display: none; }
  .vehicle-summary dd { white-space: nowrap; font-size: 14px; }
  #change-vehicle { flex: none; }
  .workspace { padding: 10px 10px 20px; gap: 10px; }
  .content { padding: 12px 10px; }
  .section-head h2 { font-size: 16px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .node-card { padding: 12px; min-height: 64px; }
  .subsystem { padding: 12px; }
  .tab-button { padding: 10px 12px 10px 14px; width: 100%; }

  /* 表格改为卡片 */
  .cards-on-mobile { border: 0; overflow: visible; }
  .cards-on-mobile table, .cards-on-mobile tbody, .cards-on-mobile tr, .cards-on-mobile td { display: block; }
  .cards-on-mobile thead { display: none; }
  .cards-on-mobile tr {
    position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel);
  }
  .cards-on-mobile tr.group-start td { border-top: 0; }
  .cards-on-mobile td { border: 0; padding: 2px 0; background: none !important; box-shadow: none !important; text-align: left; white-space: normal; }
  .cards-on-mobile td[data-label]::before { content: attr(data-label) "："; color: var(--muted); font-size: 12px; font-weight: 400; font-family: -apple-system, "PingFang SC", sans-serif; }
  .cards-on-mobile td.m-hide { display: none; }
  .cards-on-mobile td.cell-name { font-size: 15px; font-weight: 600; }
  .cards-on-mobile td.cell-name::before { display: none; }
  .components-table td:first-child { display: none; }
  .components-table td.link-text { font-size: 15px; }
  .components-table td.link-text::before { display: none; }
  /* 配件卡片：图号徽标 + 件号 + 名称 + 数量，右上角详情按钮 */
  .parts-table td.callout-cell { font-size: 0; padding: 0 0 4px; }
  .parts-table td.callout-cell::before { display: none; }
  .parts-table td.callout-cell::after {
    content: "图号 " attr(data-callout-badge); font-size: 12px; font-weight: 700; color: #fff; background: var(--text);
    border-radius: 5px; padding: 1px 7px;
  }
  .parts-table td.link-text::before { display: none; }
  .parts-table td.cell-action { position: absolute; top: 8px; right: 8px; padding: 0; }
  .info-button { width: 34px; height: 34px; font-size: 14px; }
  .parts-table tr.row-hit { border-color: var(--brand); background: var(--link-soft); }
  .parts-table tr.row-hit td.callout-cell::after { background: var(--brand); }
  .parts-table tr.row-selected { border-color: var(--part); background: var(--part-soft); }

  /* 爆炸图 */
  .viewer-stage { height: 52vh; }
  .viewer-tools { flex-wrap: wrap; }
  .viewer-tools .hint { display: none; }
  .viewer-tools .icon-button { width: 38px; height: 38px; }
  .kv { grid-template-columns: 92px 1fr; }
  .drawer-head { padding: 14px 16px; }
  .drawer-body { padding: 14px 16px; }
  .content { padding: 12px; }
}

/* 配件附件预览 */
.attachment-list { display: grid; gap: 16px; }
.attachment-card { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.attachment-image { display: block; width: 100%; max-height: 460px; object-fit: contain; cursor: zoom-in; }
.attachment-card figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; }
.attachment-card figcaption .mono { overflow-wrap: anywhere; flex: 1 1 220px; }
.attachment-error { color: var(--muted); padding: 24px 0; }

/* 运营工作台 */
.operator-hero { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:16px 0 8px; }
.operator-hero h1 { font-size:26px; line-height:1.4; margin:4px 0 10px; }
.operator-hero p { color:var(--muted); margin:0; }
.operator-hero .eyebrow { color:var(--brand); font-size:12px; font-weight:700; letter-spacing:.1em; }
.operator-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.operator-metric { display:grid; gap:10px; }
.operator-metric span,.operator-metric small { color:var(--muted); }
.operator-metric strong { font-size:30px; line-height:1.3; }
.operator-data-types { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin:18px 0; }
.operator-data-types>div { background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:14px; display:grid; gap:12px; }
.operator-data-types strong { font-size:24px; }
.operator-filters { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin:18px 0; }
.operator-filters label { display:grid; gap:7px; font-size:13px; color:var(--muted); }
.operator-filters input { min-width:240px; border:1px solid var(--line); border-radius:7px; padding:10px; background:var(--panel); color:var(--text); }
.operator-pagination { display:flex; justify-content:center; align-items:center; gap:16px; margin-top:20px; }
.operator-empty { padding:32px 16px; color:var(--muted); text-align:center; }
.operator-name { white-space:normal !important; max-width:260px; }
.operator-name small { display:block; margin-top:6px; }
.operator-gallery { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.operator-image-card { margin:0; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.operator-image-card img { width:100%; height:200px; object-fit:contain; display:block; background:#fff; padding:12px; }
.operator-image-card figcaption { display:grid; gap:8px; padding:14px; border-top:1px solid var(--line); font-size:13px; overflow-wrap:anywhere; }
.operator-image-card small { color:var(--muted); }
.operator-detail { width:min(1000px,calc(100vw - 32px)); max-height:88vh; }
.operator-atlas-preview { display:block; max-height:420px; width:100%; object-fit:contain; border:1px solid var(--line); border-radius:8px; margin:12px 0 20px; }
.operator-asset-meta { color:var(--muted); font-size:13px; }
.operator-kv { margin:10px 0; }
.operator-kv dd { min-width:0; overflow-wrap:anywhere; }
.operator-records details { padding:10px; border:1px solid var(--line); border-radius:6px; margin-bottom:8px; }
.operator-records summary { cursor:pointer; font-weight:600; }
.operator-toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--text); color:var(--panel); padding:12px 20px; border-radius:10px; z-index:100; max-width:90vw; }
@media(max-width:800px) { .operator-metrics {grid-template-columns:repeat(2,minmax(0,1fr));} .operator-data-types {grid-template-columns:repeat(2,minmax(0,1fr));} .operator-gallery {grid-template-columns:repeat(2,minmax(0,1fr));} .operator-hero {align-items:start;flex-direction:column;} .operator-hero h1 {font-size:22px;} }
@media(max-width:480px) { .operator-gallery {grid-template-columns:1fr;} .operator-filters label,.operator-filters input {width:100%;min-width:0;} .operator-filters {align-items:stretch;} }
.operator-library {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;}
.library-card {border:1px solid var(--line);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;}
.library-preview,.library-placeholder {width:100%;height:210px;object-fit:contain;background:#fff;padding:14px;border-bottom:1px solid var(--line);}
.library-placeholder {display:grid;place-items:center;background:var(--bg);color:var(--muted);font-size:20px;letter-spacing:.08em;}
.library-card-body {display:grid;gap:10px;padding:18px;flex:1;}
.library-card-body h3,.library-card-body p {margin:0;}.library-card-body .primary {margin-top:8px;}
.library-assets {display:grid;gap:10px;grid-template-columns:repeat(2,minmax(0,1fr));margin:16px 0;}
.library-assets button {text-align:left;display:grid;gap:7px;white-space:normal;}.library-assets span {color:var(--muted);font-size:13px;}
.password-policy {color:var(--muted);font-size:13px;margin:0;padding:6px 0;line-height:1.8;}
.activity-summary {white-space:normal !important;min-width:200px;}
#credential-dialog input {font-family:ui-monospace,monospace;}#credential-dialog .modal-actions {flex-wrap:wrap;}
@media(max-width:850px){.operator-library {grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:520px){.operator-library,.library-assets {grid-template-columns:1fr;}}

.login-title{font-size:24px;margin:24px 0 8px}.login-card>.hint-text{margin-bottom:24px}.login-card a{color:var(--brand)}

/* 两个独立入口使用明显不同的视觉布局。 */
.portal-label{font-size:12px;font-weight:700;letter-spacing:2px}.query-login-layout{display:grid;grid-template-columns:1.1fr 1fr;align-items:center;gap:72px;width:min(1000px,100%)}
body[data-login-portal=query]{background:#f7f8fa}.query-login-intro .portal-label{color:#b72c26}.query-login-intro h1{font-size:48px;line-height:1.3;letter-spacing:-2px;margin:24px 0}.query-login-intro p{color:#6b7280;font-size:16px}.portal-illustration{margin-top:40px;padding:28px;border-top:1px solid #dce0e5;font-size:22px;font-weight:600;color:#39414c}.portal-illustration span{color:#ba3029;padding:0 20px}.query-login-layout .login-card{width:100%;box-sizing:border-box;border-top:5px solid #bd3029;padding:36px}
body[data-login-portal=operator]{background:#101a29;background-image:radial-gradient(ellipse at top,#25374f,transparent 70%);color:#e9eef5}body[data-login-portal=operator] .login-card{width:460px;background:#192638;border:1px solid #344359;box-shadow:0 24px 80px #070e1966;padding:38px}body[data-login-portal=operator] .portal-label{color:#9eafc6;margin-bottom:28px}body[data-login-portal=operator] .brand strong,body[data-login-portal=operator] .login-title{color:#fff}body[data-login-portal=operator] .brand-mark{background:#465e7d}body[data-login-portal=operator] .hint-text,body[data-login-portal=operator] label,body[data-login-portal=operator] .brand span{color:#bac7d9}body[data-login-portal=operator] input{background:#101c2c;color:#fff;border-color:#44546c}body[data-login-portal=operator] .primary{background:#e5ecf5;color:#192638;border-color:#e5ecf5}body[data-login-portal=operator] .login-card a{color:#bdcce1}body[data-login-portal=operator] .login-title{font-size:28px}body[data-login-portal=operator] .hint-text{line-height:1.8}
@media(max-width:760px){.query-login-layout{display:block;max-width:460px}.query-login-intro h1{font-size:30px;margin:14px 0}.query-login-intro{margin-bottom:26px}.portal-illustration{display:none}.query-login-layout .login-card{padding:26px}body[data-login-portal=operator] .login-card{max-width:100%;padding:28px}}

.viewer.viewer-expanded{position:fixed;inset:12px;z-index:1000;display:flex;flex-direction:column;background:white;box-shadow:0 0 0 100vmax #11182799}.viewer-expanded .viewer-stage{height:auto;flex:1;min-height:0}

.catalog-source{display:block;margin:16px 0 0;color:#88909b;font-size:12px;text-align:right}

/* Registered site footer; stays in document flow and does not cover controls. */
.site-footer { padding: 16px; text-align: center; color: var(--muted, #6b7280); font-size: 12px; line-height: 1.6; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.login-body { display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.landing { min-height: calc(100vh - 112px); }
body[data-login-portal=operator] .site-footer { color: #c1cbd8; }
