/* ==========================================================================
   迪粉社区 · Design System v2
   分层：Tokens → Base → 工具类 → 布局 → 组件 → 页面 → 后台 → 响应式 → 过渡补丁
   约束：保留全部既有 class 名与视觉，仅改进组织与 Token 统一
   ========================================================================== */

/* ==========================================================================
   1. Design Tokens（单一数据源）
   ========================================================================== */
:root {
  /* 品牌色（比亚迪科技蓝） */
  --brand-50: #eef2ff;
  --brand-100: #dbe4ff;
  --brand-400: #5b7ff0;
  --brand-500: #3b5bdb;
  --brand-600: #2f4ab8;
  --brand-700: #24388c;
  --brand-800: #4a6cf0;

  /* 中性灰阶 */
  --gray-50: #f5f7fc;
  --gray-100: #eef1f9;
  --gray-200: #e5eaf4;
  --gray-300: #d7deee;
  --gray-400: #98a3b8;
  --gray-500: #66738f;
  --gray-600: #5e6a7c;
  --gray-700: #3a4254;
  --gray-900: #1b2438;

  /* 语义色 */
  --success: #1f9d55;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #3b5bdb;

  /* 品牌副色（紫） */
  --accent-2: #7048e8;

  /* —— 兼容旧变量名（JS 内联样式 / 既有引用） —— */
  --acc: var(--brand-500);
  --acc-h: var(--brand-400);
  --acc-2: var(--accent-2);
  --text: var(--gray-900);
  --dim: var(--gray-500);
  --faint: var(--gray-400);
  --bg: var(--gray-50);
  --panel: #ffffff;
  --panel-2: #fafbfe;
  --panel-3: var(--gray-100);
  --line: var(--gray-200);
  --line-2: var(--gray-300);
  --ok: var(--success);
  --warn: var(--warning);
  --err: var(--danger);

  /* —— 补充 JS 内联样式引用但原缺失的变量 —— */
  --accent: var(--brand-500);
  --text-dim: var(--gray-500);
  --border: var(--gray-200);

  /* 渐变 / 阴影 */
  --grad: linear-gradient(135deg, #3b5bdb, #4a6cf0);
  --grad-deep: linear-gradient(135deg, #2f4ab8, #3b5bdb);
  --shadow: 0 1px 2px rgba(20, 30, 60, .04);
  --shadow-md: 0 6px 20px rgba(20, 30, 60, .08);
  --shadow-lg: 0 20px 50px rgba(20, 30, 60, .25);

  /* 圆角 */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* 间距（8px 栅格） */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
}

/* ==========================================================================
   2. Base / Reset
   ========================================================================== */
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.mono { font-family: Consolas, "Courier New", monospace; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   3. 工具类
   ========================================================================== */
.hidden { display: none !important; }

/* 统一图标（配合 icons.js） */
.icon { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }

/* ==========================================================================
   4. 布局：公告条 / 顶栏 / 主区 / 页脚
   ========================================================================== */
/* 公告条 */
#noticeBar {
  position: sticky; top: 0; left: 0; right: 0; z-index: 60;
  padding: 8px 16px; background: var(--grad-deep); color: #fff;
  box-shadow: 0 2px 8px rgba(47, 74, 184, .3);
}
#noticeBar.hidden { display: none; }
.notice-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 13px; line-height: 1.5; flex-wrap: wrap;
}
.notice-tag {
  background: rgba(255,255,255,.2); border-radius: 6px; padding: 2px 10px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.notice-inner .btn {
  margin-left: auto; background: rgba(255,255,255,.94);
  color: var(--acc); font-weight: 700; border-color: transparent;
}

/* 顶栏（细线白条） */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 18px;
  display: flex; align-items: center; gap: 18px; height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  box-shadow: 0 3px 8px rgba(59, 91, 219, .3);
}
.topnav { display: flex; gap: 2px; align-items: center; }
.topnav a {
  padding: 7px 16px; border-radius: var(--radius); font-size: 14px; color: var(--dim);
  transition: all .15s;
}
.topnav a.active, .topnav a:hover { background: var(--brand-50); color: var(--acc); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync-status { font-size: 12px; color: var(--dim); white-space: nowrap; }
.icon-btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--dim);
  border-radius: var(--radius); padding: 7px 12px; font-size: 14px;
  transition: all .15s;
}
.icon-btn:hover { border-color: var(--acc); color: var(--acc); }
.dropdown {
  position: absolute; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 8px; min-width: 150px;
}
.lang-wrap { position: relative; }
.dropdown button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border: 0; background: transparent; border-radius: var(--radius); font-size: 13px; color: var(--text);
}
.dropdown button:hover { background: var(--brand-50); color: var(--acc); }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 5px;
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.user-chip:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--grad); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* 主区 / 页脚 */
#app { max-width: 1180px; margin: 0 auto; padding: 22px 16px 20px; flex: 1; width: 100%; }
footer {
  text-align: center; color: var(--dim); font-size: 12px; padding: 22px; margin-top: auto;
  border-top: 1px solid var(--line); background: var(--panel);
}

/* ==========================================================================
   5. 组件
   ========================================================================== */

/* —— 按钮 —— */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: var(--radius); padding: 7px 16px; font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.btn:hover { border-color: var(--line-2); filter: brightness(.99); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(59, 91, 219, .28); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(220, 38, 38, .25); }
.btn.sm { padding: 5px 13px; font-size: 12px; }

/* —— 表单 —— */
.form-card {
  max-width: 460px; margin: 34px auto; padding: 28px;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); background: var(--panel);
}
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; font-weight: 600; }
.form-row input, .form-row select {
  width: 100%; padding: 10px 13px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px; outline: none;
  box-shadow: var(--shadow);
}
.form-row input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(59, 91, 219, .12); }
.form-input {
  width: 100%; padding: 10px 13px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px; outline: none;
}
.form-err { color: var(--err); font-size: 13px; margin: 8px 0; }
.form-ok { color: var(--ok); font-size: 13px; margin: 8px 0; }

/* —— 卡片 —— */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden;
}

/* —— 响应式栅格（替代视图里的 inline display:grid）——
   桌面按各自列宽；窄屏在 §9 统一塌成单列。 */
.admin-grid { display: grid; gap: 10px; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.admin-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.admin-grid-wide { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.admin-grid-narrow { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
.admin-grid.items-stretch { align-items: stretch; }
/* 表单型栅格：桌面保留最小宽度，窄屏取消（见 §9） */
.admin-grid.min-420 { min-width: 420px; }
.admin-grid.gap-12 { gap: 12px; }
.admin-grid.gap-14 { gap: 14px; }

/* 栅格内的间距 / 字号修饰 */
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.fs-13 { font-size: 13px; }

/* —— 状态标签 —— */
.badge {
  display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 999px;
  background: var(--brand-50); color: var(--acc); margin-left: 8px; vertical-align: 1px;
  border: 1px solid rgba(59, 91, 219, .2);
}
/* 警告态徽标（替代原先 style.cssText 内联写法） */
.badge.warn {
  background: rgba(217, 119, 6, .12); color: #d97706; border-color: rgba(217, 119, 6, .25);
  margin-bottom: 10px; display: inline-block; margin-left: 0;
}
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 10px; border-radius: 999px; margin-top: 8px; font-weight: 600; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; flex: 0 0 5px; }
.tag.ok { background: rgba(31, 157, 85, .1); color: #1f9d55; }
.tag.ok::before { background: var(--ok); }
.tag.wait { background: rgba(217, 119, 6, .1); color: #b45309; }
.tag.wait::before { background: var(--warn); }
.tag.err { background: rgba(220, 38, 38, .1); color: #b91c1c; }
.tag.err::before { background: var(--err); }
.tag.vip { background: rgba(112, 72, 232, .1); color: #7048e8; }
.tag.vip::before { background: var(--acc-2); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--dim); font-weight: 600;
}

/* —— 开关 —— */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.switch input { display: none; }
.switch span {
  width: 40px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative;
  transition: background .2s; box-shadow: inset 0 1px 3px rgba(20,30,60,.12);
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 5px rgba(20,30,60,.25);
}
.switch input:checked + span { background: var(--grad); }
.switch input:checked + span::after { left: 21px; }

/* —— 弹窗 —— */
.modal-mask {
  position: fixed; inset: 0; background: rgba(40, 55, 100, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px 26px;
  width: 420px; max-width: 92vw; max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin: 0 0 16px; font-size: 18px; font-weight: 700; }
.modal-close { float: right; border: 0; background: transparent; font-size: 20px; color: var(--dim); }
/* 弹窗尺寸变体（替代 .modal 上的内联 width） */
.modal.narrow { width: 360px; }
/* 弹窗底部按钮行：右对齐；移动端在 §9 统一转纵向满宽 */
.modal-row { display: flex; gap: 10px; justify-content: flex-end; }
.modal-row.mt { margin-top: 8px; }
.modal-row.mt-lg { margin-top: 12px; }
/* 弹窗内的说明文字 */
.modal-desc { color: var(--dim); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }

/* —— 弹层 / 下拉（OTA 车系/车型选择） —— */
.oq-layer {
  position: absolute; z-index: 60; margin-top: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 10px; min-width: 220px; max-width: 340px;
}
.oq-layer-title { font-size: 13px; font-weight: 700; color: var(--dim); padding: 4px 8px 8px; }
.oq-search { width: 100%; box-sizing: border-box; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--line); font-size: 13px; margin-bottom: 6px; outline: none; }
.oq-list { max-height: 280px; overflow: auto; }
.oq-group { font-size: 12px; font-weight: 700; color: var(--dim); padding: 8px 8px 4px; }
.oq-opt { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius); border: 0; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; }
.oq-opt:hover { background: var(--brand-50); }
.oq-empty { padding: 12px 8px; color: var(--dim); font-size: 13px; }

/* —— 空状态 / 加载 / 排序 —— */
.empty-state { text-align: center; padding: 60px 20px; color: var(--dim); font-size: 14px; }
/* 空态结构类：替代原先写在视图里的内联样式（首页/目录页共用未登录空态） */
.empty-state.lg { padding: 70px 20px; }
.empty-title { margin: 0 0 8px; }
.empty-desc { margin-bottom: 18px; }
.empty-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
/* 面包屑返回链接 */
.crumb-back { display: inline-flex; align-items: center; gap: 4px; }
/* 列表加载提示 */
.loading-line { padding: 14px; }
.sort-btn { border: 0; background: transparent; font-size: 12.5px; color: var(--dim); text-align: left; cursor: pointer; padding: 0; }
.sort-btn .arrow, .sort-arrow { color: var(--acc); }
.sort-btn.on { color: var(--acc); }

/* —— 杂项 —— */
.fail { color: var(--err); }
.rm { color: var(--err); cursor: pointer; }
.cp { cursor: pointer; }
.dl { cursor: pointer; color: var(--acc); }
.scroll-sentinel { height: 1px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 640px; }

/* —— P1 组件增强 —— */
/* 可访问性：统一键盘焦点轮廓 */
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* 按钮变体：幽灵 / 禁用 / 加载态 */
.btn.ghost { background: transparent; border-color: transparent; color: var(--acc); }
.btn.ghost:hover { background: var(--brand-50); border-color: transparent; box-shadow: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.btn.loading { pointer-events: none; opacity: .72; }
.btn .spinner { margin-right: 2px; }

/* spinner（加载动画） */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,.15); border-top-color: currentColor;
  border-radius: 50%; animation: spin .6s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 表单错误态 */
.form-row.has-error input, .form-row.has-error select, .form-row.has-error textarea,
.form-input.invalid { border-color: var(--err); }
.form-row.has-error input:focus, .form-input.invalid:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

/* 卡片悬停 */
.card-hover { transition: transform .15s, box-shadow .15s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* 空状态图标容器 */
.empty-state .empty-icon { font-size: 34px; margin-bottom: 12px; line-height: 1; }

/* 文件/文件夹行内图标 */
.row-icon { display: inline-flex; align-items: center; justify-content: center; margin-right: 8px; flex-shrink: 0; vertical-align: -3px; }
.row-icon .icon { width: 18px; height: 18px; }
.row-icon.folder { color: #e8a33d; }
.row-icon.file { color: var(--gray-400); }
.row-icon.muted { color: var(--gray-400); }

/* Toast 组件 */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 9px 18px; border-radius: 10px;
  font-size: 13.5px; color: #fff; background: #222;
  box-shadow: 0 6px 18px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
  max-width: 90vw; word-break: break-all;
  animation: toastIn .2s ease;
}
.toast .icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: #222; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* 弹窗动画 */
.modal-mask { animation: fadeIn .18s ease; }
.modal { animation: slideUp .22s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   6. 页面：首页 / 文件列表 / 搜索 / OTA / 个人中心
   ========================================================================== */

/* —— 首页 hero —— */
.hero3d {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #3b5bdb, #4a6cf0 48%, #7048e8);
  box-shadow: 0 10px 26px rgba(59, 91, 219, .28);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 26px 34px; margin-bottom: 20px; min-height: 150px;
}
.hero3d::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(255,255,255,.22) 0, transparent 26%),
    radial-gradient(circle at 82% 80%, rgba(255,255,255,.14) 0, transparent 30%);
  pointer-events: none;
}
.hero3d-text { position: relative; z-index: 1; color: #fff; max-width: 520px; }
.hero3d-text h1 { margin: 0 0 8px; font-size: 24px; font-weight: 800; }
.hero3d-text p { margin: 0; font-size: 13.5px; opacity: .92; line-height: 1.6; }
.hero3d-text .hero-chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hero3d-text .hero-chips span {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 12.5px; padding: 5px 14px; border-radius: 6px;
}
.hero3d-text .hero-chips .icon { width: 14px; height: 14px; }
.hero3d-img { position: relative; z-index: 1; width: 46%; max-width: 560px; border-radius: 10px; box-shadow: 0 10px 24px rgba(20, 30, 60, .25); }

/* —— 品牌分区 —— */
.brand-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.brand-pill {
  padding: 8px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); font-size: 14px; color: var(--dim);
  box-shadow: var(--shadow); transition: all .15s;
}
.brand-pill:hover { border-color: var(--line-2); transform: translateY(-1px); }
.brand-pill.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(59, 91, 219, .3); }
.series-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.series-chip {
  padding: 5px 14px; border-radius: 6px; font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
}
.series-chip.active { border-color: var(--acc); color: var(--acc); background: var(--brand-50); }
.stats-line { font-size: 13px; color: var(--dim); margin: 6px 0 14px; }
.stats-line b { color: var(--text); }

/* —— 文件列表 —— */
.folder-head {
  display: grid; grid-template-columns: 1fr 130px 110px 90px;
  gap: 10px; padding: 13px 20px; font-size: 12.5px; color: var(--dim);
  background: var(--panel-3);
}
.folder-row {
  display: grid; grid-template-columns: 1fr 130px 110px 90px;
  gap: 10px; padding: 13px 20px; font-size: 13.5px; border-top: 1px solid var(--line);
  align-items: center; transition: background .15s;
}
.folder-row:hover { background: var(--panel-2); }
.folder-row .name { font-weight: 600; word-break: break-all; }
.folder-row .name a:hover { color: var(--acc); }
.folder-row .name small { display: block; color: var(--dim); font-weight: 400; font-size: 12px; margin-top: 2px; }
.folder-row .sub { color: var(--dim); font-size: 12.5px; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.load-more { text-align: center; padding: 16px; }

/* —— 搜索 —— */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-input-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.search-input-wrap .icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--gray-400); pointer-events: none; }
.search-input-wrap .search-input { padding-left: 36px; }
.search-input {
  flex: 1; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); font-size: 14px; color: var(--text);
  box-shadow: var(--shadow); outline: none;
}
.search-input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(59, 91, 219, .12); }
/* 后台筛选栏的定宽输入框：桌面按内容宽度，窄屏由 §9 统一撑满 */
.search-input.w-xs { flex: 0 0 110px; width: 110px; }
.search-input.w-sm { flex: 0 0 130px; width: 130px; }
.search-input.w-md { flex: 0 0 150px; width: 150px; }
.search-input.w-lg { flex: 0 0 180px; width: 180px; }
.search-input.w-xl { flex: 0 0 200px; width: 200px; }
.search-input.w-240 { flex: 0 0 240px; width: 240px; }
.form-input.full { width: 100%; flex: 0 0 100%; }
.form-input.w-230 { flex: 0 0 230px; width: 230px; }
.form-input.grow { flex: 1 1 auto; min-width: 200px; }
.search-group-title {
  padding: 12px 14px 6px; font-size: 13px; font-weight: 600; color: var(--dim);
  display: flex; align-items: center; gap: 8px;
}
.search-group-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* —— 个人中心 —— */
.avatar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.avatar-opt { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 20px; cursor: pointer; }
.avatar-opt.active { border-color: var(--acc); background: var(--brand-50); }
.car-add-row { border: 1px dashed var(--line-2); border-radius: var(--radius-lg); padding: 12px; margin-top: 10px; background: var(--panel-2); }
.car-add-row select, .car-add-row input { width: 100%; }
.car-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 9px;
  font-size: 13.5px; background: var(--panel);
}
.profile-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.side-nav { padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); height: fit-content; }
.side-nav button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 10px 16px; border: 0;
  background: transparent; border-radius: var(--radius); font-size: 14px; color: var(--dim);
  font-weight: 600; transition: all .15s;
}
.side-nav button .icon { width: 16px; height: 16px; flex-shrink: 0; }
.side-nav button:hover { background: var(--brand-50); color: var(--acc); }
.side-nav button.active { background: var(--grad); color: #fff; }
.section { padding: 22px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.section h3 { margin: 0 0 16px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 14px; margin-bottom: 14px; }
.kv dt { color: var(--dim); }

/* —— OTA —— */
.vin-hint { margin-top: 8px; font-size: 13px; color: var(--warn); }
.ota-sel-row { margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.ota-brand-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ota-brand {
  border-radius: var(--radius); padding: 8px 18px; font-size: 14px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  cursor: pointer; box-shadow: var(--shadow); transition: all .15s;
}
.ota-brand:hover { transform: translateY(-1px); }
.ota-brand.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(59, 91, 219, .3); }
.oq-pick { min-width: 130px; }
.ota-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.ota-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); transition: all .15s; }
.ota-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ota-card .car-title { font-weight: 700; font-size: 14.5px; margin-bottom: 6px; }
.ota-card .vin { color: var(--dim); font-size: 12.5px; }
.ota-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ota-form select, .ota-form input {
  padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px; box-shadow: var(--shadow); outline: none;
}

/* —— 分段选择器 / tabs —— */
.tabs { display: flex; gap: 2px; margin-bottom: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; width: fit-content; }
.tabs button {
  border: 0; background: transparent; padding: 8px 18px; font-size: 14px; color: var(--dim);
  border-radius: 6px; font-weight: 600; transition: all .15s;
}
.tabs button.active { background: var(--panel); color: var(--acc); box-shadow: 0 1px 3px rgba(20, 30, 60, .08); }

/* ==========================================================================
   7. 后台管理
   ========================================================================== */
/* 后台模式：前后台分离 */
body.admin-mode { background: #f3f5fa; }
body.admin-mode #app { padding: 0; max-width: none; }
body.admin-mode footer { display: block !important; margin-top: auto; }

/* 后台 v2 布局（主用） */
body.admin-mode { --bg:#f5f7fc; --panel:#fff; --panel-2:#fafbfe; --line:#e5eaf4; --text:#1b2438; --dim:#66738f; --faint:#98a3b8; --acc:#3b5bdb; background:#f5f7fc !important; }
body.admin-mode #app { padding: 0 !important; max-width: none !important; }
.admin-v2-layout { display: flex; min-height: 100vh; }
.admin-v2-side {
  width: 248px; flex: 0 0 248px; background: #fff; border-right: 1px solid #e5eaf4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.admin-v2-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 14px; border-bottom: 1px solid #e5eaf4; }
.admin-v2-brand-logo {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg,#3b5bdb,#7048e8);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.admin-v2-brand-name { font-size: 15.5px; font-weight: 700; color: #1b2438; }
.admin-v2-brand-sub { font-size: 10.5px; color: #98a3b8; margin-top: 1px; }
.admin-v2-nav { padding: 6px 18px 16px; flex: 1; overflow-y: auto; }
.admin-v2-nav-group { font-size: 11.5px; color: #98a3b8; letter-spacing: 1.2px; margin: 8px 8px 6px; font-weight: 600; }
.admin-v2-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 12px; margin: 1.5px 0;
  border-radius: 8px; color: #66738f; cursor: pointer; font-size: 14px; transition: .15s;
}
.admin-v2-nav-item:hover { background: #fafbfe; color: #1b2438; }
.admin-v2-nav-item.active { background: #eef2ff; color: #3b5bdb; font-weight: 600; }
.admin-v2-nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .9; }
.admin-v2-side-foot { margin: 14px 12px 16px; padding: 10px 12px; background: #fafbfe; border: 1px solid #e5eaf4; border-radius: 10px; display: flex; align-items: center; gap: 10px; }
.admin-v2-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#3b5bdb,#7048e8); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.admin-v2-foot-name { font-size: 12.5px; font-weight: 600; color: #1b2438; }
.admin-v2-foot-role { font-size: 10.5px; color: #98a3b8; }
.admin-v2-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #f5f7fc; min-height: 0; }
.admin-v2-top {
  height: 62px; flex: 0 0 62px; display: flex; align-items: center; gap: 16px; padding: 0 26px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid #e5eaf4; position: sticky; top: 0; z-index: 20;
}
.admin-v2-crumb { font-size: 13px; color: #66738f; }
.admin-v2-crumb b { color: #1b2438; font-weight: 600; }
.admin-v2-content { padding: 24px 26px; width: 100%; flex: 1; }
.admin-v2-nav::-webkit-scrollbar { width: 0; height: 0; }
.admin-v2-nav { scrollbar-width: none; -ms-overflow-style: none; }
body.admin-mode footer { margin-top: 0 !important; }
body.admin-mode #noticeBar { margin-top: 0 !important; }

/* 后台 v2 内容组件 */
.admin-v2-content .card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.admin-v2-content .card-title b { font-size: 14px; font-weight: 600; color: #1b2438; }
.admin-v2-content .card-title .meta { font-size: 11.5px; color: #98a3b8; }
.admin-v2-content .switch {
  width: 40px; height: 22px; border-radius: 999px; background: #d7deee; position: relative;
  cursor: pointer; transition: background .2s; flex: 0 0 auto;
}
.admin-v2-content .switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.admin-v2-content .switch.on { background: #3b5bdb; }
.admin-v2-content .switch.on::after { left: 20px; }
.admin-v2-content .page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.admin-v2-content .page-title { font-size: 20px; font-weight: 700; color: #1b2438; }
.admin-v2-content .page-desc { font-size: 12.5px; color: #98a3b8; margin-top: 4px; }
.admin-v2-content .seg { display: inline-flex; background: #eef1f8; border-radius: 8px; padding: 2px; }
.admin-v2-content .seg span { padding: 3px 10px; font-size: 11.5px; color: #5e6a7c; border-radius: 6px; cursor: pointer; }
.admin-v2-content .seg span.on { background: #fff; color: #3b5bdb; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* 后台 tab 与表格 */
.admin-tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; width: fit-content; }
.admin-tabs button {
  padding: 7px 16px; border-radius: 6px; border: 0;
  background: transparent; color: var(--dim); font-size: 13.5px; font-weight: 600;
  transition: all .15s;
}
.admin-tabs button.active { background: var(--panel); color: var(--acc); box-shadow: 0 1px 3px rgba(20, 30, 60, .08); }
.admin-table, .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td, .data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th, .data-table th { color: var(--faint); font-weight: 600; font-size: 11.5px; letter-spacing: .4px; background: var(--panel-3); }
.admin-table tr:hover td, .data-table tr:hover td { background: var(--panel-2); }
.admin-table .btn.sm { white-space: nowrap; }

/* 业务页补充类 */
.cat-crumb { font-size: 12.5px; color: var(--dim); margin-bottom: 10px; }
.cat-crumb a:hover { color: var(--acc); }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 7px; background: var(--panel); font-size: 13px; cursor: pointer; }
.cat-row:hover { border-color: var(--line-2); background: var(--panel-2); }
.cat-row .name { font-weight: 600; flex: 1; }
.md-crumb { font-size: 12.5px; color: var(--dim); margin-bottom: 10px; }
.md-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 7px; background: var(--panel); font-size: 13px; }
.md-row:hover { background: var(--panel-2); }
.nt-cand { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--panel); }
.nt-cand:hover { border-color: var(--line-2); }
.perm-chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.perm-chk input { accent-color: var(--acc); }
.same { font-size: 12.5px; color: var(--dim); }

/* ==========================================================================
   8. 响应式
   ========================================================================== */
@media (max-width: 1180px) {
  .admin-v2-side { width: 200px; flex: 0 0 200px; }
  .admin-v2-content { padding: 18px 20px 40px; }
  .admin-v2-top { padding: 0 20px; gap: 12px; }
}

@media (max-width: 1024px) {
  #app { padding: 16px 12px 40px; }
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .topnav a { padding: 7px 10px; font-size: 13px; }
  #topSearch { width: 120px !important; }
  .ota-grid { grid-template-columns: 1fr; }
  .hero3d { padding: 20px; }
  .notice-inner { font-size: 12px; }
  .brand-pill { padding: 6px 14px; font-size: 13px; }
}

@media (max-width: 900px) {
  .admin-v2-side { width: 64px; flex: 0 0 64px; }
  .admin-v2-brand-name, .admin-v2-brand-sub, .admin-v2-nav-item span, .admin-v2-nav-group, .admin-v2-foot-name, .admin-v2-foot-role { display: none !important; }
  .admin-v2-nav-item { justify-content: center; padding: 10px 0; }
  .admin-v2-side-foot { justify-content: center; padding: 10px 0; }
  .admin-v2-top { padding: 0 16px; }
  .admin-v2-content { padding: 16px 14px 32px; }
  .admin-v2-content .grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 780px) {
  .hero3d { flex-direction: column; padding: 22px; }
  .hero3d-img { width: 100%; }
}

@media (max-width: 768px) {
  body { font-size: 13px; }
  #app { padding: 12px 10px 32px; }
  .card { border-radius: 10px; }
  .section { padding: 16px 14px; }
  .modal { padding: 18px 16px; border-radius: 12px; }
  .form-card { margin: 16px auto; padding: 20px 16px; }

  .topbar-inner { height: auto; flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  .brand { font-size: 14px; flex: 0 0 auto; }
  .brand span { display: inline !important; }
  .topnav { order: 3; width: 100%; justify-content: space-around; }
  .topnav a { flex: 1; text-align: center; padding: 6px 4px; font-size: 13px; }
  .topbar-right { order: 2; flex: 1; min-width: 0; justify-content: flex-end; gap: 6px; }
  .sync-status { display: none; }
  #topSearch { flex: 1; min-width: 0; }
  .user-chip span { display: none; }
  .user-chip { padding: 4px; }

  .hero3d { padding: 18px 16px; min-height: auto; }
  .hero3d-text h1 { font-size: 20px; }
  .hero3d-text p { font-size: 12.5px; }
  .hero3d-text .hero-chips span { font-size: 11.5px; padding: 4px 10px; }

  .folder-head, .folder-row { padding: 10px 12px; gap: 6px; }
  .folder-row .name { font-size: 13px; }

  .kv { grid-template-columns: 80px 1fr; font-size: 13px; }
  .side-nav { display: flex; overflow-x: auto; gap: 2px; padding: 6px; }
  .side-nav button { white-space: nowrap; flex: 0 0 auto; }
  .profile-grid { grid-template-columns: 1fr; }

  .admin-tabs { width: 100%; overflow-x: auto; }
  .admin-tabs button { white-space: nowrap; }
  .card:has(table) { overflow-x: auto; }
  .admin-table, .data-table { font-size: 12.5px; min-width: 600px; }
  .admin-table th, .admin-table td, .data-table th, .data-table td { padding: 8px; }

  .ota-form { flex-direction: column; align-items: stretch; }
  .ota-form select, .ota-form input { width: 100%; }
  .ota-card { padding: 14px; }
  .oq-layer { position: fixed; left: 10px; right: 10px; min-width: 0; max-width: none; }
  .modal .btn { width: 100%; justify-content: center; }
  .search-bar { flex-direction: column; }
  .search-input { font-size: 13px; }

  .device-item, .car-item { flex-wrap: wrap; }
  .stat-row, .admin-cards > div { min-width: 0; }

  /* —— P4 触控目标 ≥44px（移动端核心可点元素） —— */
  .topnav a { min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .icon-btn { min-height: 42px; min-width: 42px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
  .side-nav button { min-height: 44px; }
  .modal-close { width: 40px; height: 40px; }
  .user-chip { min-height: 40px; }
  .sort-btn { min-height: 40px; }
  .brand-pill, .ota-brand, .series-chip, .pill { min-height: 40px; display: inline-flex; align-items: center; }
  .admin-v2-nav-item { min-height: 44px; }
}

@media (max-width: 720px) {
  .folder-head, .folder-row { grid-template-columns: 1fr 90px; }
  .folder-head .col-time, .folder-head .col-size, .folder-row .col-time, .folder-row .col-size { display: none; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .topbar-right { width: 100%; justify-content: flex-end; }
}

@media (max-width: 640px) {
  .admin-v2-side { display: none; }
  .admin-v2-top { height: 54px; flex-basis: 54px; }
  .admin-v2-content { padding: 12px 10px 24px; }
  .admin-v2-crumb { font-size: 12px; }
}

@media (max-width: 480px) {
  #topbar .user-pill .uname { display: none; }
  .hero-btns { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  .brand-pill { padding: 6px 12px; font-size: 13px; }
  .btn { padding: 6px 12px; font-size: 12.5px; }
  .folder-row .row-actions .btn { padding: 4px 10px; font-size: 11.5px; min-height: 36px; }
  /* 保持触控可用：密集表格按钮至少 36px */
  .folder-row .row-actions { gap: 6px; }
}

/* ==========================================================================
   9. 移动端响应式收敛（由原「内联样式兜底 hack」改为真实语义规则）
   原实现用 div[style*="display:flex"] / input[style*="width:"] 等选择器
   去猜测内联样式，脆弱且带 !important。现已把对应结构改为语义 class，
   这里改为针对真实 class 的响应式规则，行为与原兜底一致。
   ========================================================================== */
@media (max-width: 768px) {
  /* 基础防溢出（保留，不依赖内联样式判定） */
  input, select, textarea { max-width: 100%; box-sizing: border-box; }
  button { max-width: 100%; }

  /* 表单/筛选栏的定宽输入框：窄屏撑满 */
  .search-input.w-xs, .search-input.w-sm, .search-input.w-md,
  .search-input.w-lg, .search-input.w-xl, .search-input.w-240,
  .form-input.full, .form-input.w-230 { flex: 1 1 100%; width: 100%; }

  /* 后台栅格布局：窄屏塌成单列（替换 grid 内联样式判定） */
  .admin-grid, .admin-grid-2, .admin-grid-3, .admin-grid-4,
  .admin-grid-wide, .admin-grid-narrow { grid-template-columns: 1fr; }
  /* 表单型栅格：窄屏取消最小宽度，避免横向溢出 */
  .admin-grid.min-420 { min-width: 0; }
  /* 弹性行：窄屏允许换行（替换 display:flex 内联样式判定） */
  .hstack { flex-wrap: wrap; }

  /* 弹窗内按钮行：窄屏转纵向满宽（替换 justify-content 内联样式判定） */
  .modal .row-actions, .modal .modal-row { flex-direction: column; }
  .modal .row-actions .btn, .modal .modal-row .btn { width: 100%; justify-content: center; }
}
