/* ============================================================
   公安蓝主题（警察蓝 · 全局覆盖 Bootstrap 5）
   ------------------------------------------------------------
   色板：藏蓝 #0f2c57（顶栏/侧栏）、公安蓝 #1a56a8（按钮/链接/选中）、
         警徽金 #d4af37（点缀：品牌标、选中指示条）
         成功 #00b42a / 警示 #ff7d00 / 危险 #f53f3f
         文字 #1d2129 · #4e5969 · #86909c；底 #f2f5fa；描边 #e2e7f0
   尺度：字号 12/14/16/20；控件高 36（默认）/ 28（小）；圆角 6/8/12
   约束：类名沿用旧主题（sb-* / dash-* / app-*），模板不用跟着改
   ============================================================ */
:root {
  --primary: #1a56a8;               /* 公安蓝 */
  --primary-hover: #2a6ec9;
  --primary-press: #123f80;
  --primary-light: #e8f0fb;
  --navy-1: #0f2c57;                 /* 藏蓝（侧栏/顶栏） */
  --navy-2: #0a2045;                 /* 藏蓝（深） */
  --gold: #d4af37;                   /* 警徽金（点缀） */
  --gold-deep: #b8892b;
  --success: #00b42a;
  --success-light: #e8ffea;
  --warning: #ff7d00;
  --warning-light: #fff7e8;
  --danger: #f53f3f;
  --danger-light: #ffece8;

  --text-1: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --text-4: #c9cdd4;

  --bg: #f2f5fa;
  --surface: #ffffff;
  --border: #e2e7f0;
  --border-light: #f1f4f9;

  --radius-lg: 12px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 44, 87, .05);
  --shadow: 0 2px 8px rgba(15, 44, 87, .08);
  --shadow-lg: 0 8px 24px rgba(15, 44, 87, .12);
  --header-h: 56px;
}

/* ---------- 基础 ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: .875rem;               /* 14px */
  line-height: 1.5715;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { color: var(--text-1); font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 1rem; }
h6 { font-size: .875rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
small, .small { font-size: .8125rem; }
.text-muted { color: var(--text-3) !important; }
.text-secondary { color: var(--text-2) !important; }
::selection { background: rgba(26, 86, 168, .16); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d5d8dd; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2c7cf; }

/* 数字等宽，表格/指标数字对齐 */
.table, .dash-num, .stat-num, .num { font-variant-numeric: tabular-nums; }

/* ============================================================
   左侧边栏（藏蓝 · 选中为金色指示条 + 白色浮层）
   ============================================================ */
.app-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: 224px;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-1) 0%, var(--navy-2) 100%);
  border-right: 1px solid rgba(255, 255, 255, .07);
  z-index: 1040;
  overflow-y: auto;
  scrollbar-width: none;
}
.app-sidebar::-webkit-scrollbar { display: none; }
.app-sidebar, body.has-sb .app-main, .app-topbar {
  transition: width .2s ease, margin-left .2s ease, left .2s ease;
}

.sb-brand {
  display: flex; align-items: center; gap: .6rem;
  height: var(--header-h); flex: none;
  padding: 0 .95rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sb-logo {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #e8c964, var(--gold-deep));
  box-shadow: 0 2px 6px rgba(0, 0, 0, .28);
}
.sb-title { color: #fff; font-weight: 600; font-size: .9375rem; line-height: 1.25; }
.sb-sub { color: rgba(255, 255, 255, .55); font-size: .6875rem; line-height: 1.25; }

.sb-nav { flex: 1; padding: .5rem .5rem 1rem; }
/* 分组标题：M01~M10 业务模块（说明书表4-1），组名与主责单位 hover 提示 */
.sb-group {
  display: flex; align-items: center; gap: .375rem;
  color: rgba(255, 255, 255, .52);
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
  padding: .8rem .75rem .3rem;
}
/* 模块之间一条淡分隔线；「我的」「系统管理」等辅助分组不带线 */
.sb-group-mod { border-top: 1px solid rgba(255, 255, 255, .08); margin-top: .4rem; }
.sb-modcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .6875rem; font-weight: 600; letter-spacing: 0;
  color: var(--gold); opacity: .85;
}
/* ---- 三层导航（2026-10-08）：模块标题（点开/收起）→ 子模块 → 页面 ---- */
.sb-mod-head {
  display: flex; align-items: center; gap: .375rem; width: 100%;
  color: rgba(255, 255, 255, .58);
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
  padding: .72rem .75rem .32rem; margin-top: .25rem;
  background: transparent; border: 0; border-top: 1px solid rgba(255, 255, 255, .08);
  text-align: left; cursor: pointer;
}
.sb-mod-head:hover { color: #fff; }
.sb-mod-head.has-active { color: rgba(255, 255, 255, .92); }
.sb-chev {
  width: 14px; height: 14px; margin-left: auto; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .55; transition: transform .15s ease;
}
.sb-chev.open { transform: rotate(90deg); }
.sb-sub {
  color: rgba(255, 255, 255, .4);
  font-size: .6875rem; font-weight: 500;
  padding: .5rem .75rem .15rem 1rem;
}
.sb-sub-pending { opacity: .55; }
.sb-tag {
  margin-left: .3rem; padding: 0 .22rem;
  border: 1px solid rgba(255, 255, 255, .28); border-radius: 3px;
  font-size: .5625rem;
}
.sb-mod-body .sb-item { padding-left: 1.25rem; }
.sb-item {
  display: flex; align-items: center; gap: .625rem;
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-size: .875rem;
  height: 38px;
  padding: 0 .75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.sb-item svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  opacity: .9;
}
.sb-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sb-item.active {
  background: rgba(255, 255, 255, .16);
  color: #fff; font-weight: 500;
  box-shadow: inset 3px 0 0 var(--gold);
}
.sb-item.active svg { opacity: 1; }

.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-badge {
  flex: none; min-width: 18px; padding: 0 .3rem;
  border-radius: 9px; background: #e5484d; color: #fff;
  font-size: .6875rem; font-weight: 500; line-height: 18px; text-align: center;
}

/* 桌面端收缩：仅图标（64px） */
@media (min-width: 992px) {
  .app-sidebar.collapsed { width: 64px; }
  body.has-sb.sb-collapsed .app-main { margin-left: 64px; }
  body.sb-collapsed .app-topbar { left: 64px; }

  .app-sidebar.collapsed .sb-brand { justify-content: center; padding: 0; }
  .app-sidebar.collapsed .sb-brand-text { display: none; }
  .app-sidebar.collapsed .sb-nav { padding: .5rem .5rem 1rem; }
  .app-sidebar.collapsed .sb-item { justify-content: center; padding: 0; }
  .app-sidebar.collapsed .sb-label,
  .app-sidebar.collapsed .sb-badge { display: none; }
  .app-sidebar.collapsed .sb-group {
    font-size: 0; gap: 0; justify-content: center;
    padding: .6rem .5rem .2rem;
  }
  .app-sidebar.collapsed .sb-modcode { display: none; }
  /* 收起态：模块标题退化成一条分隔线，子模块文字隐藏 */
  .app-sidebar.collapsed .sb-mod-head {
    font-size: 0; gap: 0; justify-content: center;
    padding: .6rem .5rem .2rem;
  }
  .app-sidebar.collapsed .sb-chev { display: none; }
  .app-sidebar.collapsed .sb-mod-head::before {
    content: ''; display: block; width: 20px; height: 1px;
    background: rgba(255, 255, 255, .2);
  }
  .app-sidebar.collapsed .sb-sub { display: none; }
  .app-sidebar.collapsed .sb-mod-body .sb-item { padding-left: 0; }
  .app-sidebar.collapsed .sb-group::before {
    content: ''; display: block;
    width: 20px; height: 1px; margin: 0 auto;
    background: rgba(255, 255, 255, .2);
  }
}

/* ============================================================
   顶部通栏（藏蓝，与侧栏连成一体）
   ============================================================ */
.app-topbar {
  position: fixed; top: 0; left: 224px; right: 0;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem 0 .5rem;
  background: var(--navy-1);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  z-index: 1035;
}
.topbar-left { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: .5rem; flex: none; }

.topbar-icon-btn {
  width: 32px; height: 32px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, .78); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.topbar-icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.topbar-icon-btn svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round;
}
body.sb-collapsed #sbCollapse svg { transform: rotate(180deg); }
#sbCollapse svg { transition: transform .2s ease; }

.topbar-crumb {
  margin-left: .5rem;
  font-size: .9375rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-link {
  display: inline-flex; align-items: center; height: 32px;
  color: rgba(255, 255, 255, .82); font-size: .8125rem; text-decoration: none;
  border: none; background: none;
  padding: 0 .6rem; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.topbar-link:hover { color: #fff; background: rgba(255, 255, 255, .14); }

.topbar-user { display: flex; align-items: center; gap: .5rem; padding: 0 .125rem; }
.sb-avatar {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  font-weight: 600; font-size: .8125rem;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-user-name { font-size: .8125rem; font-weight: 500; color: #fff; }
.topbar-user-role { font-size: .6875rem; color: rgba(255, 255, 255, .6); }

#sbToggle { display: none; }
@media (max-width: 991.98px) {
  #sbToggle { display: flex; }
  #sbCollapse { display: none; }
}

/* ============================================================
   主区
   ============================================================ */
body.has-sb .app-main {
  margin-left: 224px;
  padding-top: calc(var(--header-h) + 16px);
  width: auto;
}
.sb-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; }
  .app-sidebar.open { transform: none; box-shadow: 0 0 48px rgba(10, 32, 69, .35); }
  .app-topbar { left: 0; }
  body.has-sb .app-main { margin-left: 0; padding-top: calc(var(--header-h) + 12px) !important; }
  .sb-backdrop.show {
    display: block; position: fixed; inset: 0;
    background: rgba(10, 32, 69, .5); z-index: 1030;
  }
  .card-header .quota-actions { flex-basis: 100%; justify-content: flex-start; }
}

/* ---------- 页头（标题 + 操作区）：对齐规范 ----------
   业务模板普遍写成 <div class="d-flex justify-content-between align-items-center mb-3">
   ＋ <h5 class="mb-0">标题</h5> ＋ <div>按钮…</div>，这里统一成钉钉的页头：
   标题与操作区垂直居中对齐、按钮组等间距、主操作永远在最右。 */
.app-main > .d-flex.justify-content-between:not(.card-header) {
  align-items: center !important;
  gap: .75rem;
  flex-wrap: wrap;
  min-height: 36px;
  margin-bottom: 1rem !important;
}
.app-main > .d-flex.justify-content-between:not(.card-header) > h5,
.app-main > .d-flex.justify-content-between:not(.card-header) > h6 {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin: 0;
  font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em;
}
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
/* 操作区里除了"主操作/危险操作"，一律收敛为中性次要按钮（避免工具条五颜六色） */
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-outline-success,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-outline-info,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-outline-warning,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-success,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-info,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-warning {
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
}
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-outline-success:hover,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-outline-info:hover,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-outline-warning:hover,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-success:hover,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-info:hover,
.app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-warning:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--surface);
}

/* ============================================================
   卡片
   ============================================================ */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 46px;
  padding: .55rem 1rem;
  background: transparent;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600; color: var(--text-1);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}
.card-body { padding: 1rem; }
.card-footer { background: transparent; border-top: 1px solid var(--border-light); padding: .75rem 1rem; }
.card .table { border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden; }
.list-group-item { border-color: var(--border-light); padding: .75rem 1rem; }

/* ============================================================
   按钮（钉钉尺寸：默认 36 / 小 28 / 迷你 24）
   ============================================================ */
.btn {
  --bs-btn-border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  gap: .3rem;
  height: 36px; padding: 0 1rem;
  font-size: .875rem; font-weight: 400; line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-sm, .btn.py-0, .btn-group-sm > .btn { height: 28px; padding: 0 .75rem; font-size: .8125rem; }
.btn-xs { height: 24px; padding: 0 .5rem; font-size: .75rem; }
.btn-lg { height: 40px; padding: 0 1.25rem; font-size: .9375rem; }
.btn svg { width: 1em; height: 1em; flex: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; box-shadow: none; }
.btn.disabled, .btn:disabled { opacity: .45; }

.btn-primary {
  background: var(--primary); border: 1px solid var(--primary); color: #fff;
}
.btn-primary:hover, .btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-primary:active { background: var(--primary-press); border-color: var(--primary-press); }

/* 次要按钮：白底灰边（钉钉默认次要样式） */
.btn-outline-secondary, .btn-secondary, .btn-outline-dark, .btn-outline-primary {
  color: var(--text-1); border: 1px solid var(--border); background: var(--surface);
}
.btn-outline-secondary:hover, .btn-outline-dark:hover,
.btn-secondary:hover, .btn-outline-primary:hover {
  color: var(--primary); border-color: var(--primary); background: var(--surface);
}
.btn-outline-primary { color: var(--primary); border-color: #bcd3f2; }

.btn-outline-danger { color: var(--danger); border: 1px solid #ffd2c9; background: var(--surface); }
.btn-outline-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger { background: var(--danger); border-color: var(--danger); }

.btn-outline-success { color: var(--success); border: 1px solid #aff0b4; background: var(--surface); }
.btn-outline-success:hover { color: #fff; background: var(--success); border-color: var(--success); }
.btn-success { background: var(--success); border-color: var(--success); }

.btn-outline-warning { color: var(--warning); border: 1px solid #ffdfab; background: var(--surface); }
.btn-outline-warning:hover { color: #fff; background: var(--warning); border-color: var(--warning); }

.btn-outline-info { color: var(--primary); border: 1px solid #bcd3f2; background: var(--surface); }
.btn-outline-info:hover { color: var(--primary-press); border-color: var(--primary); }

.btn-link { color: var(--primary); height: auto; padding: 0; border: 0; }
.btn-link:hover { color: var(--primary-hover); }
.btn-light { background: var(--border-light); border-color: var(--border-light); color: var(--text-1); }

/* 表格内操作按钮更紧凑 */
.table .btn-sm, .table .btn.py-0 { height: 26px; padding: 0 .55rem; font-size: .8125rem; }

/* ============================================================
   表单（控件高 36，与按钮对齐）
   ============================================================ */
.form-control, .form-select {
  min-height: 36px;
  padding: .4rem .75rem;
  font-size: .875rem;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.form-control { min-height: 72px; line-height: 1.5; }
.form-control-sm, .form-select-sm { min-height: 28px; height: 28px; padding: .2rem .6rem; font-size: .8125rem; }
.form-control:hover, .form-select:hover { border-color: #c9cdd4; }
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 168, .14);
  background: var(--surface);
}
.form-control::placeholder { color: var(--text-4); }
.form-control:disabled, .form-control[readonly] { background: var(--border-light); color: var(--text-3); }
.form-label { margin-bottom: .35rem; font-size: .8125rem; font-weight: 400; color: var(--text-2); }
.form-text { font-size: .75rem; color: var(--text-3); }
.input-group-text {
  min-height: 36px; padding: 0 .75rem;
  font-size: .875rem;
  background: var(--border-light); border-color: var(--border); color: var(--text-2);
  border-radius: var(--radius-sm);
}
.form-check-input { width: 1rem; height: 1rem; margin-top: .15em; border-color: #c9cdd4; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 86, 168, .14); }
.form-check-label { font-size: .875rem; color: var(--text-1); }
/* 筛选条：标签小一号、控件对齐 */
.row.g-2.align-items-end .form-label,
.row.g-1.align-items-end .form-label { margin-bottom: .3rem; font-size: .75rem; color: var(--text-3); }
/* PC 端筛选控件统一宽度上限，避免同一行里长短不一 */
@media (min-width: 576px) {
  .row.g-2.align-items-end .form-control:not([type="checkbox"]),
  .row.g-2.align-items-end .form-select { max-width: 240px; }
  .row.g-2.align-items-end .form-select { min-width: 132px; }
  .row.g-2.align-items-end .form-control:not([type="checkbox"]) { min-width: 168px; }
}
hr { border-color: var(--border-light); opacity: 1; }

/* ============================================================
   表格（浅灰表头 · 无竖线 · 行悬停）
   ============================================================ */
.table {
  --bs-table-border-color: var(--border-light);
  --bs-table-hover-bg: #f4f7fd;
  margin-bottom: 0;
}
.table > :not(caption) > * > * { padding: .625rem .75rem; color: var(--text-1); vertical-align: middle; }
.table thead th {
  background: #f5f7fb;
  font-weight: 500;
  color: var(--text-3);
  font-size: .8125rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { background: #f4f7fd; }
.table-light { background: #f5f7fb; }
.table-sm th, .table-sm td { padding: .4rem .6rem; }
/* 行内编辑控件保持紧凑，不撑高表格 */
.table .form-control, .table .form-select { min-height: 32px; height: 32px; padding: .15rem .5rem; font-size: .8125rem; }
/* 只读/禁用的单元格控件按"纯文本"呈现：表格看着是一张表，而不是一排灰框 */
.table .form-control:disabled, .table .form-select:disabled, .table .form-control[readonly] {
  background: transparent;
  border-color: transparent;
  padding-left: .25rem;
  color: var(--text-1);
  -webkit-text-fill-color: var(--text-1);
  opacity: 1;
}
.table .badge { vertical-align: middle; }
.sticky-head th { position: sticky; top: 0; background: #f5f7fb; z-index: 1; }
/* 里程与维修统计：表格上百行，表头随内容区滚动冻结。容器自己要成为滚动容器
   （.table-responsive 的 overflow-x:auto 已使其如此），高度由模板脚本按视口剩余空间给定；
   表头底色须压住滚过的行，故不透明底 + 底描边。 */
.mileage-scroll { overflow: auto; }
/* .card .table 的 overflow:hidden（为圆角裁切）会把 table 自己变成滚动容器，
   表头便只相对 table 定位、永远不贴容器顶 → 在本页把 table 还原成不裁剪。 */
.mileage-scroll.sticky-head > table { overflow: visible; }
.mileage-scroll.sticky-head thead th {
  z-index: 3; background: #f5f7fb; box-shadow: inset 0 -1px 0 #dee2e6;
}

/* ============================================================
   页签（下划线式，选中蓝色 + 底部指示条）
   ============================================================ */
.nav-tabs {
  border-bottom: 1px solid var(--border);
  gap: .25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
  padding: .55rem .8rem;
  font-size: .875rem; color: var(--text-2);
  white-space: nowrap;
}
.nav-tabs .nav-link:hover { color: var(--primary); border-bottom-color: transparent; }
.nav-tabs .nav-link.active {
  color: var(--primary); font-weight: 500;
  background: transparent; border-bottom-color: var(--primary);
}
.nav-tabs .nav-link.text-danger.active { color: var(--danger); border-bottom-color: var(--danger); }
.nav-pills { gap: .25rem; }
.nav-pills .nav-link { border-radius: var(--radius-sm); color: var(--text-2); font-size: .875rem; }
.nav-pills .nav-link.active { background: var(--primary); }

/* ============================================================
   标签 / 提示 / 进度
   ============================================================ */
.badge { padding: .25em .6em; font-size: .75rem; font-weight: 400; border-radius: 4px; line-height: 1.4; }
.badge.bg-success { background: var(--success-light) !important; color: var(--success); }
.badge.bg-danger { background: var(--danger-light) !important; color: var(--danger); }
.badge.bg-warning { background: var(--warning-light) !important; color: #d25f00; }
.badge.bg-warning.text-dark { color: #d25f00 !important; }
.badge.bg-secondary, .badge.bg-light { background: var(--border-light) !important; color: var(--text-3); }
.badge.bg-light.text-secondary.border { border-color: var(--border) !important; color: var(--text-3) !important; }
.badge.bg-info { background: var(--primary-light) !important; color: var(--primary); }
.badge.bg-primary { background: var(--primary-light) !important; color: var(--primary); }

.alert { border-radius: var(--radius); border-width: 1px; padding: .65rem .9rem; font-size: .875rem; }
.alert-success { background: var(--success-light); border-color: #aff0b4; color: #007a1d; }
.alert-danger { background: var(--danger-light); border-color: #ffd2c9; color: #cb2634; }
.alert-warning { background: var(--warning-light); border-color: #ffdfab; color: #d25f00; }
.alert-info { background: var(--primary-light); border-color: #bcd3f2; color: var(--primary-press); }
.alert-secondary, .alert-light { background: var(--border-light); border-color: var(--border); color: var(--text-2); }
.alert a { color: inherit; font-weight: 500; }
.alert-dismissible .btn-close { padding: .7rem .8rem; }
.progress { height: 6px; border-radius: 3px; background: var(--border-light); }
.progress-bar { background: var(--primary); }

/* ============================================================
   下拉 / 分页 / 弹窗
   ============================================================ */
.dropdown-menu {
  padding: .25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.dropdown-item { border-radius: var(--radius-sm); padding: .45rem .7rem; font-size: .875rem; color: var(--text-2); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--border-light); color: var(--text-1); }
.dropdown-item.text-danger, .dropdown-item.text-danger:hover { color: var(--danger); }
.dropdown-divider { border-color: var(--border-light); }

.page-link {
  min-width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 3px; padding: 0 .5rem;
  font-size: .8125rem;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm) !important;
}
.page-link:hover { color: var(--primary); border-color: var(--primary); background: var(--surface); }
.page-item.active .page-link { color: #fff; background: var(--primary); border-color: var(--primary); }
.page-item.disabled .page-link { color: var(--text-4); background: var(--surface); border-color: var(--border-light); }

.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { padding: .8rem 1rem; border-bottom: 1px solid var(--border-light); }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1rem; }
.modal-footer { padding: .7rem 1rem; border-top: 1px solid var(--border-light); gap: .5rem; }
.modal-footer > * { margin: 0; }
.modal-backdrop.show { opacity: .45; }
.btn-close { padding: .45rem; border-radius: var(--radius-sm); background-size: .7em; }
.btn-close:hover { background-color: var(--border-light); }

/* ============================================================
   首页 / 看板卡片
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.dash-card {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1rem;
  text-decoration: none; color: var(--text-1);
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.dash-card:hover { border-color: #bcd3f2; box-shadow: var(--shadow); color: var(--text-1); transform: translateY(-1px); }
.dash-ico {
  width: 40px; height: 40px; flex: none;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary);
}
.dash-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dash-grid .dash-card:nth-child(4n+2) .dash-ico { background: var(--success-light); color: var(--success); }
.dash-grid .dash-card:nth-child(4n+3) .dash-ico { background: var(--warning-light); color: var(--warning); }
.dash-grid .dash-card:nth-child(4n+4) .dash-ico { background: #fbf4e3; color: var(--gold-deep); }
.dash-num { font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.dash-label { font-size: .8125rem; color: var(--text-2); }
.dash-sub { font-size: .75rem; color: var(--text-3); line-height: 1.4; }
.stat-num { font-size: 1.5rem; font-weight: 600; }
.text-lack { color: var(--danger); font-weight: 600; }

/* ============================================================
   登录页（分屏）
   ============================================================ */
.login-page { display: flex; min-height: 100vh; margin: 0 -1.5rem; background: var(--surface); }
.login-hero {
  flex: 1.05;
  background:
    radial-gradient(660px 420px at 88% -14%, rgba(212, 175, 55, .22), transparent 62%),
    linear-gradient(150deg, var(--navy-2) 0%, #123f80 52%, var(--primary) 100%);
  color: #fff;
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem 3.5rem;
  position: relative; overflow: hidden;
}
.login-hero::before, .login-hero::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.login-hero::before { width: 420px; height: 420px; right: -140px; top: -140px; }
.login-hero::after { width: 320px; height: 320px; left: -120px; bottom: -160px; }
.login-hero > * { position: relative; z-index: 1; }
.login-hero-logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #e8c964, var(--gold-deep));
  color: var(--navy-2);
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; font-weight: 600;
  margin-bottom: 1.25rem;
}
.login-hero h2 { font-size: 1.5rem; font-weight: 600; color: #fff; margin-bottom: .5rem; }
.login-hero .hero-sub { color: rgba(255, 255, 255, .85); font-size: .875rem; margin-bottom: 0; }
.login-hero ul {
  list-style: none; padding: 0; margin: 1.75rem 0 0;
  display: flex; flex-direction: column; gap: .6rem;
  font-size: .875rem; color: rgba(255, 255, 255, .92);
}
.login-hero li::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  margin-right: .6rem; vertical-align: 2px;
}
.login-hero .hero-foot { margin-top: 3rem; font-size: .75rem; color: rgba(255, 255, 255, .6); }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.login-form { width: 100%; max-width: 340px; }
.login-form h4 { font-weight: 600; }
.login-form .form-label { font-size: .8125rem; }
.login-form .btn-primary { height: 40px; letter-spacing: .25em; }
.login-form .form-control { height: 40px; }
.login-wrap { max-width: 420px; margin: 8vh auto; }

/* ============================================================
   响应式
   ============================================================ */
html, body { max-width: 100%; overflow-x: hidden; }
.app-main { min-width: 0; width: 100%; }
.app-main > * { min-width: 0; }
.table-responsive { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive > table { min-width: max-content; }
.card, .card-body, .card-header { min-width: 0; }
.text-nowrap { white-space: nowrap; }

/* 平板及以下 */
@media (max-width: 991.98px) {
  .app-main { padding-left: .75rem !important; padding-right: .75rem !important; }
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) { width: 100%; }
  .app-main > .d-flex.justify-content-between:not(.card-header) h5,
  .app-main > .d-flex.justify-content-between:not(.card-header) h6 { line-height: 1.4; }
  .row.g-2.align-items-end > [class*="col-"],
  .row.g-1.align-items-center > [class*="col-"] { width: 100%; max-width: 100%; }
  .row.g-2.align-items-end .form-select,
  .row.g-2.align-items-end .form-control { width: 100%; }
  .card-body { padding: .875rem; }
  .dash-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .pagination { flex-wrap: wrap; }
  .btn { max-width: 100%; }
  .form-control, .form-select { max-width: 100%; }
}

/* 手机 */
@media (max-width: 575.98px) {
  :root { --header-h: 52px; }
  body { font-size: .875rem; }
  .app-main { padding-left: .625rem !important; padding-right: .625rem !important; }
  /* 顶栏精简：只留头像（改密/退出在抽屉底部） */
  .topbar-user-meta { display: none; }
  .topbar-link { display: none; }          /* 「改密」「退出」挪进抽屉 sb-foot */
  .topbar-crumb { font-size: .875rem; }
  .topbar-right { gap: .25rem; }
  /* 页头：标题独占一行；操作区主按钮（蓝）独占一行铺满，次要按钮两列栅格 */
  .app-main > .d-flex.justify-content-between:not(.card-header) { gap: .5rem; margin-bottom: .75rem !important; }
  .app-main > .d-flex.justify-content-between:not(.card-header) > h5,
  .app-main > .d-flex.justify-content-between:not(.card-header) > h6 { font-size: 1.0625rem; }
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) { gap: .5rem; }
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn-primary,
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > form.d-inline > .btn-primary {
    flex: 1 1 100%;
  }
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > .btn,
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > a.btn {
    flex: 1 1 calc(50% - .25rem); min-width: calc(50% - .25rem);
  }
  /* 包在 <form> 里的操作按钮同样参与两列栅格，否则一行宽一行窄 */
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > form.d-inline {
    display: flex; flex: 1 1 calc(50% - .25rem); min-width: calc(50% - .25rem); margin: 0;
  }
  .app-main > .d-flex.justify-content-between:not(.card-header) > div:last-child:not(:first-child) > form.d-inline > .btn {
    flex: 1 1 auto;
  }
  /* 筛选条里的「查看/查询」等按钮铺满一行 */
  form.card .btn { min-height: 36px; }
  /* 卡片贴边一点，接近钉钉 App 的整屏分块 */
  .card { border-radius: var(--radius); }
  .card-header { min-height: 42px; padding: .5rem .75rem; border-radius: var(--radius) var(--radius) 0 0 !important; }
  .card-body { padding: .75rem; }
  .table { font-size: .8125rem; }
  .table > :not(caption) > * > * { padding: .5rem .55rem; }
  .table thead th { font-size: .75rem; }
  /* 手机上内容优先：表格单元格允许换行（只有表格容器还横向滚动兜底） */
  .table td, .table th { white-space: normal; overflow-wrap: anywhere; }
  .table thead th { white-space: nowrap; }
  /* 手机端缩略图收小，行高更紧凑（照片原尺寸 52×64） */
  .table td img { max-width: 44px !important; max-height: 52px !important; }
  .table-responsive { margin-left: -.625rem; margin-right: -.625rem; padding: 0 .625rem; }
  /* 弹层手机化：贴底升起（钉钉半屏弹层），占位项不再显示 */
  .modal-dialog { margin: 0; align-items: flex-end; }
  .modal-dialog, .modal-content { max-width: 100vw; width: 100vw; }
  .modal-content { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 88vh; overflow-y: auto; }
  .modal.fade .modal-dialog { transform: translateY(100%); }
  .modal.show .modal-dialog { transform: none; }
  .modal-footer .btn { flex: 1 1 auto; }
  .btn-close { min-width: 28px; min-height: 28px; }
  .dropdown-menu { max-width: calc(100vw - 1.25rem); }
  .dropdown-item { padding: .6rem .7rem; }
  .alert { overflow-wrap: anywhere; }
  .login-page { margin: 0 -.625rem; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .dash-card { flex-direction: column; align-items: flex-start; gap: .5rem; padding: .75rem; }
  .dash-num { font-size: 1.25rem; }
  .nav-tabs .nav-link { padding: .5rem .65rem; }
  /* 统计卡手机两列（钉钉数据概览式） */
  .row.g-3 > [class*="col-"] { min-width: 0; }
  .stat-num { font-size: 1.375rem; }
  .card-body.text-center { padding: .65rem .5rem; }
  .card-body.text-center .text-muted.small { font-size: .6875rem; }
}
@media (max-width: 991.98px) { .login-hero { display: none; } }

/* ============================================================
   手机底部标签栏（钉钉式，≤991px 显示）
   ============================================================ */
.app-tabbar { display: none; }
@media (max-width: 991.98px) {
  .app-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    display: flex; align-items: stretch;
    height: calc(54px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(15, 44, 87, .06);
  }
  body.has-sb .app-main { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important; }
  /* 抽屉打开时遮罩压住底部标签栏，观感上更像弹层（侧栏 z-index 仍更高） */
  .sb-backdrop.show { z-index: 1036; }
}
.app-tabbar .tab-item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  border: 0; background: none; padding: 6px 0 8px;
  color: var(--text-3); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.app-tabbar .tab-item.active { color: var(--primary); }
.app-tabbar .tab-ico { position: relative; display: flex; }
.app-tabbar .tab-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-tabbar .tab-label { font-size: .6875rem; line-height: 1; }
.app-tabbar .tab-dot {
  position: absolute; top: -4px; left: 12px; min-width: 15px; height: 15px;
  padding: 0 4px; border-radius: 8px;
  background: #e5484d; color: #fff;
  font-size: .625rem; line-height: 15px; text-align: center; font-weight: 500;
}

/* 手机抽屉侧栏底部：账号 + 改密/退出（顶栏手机上只留头像） */
.sb-foot { display: none; }
@media (max-width: 991.98px) {
  .sb-foot {
    display: block; flex: none;
    padding: .75rem .9rem calc(.9rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, .08);
  }
  .sb-foot-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .65rem; }
  .sb-foot-name { color: #fff; font-size: .875rem; font-weight: 500; line-height: 1.3; }
  .sb-foot-role { color: rgba(255, 255, 255, .55); font-size: .6875rem; line-height: 1.3; }
  .sb-foot-links { display: flex; gap: .5rem; }
  .sb-foot-links form { margin: 0; }
  .sb-foot-links a, .sb-foot-links button {
    flex: 1; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .9); font-size: .8125rem; text-decoration: none;
    cursor: pointer;
  }
  .sb-foot-links a:hover, .sb-foot-links button:hover { background: rgba(255, 255, 255, .16); color: #fff; }
}

/* ---------- 出车日报手机卡片（rl-mobile，仅 ≤575px 显示） ---------- */
.rl-group {
  margin: 1rem .125rem .5rem;
  font-size: .8125rem; font-weight: 600; color: var(--text-2);
}
.rl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .7rem .8rem;
  margin-bottom: .5rem;
}
.rl-card.is-maint { background: #fffdf5; border-color: #ffdfab; }
.rl-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.rl-plate { font-weight: 600; font-size: .9375rem; color: var(--text-1); }
.rl-tag {
  flex: none;
  font-size: .6875rem; line-height: 1.5;
  color: #d25f00; background: var(--warning-light);
  border-radius: 4px; padding: 0 .35rem;
}
.rl-state { font-size: .6875rem; color: var(--text-3); }
.rl-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem;
  text-align: center;
  background: var(--border-light); border-radius: var(--radius-sm);
  padding: .5rem .25rem;
}
.rl-stats i { display: block; font-style: normal; font-size: .6875rem; color: var(--text-3); margin-bottom: 1px; }
.rl-stats b { font-weight: 600; font-size: .8125rem; color: var(--text-1); }
.rl-trips {
  font-style: normal; font-size: .625rem;
  color: var(--primary); background: var(--primary-light);
  border-radius: 8px; padding: 0 .3rem; margin-left: .15rem;
}
.rl-trip-list {
  display: flex; flex-wrap: wrap; gap: .25rem .6rem;
  margin-top: .45rem;
  font-size: .6875rem; color: var(--text-2);
}
.rl-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem .5rem;
  margin-top: .5rem;
  font-size: .6875rem; color: var(--text-3);
}
/* 地址独占一行，车龄/累计里程右对齐占第二行，避免数字被拆行 */
.rl-foot > span:first-child { flex: 1 1 100%; }
.rl-foot > span:last-child { margin-left: auto; }
.rl-empty { padding: .1rem 0; }
.rl-note { margin: .75rem .125rem 1rem; }

/* ============================================================
   Bootstrap 语义色工具类对齐公安蓝色板（模板里散落的 text-*/border-* ）
   ============================================================ */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--primary) !important; }
.text-primary { color: var(--primary) !important; }
.text-dark { color: var(--text-1) !important; }
.border-success { border-color: #aff0b4 !important; }
.border-danger { border-color: #ffd2c9 !important; }
.border-warning { border-color: #ffdfab !important; }
.border-info { border-color: #bcd3f2 !important; }
.border-primary { border-color: var(--primary) !important; }
.border-secondary { border-color: var(--border) !important; }
.bg-light { background: var(--border-light) !important; }
.text-bg-secondary { background: var(--border-light) !important; color: var(--text-2) !important; }
.bg-primary-subtle { background: var(--primary-light) !important; }
/* 表格里的小工具条（例如"标记处理"）保持一行不换行 */
.table .d-flex { flex-wrap: nowrap; }

