/* PC 端布局：横向菜单栏 + 内容区（车辆列表位于原菜单栏位置） */
html, body { background: #f2f4f8; }

.pc-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------------- 横向头部菜单 ---------------- */
.pc-header { position: relative; z-index: 100; flex: none; background: #fff; border-bottom: 1px solid var(--line); }
.pc-topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}
.pc-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-brand .mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(140deg, #3b8cff, #1677ff);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pc-brand b { display: block; color: var(--text); font-size: 15px; line-height: 1.3; white-space: nowrap; }
.pc-brand span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.pc-top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.pc-user { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pc-top-btn {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12.5px;
  white-space: nowrap;
}
.pc-top-btn:hover { border-color: var(--primary); color: var(--primary); }
.pc-top-btn.danger { color: #d4380d; border-color: #ffd6cc; }
.pc-top-btn.danger:hover { background: #fff2ee; border-color: #ff9c7a; }
.pc-alarm-btn {
  position: relative;
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475569;
}
.pc-alarm-btn:hover { color: #d4380d; border-color: #ffd6cc; background: #fff7f4; }
.pc-alarm-btn.active { color: #d4380d; background: #fff2ee; border-color: #ff9c7a; }
.pc-alarm-btn svg { width: 18px; height: 18px; }
.pc-alarm-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: #f5222d;
  color: #fff;
  font-size: 9.5px;
  font-style: normal;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

/* ---------------- 顶部账号菜单 ---------------- */
.pc-account { position: relative; flex: none; }
.pc-account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.pc-account-trigger:hover { border-color: var(--primary); }
.pc-avatar {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: #1677ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.pc-avatar.lg { width: 36px; height: 36px; font-size: 15px; }
.pc-account-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.pc-account-meta b {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #1f2937;
}
.pc-account-meta i { font-style: normal; font-size: 10px; color: var(--muted); }
.pc-account-trigger > svg { width: 12px; height: 12px; color: #94a3b8; }
.pc-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 336px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, .18);
  z-index: 1200;
}
.pc-account-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pc-account-head b { display: block; font-size: 13.5px; color: var(--text); }
.pc-account-head span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.pc-account-rows { padding: 4px 0 2px; }
.pc-account-rows .info-row { padding: 6px 0; border-bottom: 1px dashed #eef1f6; }
.pc-account-rows .info-row:last-child { border-bottom: 0; }
.pc-account-rows .info-row span { font-size: 12px; color: var(--muted); }
.pc-account-rows .info-row b {
  font-size: 12px;
  color: #1f2937;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-account-pwd {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.pc-pwd-toggle {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  background: #f2f6ff;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}
.pc-pwd-toggle:hover { background: #e3edff; }
.pc-pwd-cancel {
  width: 100%;
  height: 32px;
  margin-top: 6px;
  border-radius: 8px;
  background: #f4f6fa;
  color: #5b6474;
  font-size: 12px;
}
.pc-pwd-cancel:hover { background: #e9eef6; }
.pc-account-pwd h4 { font-size: 12.5px; color: #334155; margin: 0 0 6px; }
.pc-account-pwd .input-field { margin: 0 0 6px; }
.pc-account-pwd .input-field > span { font-size: 11px; }
.pc-account-pwd .input-field input { height: 34px; font-size: 12.5px; }
.pc-account-pwd .primary-btn { height: 34px; font-size: 12.5px; }
.pc-account-menu .logout-btn {
  width: 100%;
  height: 34px;
  margin-top: 10px;
  border: 1px solid #ffd6cc;
  border-radius: 8px;
  background: #fff;
  color: #d4380d;
  font-size: 12.5px;
}
.pc-account-menu .logout-btn:hover { background: #fff2ee; }

.pc-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 14px;
  height: 46px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.pc-nav::-webkit-scrollbar { height: 0; }
.pc-nav .nav-btn {
  flex: none;
  height: 34px;
  padding: 0 16px;
  border-radius: 8px;
  color: #475569;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.pc-nav .nav-btn:hover { background: #e9eff8; color: #1e293b; }
.pc-nav .nav-btn.active { background: #1677ff; color: #fff; font-weight: 600; }
.pc-nav .nav-section { display: none; }

/* ---------------- 主区域 ---------------- */
.pc-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pc-content { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.pc-content .page { inset: 0; }

/* ---------------- 实时监控 ---------------- */
#pageMap.active { display: flex; }
.pc-monitor { display: flex; width: 100%; height: 100%; }
.pc-monitor-side {
  width: 330px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--line);
}
.pc-monitor-side .list-header { padding: 14px 14px 8px; }
.pc-monitor-side .top-row { display: flex; align-items: center; justify-content: space-between; }
.pc-monitor-side .brand-mark { display: none; }
.pc-monitor-side h1 { font-size: 16px; }
.pc-monitor-side .vehicle-list { padding: 4px 12px 18px; }
.pc-monitor-map { position: relative; flex: 1; min-width: 0; }
.pc-monitor-map .map { position: absolute; inset: 0; }
.pc-monitor-map .map-popup {
  left: auto;
  right: 16px;
  bottom: 72px;
  width: 360px;
  max-height: calc(100% - 110px);
  overflow-y: auto;
}
.pc-monitor-map .map-locate-btn { left: 16px; bottom: 18px; }
.pc-monitor-map .map-focus-btn { right: 16px; bottom: 18px; }
.sys-menu { padding: 4px 6px; }
.sys-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.sys-menu-item:last-child { border-bottom: 0; }
.sys-menu-item:hover { background: #f7f9fc; }
.sys-menu-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sys-menu-main b { font-size: 14px; color: #1f2937; }
.sys-menu-main span { font-size: 12px; color: #8a93a3; }
.sys-menu-arrow { flex: none; margin-left: 12px; font-size: 12px; color: var(--primary); }
.sys-pane-back { margin-bottom: 10px; }
.pc-monitor-map .map-layer { top: 16px; right: 16px; }
.pc-track-map-wrap .map-layer { top: 62px; right: 12px; }

/* ---------------- 轨迹回放 ---------------- */
#pageTrack.active { display: flex; flex-direction: row; }
.pc-track-form-wrap {
  width: 340px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.pc-track-form-wrap .page-top { padding: 0 0 4px; }
.pc-track-form-wrap .page-top h2 { font-size: 18px; }
.pc-track-form-wrap .page-top p { font-size: 12px; }
.pc-track-form-wrap .track-form { margin: 0; }
.pc-track-map-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pc-track-map-wrap .track-map {
  position: relative;
  flex: 1;
  margin: 0;
  border-radius: 0;
}
.pc-track-map-wrap .track-summary {
  position: absolute;
  top: 12px;
  left: 12px;
  right: auto;
  z-index: 500;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.pc-track-map-wrap .playback {
  flex: none;
  margin: 10px 14px 14px;
  padding: 10px 16px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* 轨迹回放车辆图标 */
.track-car-icon { background: none; border: none; }
.track-car {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary, #1677ff);
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.track-car svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

/* ---------------- 管理子页面 ---------------- */
.pc-content .back-btn { display: none; }
.pc-content .subpage-top { padding: 20px 22px 8px; }
.pc-content .subpage-head h2 { font-size: 19px; }
.pc-content .subpage-body { padding: 4px 22px 24px; }
.pc-content .subpage-body .form-card { max-width: 1180px; }
.pc-content .group-search { max-width: 1180px; margin: 0 auto 10px; }
.pc-content .user-list { max-height: none; }
.pc-content .user-row:hover { background: #f7faff; }

/* 车辆/分组/用户/终端型号：标题、搜索框与列表卡片统一同宽居中 */
.pc-content .manage-page .subpage-top {
  width: 100%;
  max-width: 1224px;
  margin: 0 auto;
  padding: 20px 22px 8px;
  box-sizing: border-box;
}
.pc-content .manage-page .subpage-body .form-card,
.pc-content .manage-page .group-search {
  width: 100%;
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}
.pc-content .manage-page .group-search { margin-top: 0; margin-bottom: 10px; }

/* 报警、权限等列表更宽松 */
.pc-content .alarm-list { max-height: none; }
.pc-content .perm-matrix {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font-size: 12.5px;
}
.pc-content .perm-matrix th,
.pc-content .perm-matrix td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.pc-content .perm-matrix th { background: #f7f9fc; color: #475569; font-weight: 600; }
.pc-content .perm-matrix td:not(:first-child) { text-align: center; }

/* 车辆详情：宽屏展示 */
#vehicleDetailCard { max-width: 1180px; }

/* ---------------- 系统管理 ---------------- */
.sys-db-card { padding: 18px 20px; }
.sys-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #f7faff;
  border: 1px solid #e3ecfb;
  border-radius: 10px;
}
.sys-current span { font-size: 12px; color: var(--muted); }
.sys-current b { font-size: 13px; color: #1f2937; font-weight: 600; }
.sys-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 12px; }
.sys-updated { font-size: 12px; color: var(--muted); }
.db-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; margin-left: auto; }
.db-status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.db-status.ok { color: #15803d; }
.db-status.ok::before { background: #22c55e; }
.db-status.bad { color: #b91c1c; }
.db-status.bad::before { background: #ef4444; }
.sys-desc { margin: -8px 0 14px; font-size: 12px; color: var(--muted); }
.sys-db-card + .sys-db-card { margin-top: 16px; }
.sys-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 14px;
}
.sys-form > .input-field { margin-bottom: 10px; }
.sys-form .sys-grid .input-field { margin-bottom: 10px; }
.sys-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.btn-ghost {
  height: 36px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font-size: 13px;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.sys-actions .primary-btn { height: 36px; padding: 0 20px; font-size: 13px; }
.sys-result { font-size: 12px; color: var(--muted); }
.sys-result.ok { color: var(--green); }
.sys-result.bad { color: var(--red); }
.sys-hint {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
@media (max-width: 900px) {
  .sys-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------------- 登录页 ---------------- */
.login-screen {
  background: radial-gradient(circle at 18% 18%, #17386b, #0b1220 62%);
}
.login-card {
  width: 384px;
  max-width: calc(100% - 40px);
  margin: auto;
  padding: 30px 30px 24px;
  border-radius: 18px;
  box-shadow: 0 26px 64px rgba(2, 8, 20, .45);
}
.login-card h1 { font-size: 22px; }
.login-card > p { font-size: 12.5px; margin-bottom: 20px; }
.login-field input { height: 42px; }
.pc-hide { display: none !important; }

/* ---------------- 弹窗与提示 ---------------- */
#inputModal .modal-card {
  top: 50%;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: 480px;
  max-width: calc(100% - 40px);
  max-height: calc(100vh - 80px);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
#detailModal .modal-card {
  top: 50%;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: 620px;
  max-width: calc(100% - 40px);
  max-height: calc(100vh - 80px);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
.toast {
  left: 50%;
  right: auto;
  bottom: 40px;
  transform: translateX(-50%) translateY(12px);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------------- 数据报文 ---------------- */
.msg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: 1180px;
  margin: 0 auto 10px;
}
.msg-toolbar .msg-search { flex: 1; min-width: 240px; margin: 0; }
.msg-selected { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #55627a; }
.msg-selected b { color: #1e2a3d; }
.msg-status { font-size: 12.5px; color: var(--muted); }
.msg-status.on { color: var(--green); font-weight: 600; }
.msg-count { font-size: 12.5px; color: var(--muted); }
.msg-toolbar .btn-ghost,
.msg-selected .btn-ghost { height: 30px; padding: 0 12px; font-size: 12px; }
.head-action.stop { background: #fff1f0; color: #cf1322; }
.msg-results {
  max-width: 1180px;
  margin: 0 auto 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.msg-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.msg-result-item:last-child { border-bottom: 0; }
.msg-result-item:hover { background: #f7faff; }
.msg-result-item b { font-size: 13px; color: #1f2937; }
.msg-result-item span { font-size: 12px; color: var(--muted); }
.msg-result-empty { padding: 14px; text-align: center; font-size: 12px; color: var(--muted); }
.pc-content .msg-card { max-width: 1180px; margin: 0 auto; padding: 6px 16px; }
.msg-list { max-height: calc(100vh - 330px); overflow-y: auto; }
.msg-item { padding: 9px 2px; border-bottom: 1px solid var(--line); }
.msg-item:last-child { border-bottom: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; }
.msg-dir { flex: none; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.msg-dir.up { color: #147a54; background: #e7f8ee; }
.msg-dir.down { color: #1b5fc1; background: #eef4ff; }
.msg-name { font-size: 12.5px; font-weight: 600; color: #334155; }
.msg-plate { margin-left: auto; font-size: 12px; color: #7b869a; }
.msg-time { font-size: 11.5px; color: var(--muted); }
.msg-hex {
  display: block;
  margin-top: 3px;
  font-family: Consolas, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: #55627a;
  word-break: break-all;
}

/* ---------------- 透传弹窗 ---------------- */
#passModal .modal-card {
  top: 50%;
  bottom: auto;
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
  width: 460px;
  max-width: calc(100% - 40px);
  max-height: calc(100vh - 80px);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
#passModal #passText { min-height: 88px; }
.pass-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.pass-tab {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  background: #f2f5fa;
  color: #5b6474;
  font-size: 12.5px;
  font-weight: 600;
}
.pass-tab.active { background: var(--primary); color: #fff; }
.pass-records { max-height: 300px; overflow-y: auto; }
.pass-rec { padding: 8px 2px; border-bottom: 1px solid var(--line); }
.pass-rec:last-child { border-bottom: 0; }
.pass-rec-head { display: flex; align-items: center; gap: 8px; }
.pass-rec-type { flex: 1; font-size: 12px; color: #334155; font-weight: 600; }
.pass-rec-body { margin-top: 2px; font-size: 12px; color: #55627a; word-break: break-all; }
.pass-rec-hex {
  font-family: Consolas, Menlo, monospace;
  font-size: 11px;
  color: #8a93a3;
  word-break: break-all;
}

/* ---------------- 窄屏适配 ---------------- */
@media (max-width: 1180px) {
  .pc-monitor-side { width: 290px; }
  .pc-track-form-wrap { width: 300px; }
  .pc-user { display: none; }
  .pc-brand b { font-size: 14px; }
  .pc-nav .nav-btn { padding: 0 12px; font-size: 12.5px; }
}
@media (max-width: 900px) {
  .pc-topbar { padding: 0 12px; }
  .pc-monitor-side { width: 240px; }
  .pc-track-form-wrap { width: 250px; }
  .pc-nav { padding: 0 8px; }
  .pc-content .subpage-top { padding: 16px 16px 6px; }
  .pc-content .subpage-body { padding: 4px 16px 18px; }
  .pc-content .manage-page .subpage-top { max-width: 1212px; padding: 16px 16px 6px; }
}
