/* ==========================================================================
   旅游大巴车车辆调度后台管理系统 - 公共样式
   ========================================================================== */

:root {
  /* 主色板 */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-light: #dbeafe;
  --primary-bg: #eff6ff;

  /* 状态色 */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #06b6d4;
  --info-light: #cffafe;

  /* 品牌渐变（呼应登录页 auth.css 135deg 品牌蓝） */
  --brand-grad: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --grad-loading: linear-gradient(90deg, #16a34a, #2563eb);

  /* 侧边栏（深色底，深浅主题共用） */
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-text-dim: #94a3b8;
  --sidebar-group-title: #64748b;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --sidebar-line: rgba(255, 255, 255, 0.06);

  /* 中性色 */
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-hover: #f9fafb;
  --bg-section: #f8fafc;
  /* [全站审查 M18 2026-09-28] 页面级表面底（日历头/抽屉头/只读输入框/hover）：
     8 页 20+ 处引用 var(--bg-app) 但该令牌此前从未定义（背景静默失效回退透明）。
     语义与 --bg-section 同族，独立成令牌以便后续单独调档。 */
  --bg-app: #f8fafc;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --text-quaternary: #d1d5db;
  --text-inverse: #ffffff;

  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --border-dark: #d1d5db;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);

  /* 圆角 */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* 布局 */
  --sidebar-width: 220px;
  --sidebar-width-collapsed: 64px;
  --header-height: 60px;
  --content-padding: 24px;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

/* Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

ul,
ol {
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

/* 滚动条
   ========================================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* 应用布局：左侧导航 + 顶栏 + 主内容
   ========================================================================== */
.app {
  display: flex;
  min-height: 100vh;
  animation: pageFadeIn .18s ease-out;
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .app { animation: none; }
}

/* SPA 加载进度条 */
#spaLoadingBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  display: none;
  background: transparent;
}
.spa-loading-progress {
  height: 100%;
  width: 0;
  background: var(--grad-loading);
  box-shadow: 0 0 8px rgba(37,99,235,.5);
}
#spaLoadingBar.spa-loading-active .spa-loading-progress {
  animation: spaLoadingAnim .8s ease-in-out forwards;
}
@keyframes spaLoadingAnim {
  0%   { width: 0; margin-left: 0; }
  30%  { width: 60%; margin-left: 20%; }
  100% { width: 100%; margin-left: 0; }
}

/* 侧边栏
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-line);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-header .sidebar-logo {
  display: block;
  flex-shrink: 0;
}

.sidebar-header .sidebar-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar-header .sidebar-header-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
}

.sidebar-header .sidebar-header-tag {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.3px;
}

.sidebar-header .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--brand-grad);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-nav-group {
  margin-bottom: 16px;
}

.sidebar-nav-group-title {
  font-size: 11px;
  color: var(--sidebar-group-title);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 12px;
  margin-bottom: 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

/* [批次C-1 2026-09-24] 激活态：品牌渐变呼应登录页 */
.sidebar-nav-item.active {
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.sidebar-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-line);
  font-size: 12px;
  color: var(--sidebar-group-title);
  text-align: center;
}

/* 主区域
   ========================================================================== */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 顶栏
   ========================================================================== */
.topbar {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-left .breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
}

.topbar-left .breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 16px;
  position: relative;
  transition: all 0.15s;
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* [批次C 2026-09-24] 偏好按钮激活态（深色开启 / 紧凑密度开启） */
.topbar-icon-btn.is-on {
  background: var(--primary-light);
  color: var(--primary);
}

.topbar-icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.topbar-user:hover {
  background: var(--bg-hover);
}

.topbar-user .avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.topbar-user .name {
  font-size: 13px;
  color: var(--text-primary);
}

.topbar-user .role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* 内容区
   ========================================================================== */
.content {
  flex: 1;
  padding: var(--content-padding);
  overflow-y: auto;
}

/* 存储模式提示条
   —— 当浏览器在 file:// 下禁用 localStorage 时显示，告知用户当前为临时数据模式
   ========================================================================== */
.storage-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--warning-light);
  border: 1px solid #fcd34d;
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #92400e;
}

.storage-tip i {
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--warning);
}

.storage-tip strong {
  color: #78350f;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title .accent {
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 卡片
   ========================================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--primary);
}

.card-body {
  padding: 20px;
}

.card-body.no-pad {
  padding: 0;
}

/* 按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-default {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-default:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-text {
  background: transparent;
  color: var(--primary);
  padding: 4px 8px;
}

.btn-text:hover:not(:disabled) {
  color: var(--primary-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* 表单
   ========================================================================== */
.form-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.form-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 34px;
  text-align: right;
}

.form-label.required::before {
  content: "*";
  color: var(--danger);
  margin-right: 4px;
}

.form-control-wrap {
  flex: 1;
  min-width: 0;
}

.form-control {
  width: 100%;
  height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: all 0.15s;
  outline: none;
}

.form-control:hover {
  border-color: var(--border-dark);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: 8px 12px;
  line-height: 1.6;
  resize: vertical;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%239ca3af' d='M8 11.5L3 6.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  padding-right: 28px;
  appearance: none;
}

.form-help {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* 表格
   ========================================================================== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  background: var(--bg-section);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12.5px;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.table .checkbox-cell {
  width: 40px;
  text-align: center;
}

/* 标签 / Badge
   ========================================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 18px;
  background: var(--bg-section);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.tag-primary {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.2);
}

.tag-success {
  background: var(--success-light);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.2);
}

.tag-warning {
  background: var(--warning-light);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.2);
}

.tag-danger {
  background: var(--danger-light);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.2);
}

.tag-info {
  background: var(--info-light);
  color: #0e7490;
  border-color: rgba(6, 182, 212, 0.2);
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* 数据看板：关键统计卡片
   ========================================================================== */
.stat-grid {
  display: grid;
  /* [批次23b 2026-09-28] 180→208：1440 宽下 6 列时金额「¥63,800.00」溢出卡片，收窄为 5 列保证金额卡有足够宽度 */
  grid-template-columns: repeat(auto-fit, minmax(208px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon.success {
  background: var(--success-light);
  color: #047857;
}

.stat-icon.warning {
  background: var(--warning-light);
  color: #b45309;
}

.stat-icon.danger {
  background: var(--danger-light);
  color: #b91c1c;
}

.stat-icon.info {
  background: var(--info-light);
  color: #0e7490;
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  font-family: var(--font-mono);
  /* [批次23b] 金额为不可断行 token，溢出时裁切而非顶破卡片 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 金额卡专用：等宽字体 + 千分位使「¥63,800.00」较宽，降到 16px 保证容纳 */
.stat-value.money {
  font-size: 16px;
  letter-spacing: -0.2px;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  margin-top: 4px;
}

/* [界面修复 2026-09-27 · 问题3] 状态指标汇总卡（司机管理 / 车辆管理 KPI 条）
   此前 .summary-cards / .summary-card / .icon / .info / .label / .value
   在任何样式表中均无定义（样式丢失），渲染为无卡片无图标的散排文本 */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  min-width: 0;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.summary-card .info {
  flex: 1;
  min-width: 0;
}

.summary-card .label {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-card .value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 深色模式下柔和化图标配色（icon 背景为页面内联浅色 accent） */
[data-theme="dark"] .summary-card .icon {
  opacity: 0.9;
}

@media (max-width: 1024px) {
  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .summary-card {
    padding: 12px 14px;
    gap: 10px;
  }
  .summary-card .icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .summary-card .value {
    font-size: 17px;
  }
}

.stat-trend.up {
  color: var(--danger);
}

.stat-trend.down {
  color: var(--success);
}

/* 进度条
   ========================================================================== */
.progress {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-bar.success {
  background: var(--success);
}

.progress-bar.warning {
  background: var(--warning);
}

.progress-bar.danger {
  background: var(--danger);
}

/* 工具类
   ========================================================================== */
.text-primary {
  color: var(--primary);
}
.text-success {
  color: var(--success);
}
.text-warning {
  color: var(--warning);
}
.text-danger {
  color: var(--danger);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-tertiary {
  color: var(--text-tertiary);
}
.text-bold {
  font-weight: 600;
}

.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}

.mono {
  font-family: var(--font-mono);
}

.mt-0 {
  margin-top: 0;
}
.mt-8 {
  margin-top: 8px;
}
.mt-12 {
  margin-top: 12px;
}
.mt-16 {
  margin-top: 16px;
}
.mt-20 {
  margin-top: 20px;
}
.mb-8 {
  margin-bottom: 8px;
}
.mb-12 {
  margin-bottom: 12px;
}
.mb-16 {
  margin-bottom: 16px;
}
.mb-20 {
  margin-bottom: 20px;
}

.flex {
  display: flex;
}
.flex-1 {
  flex: 1;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-8 {
  gap: 8px;
}
.gap-12 {
  gap: 12px;
}
.gap-16 {
  gap: 16px;
}

.divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

/* Modal
   ========================================================================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}

.modal.modal-lg {
  max-width: 800px;
}

.modal.modal-xl {
  max-width: 1080px;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Toast
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  color: var(--text-primary);
  min-width: 240px;
  animation: slideInRight 0.2s ease;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 分页
   ========================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  flex-wrap: wrap;
}

.pagination .page-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 8px;
}

.pagination .page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination .page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 空状态
   ========================================================================== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.empty i {
  font-size: 48px;
  color: var(--text-quaternary);
  margin-bottom: 12px;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--bg-section), transparent);
  border: 1px solid var(--border-light);
}

.empty-text {
  font-size: 13px;
  line-height: 1.6;
  max-width: 420px;
}

/* 响应式
   ========================================================================== */
/* [批次39 移动端修复 2026-10-05] 抽屉菜单遮罩：≤1024px 开菜单时显示，
 * z99 = 低于侧栏(100)、高于内容与顶栏(50)；点遮罩关闭（js/common.js bindTopbar） */
.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 99;
}

.sidebar-mask.show {
  display: block;
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  :root {
    --content-padding: 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .stat-value {
    font-size: 16px;
  }

  .form-row,
  .form-row-3,
  .form-row-4 {
    grid-template-columns: 1fr;
  }

  .form-label {
    width: auto;
    text-align: left;
    line-height: 1.4;
  }

  .topbar-user .name,
  .topbar-user .role {
    display: none;
  }

  .page-title {
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-secondary);
}

.menu-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   侧边栏子菜单（待办与消息通知 / 系统权限设置 等分组模块）
   ========================================================================== */
.sidebar-nav-group > .sidebar-nav-item {
  cursor: pointer;
}
.sidebar-nav-group .submenu-arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--sidebar-text-dim);
  transition: transform 0.18s ease;
}
.sidebar-nav-group.open .submenu-arrow {
  transform: rotate(180deg);
}
.sidebar-submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 6px 14px;
}
.sidebar-nav-group.open .sidebar-submenu,
.sidebar-nav-group.grp-active .sidebar-submenu {
  display: flex;
}
.sidebar-submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 18px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--sidebar-text-dim);
  position: relative;
}
.sidebar-submenu-item::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.sidebar-submenu-item i {
  font-size: 12px;
  width: 14px;
  text-align: center;
}
.sidebar-submenu-item:hover {
  color: #f1f5f9;
  background: var(--sidebar-hover-bg);
}
.sidebar-submenu-item.active {
  color: #f8fafc;
  background: rgba(37, 99, 235, 0.22);
  font-weight: 600;
}

/* ==========================================================================
   响应式与移动端适配强化（2026-09-15 上线内测）
   - 宽业务表格在窄屏卡片内横向滚动，避免撑破视口（触控惯性滚动）
   - 触控目标增大：按钮 / 分页 ≥ 36px（移动端可用性基线）
   - 输入控件字号 16px：避免 iOS Safari 聚焦输入框时自动缩放页面
   - 弹窗留白收紧，保证小屏可视高度
   ========================================================================== */
@media (max-width: 768px) {
  /* 顶栏收缩：左区可压缩（面包屑/项目选择器省略），右区收紧间距，避免撑破小屏 */
  .topbar {
    padding: 0 12px;
  }

  .topbar-left {
    min-width: 0;
    flex: 1;
    gap: 8px;
  }

  .topbar-left .breadcrumb {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  #globalProjectWrap .gp-btn {
    max-width: 128px;
  }

  #globalProjectWrap .gp-btn-label {
    max-width: 76px;
  }

  .topbar-right {
    gap: 8px;
    flex-shrink: 0;
  }

  .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 520px;
  }

  .btn {
    min-height: 36px;
  }

  .pagination .page-btn {
    min-width: 36px;
    height: 36px;
  }

  .form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px;
  }

  .modal-mask {
    padding: 12px;
  }

  .modal {
    max-height: 92vh;
  }

  .page-title {
    font-size: 18px;
  }

  .empty {
    padding: 40px 16px;
  }

  .empty i {
    width: 72px;
    height: 72px;
    font-size: 40px;
  }
}

/* ==========================================================================
   [批次C-2 2026-09-24] 深色模式
   - html[data-theme="dark"] 覆写设计令牌，全站组件经 var() 引用自动适配
   - 偏好持久化 localStorage: bus_theme_v1（light/dark），切换入口：
     顶栏月亮/太阳按钮 + 个人资料「偏好与入口」卡
   - 侧边栏本身即深色底，深浅主题下不变（--sidebar-* 令牌不覆写）
   ========================================================================== */
:root {
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #283548;
  --bg-section: #243146;
  --bg-app: #243146; /* [M18] 深色档位与 --bg-section 一致 */

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-quaternary: #64748b;

  --border: #33415c;
  --border-light: #2b3a52;
  --border-dark: #475569;

  --primary-light: rgba(59, 130, 246, 0.22);
  --primary-bg: rgba(59, 130, 246, 0.13);
  --success-light: rgba(16, 185, 129, 0.18);
  --warning-light: rgba(245, 158, 11, 0.18);
  --danger-light: rgba(239, 68, 68, 0.18);
  --info-light: rgba(6, 182, 212, 0.18);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* 深色下状态标签文字提亮（原浅色卡片上的深色文字在深底不可读） */
[data-theme="dark"] .tag-primary { color: #93c5fd; }
[data-theme="dark"] .tag-success { color: #6ee7b7; }
[data-theme="dark"] .tag-warning { color: #fcd34d; }
[data-theme="dark"] .tag-danger { color: #fca5a5; }
[data-theme="dark"] .tag-info { color: #67e8f9; }

/* 深色下统计图标文字提亮 */
[data-theme="dark"] .stat-icon.success { color: #6ee7b7; }
[data-theme="dark"] .stat-icon.warning { color: #fcd34d; }
[data-theme="dark"] .stat-icon.danger { color: #fca5a5; }
[data-theme="dark"] .stat-icon.info { color: #67e8f9; }

/* 深色下本地存储提示条（warning-light 已半透明化，深棕文字不可读） */
[data-theme="dark"] .storage-tip { color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); }
[data-theme="dark"] .storage-tip strong { color: #fde68a; }

/* 深色下弹窗遮罩加深，保证前景卡片对比度 */
[data-theme="dark"] .modal-mask { background: rgba(2, 6, 23, 0.68); }

/* ==========================================================================
   [批次C-4 2026-09-24] 表格密度切换
   - html[data-density="compact"] 全局压缩 .table 单元格内距（舒适=默认不标记）
   - 偏好持久化 localStorage: bus_density_v1（cozy/compact），入口：
     顶栏行距按钮 + 个人资料「偏好与入口」卡
   ========================================================================== */
html[data-density="compact"] .table thead th {
  padding: 8px 10px;
  font-size: 12px;
}

html[data-density="compact"] .table tbody td {
  padding: 6px 10px;
  font-size: 12.5px;
  line-height: 1.45;
}

html[data-density="compact"] .pagination {
  padding: 10px;
}

html[data-density="compact"] .lv-pv-table th,
html[data-density="compact"] .lv-pv-table td {
  padding: 4px 6px;
}

/* 各列表页自建表格类（trips/fees/income/vehicles）同步压缩 */
html[data-density="compact"] table.trips-table th,
html[data-density="compact"] table.trips-table td,
html[data-density="compact"] table.fees-table th,
html[data-density="compact"] table.fees-table td,
html[data-density="compact"] table.inc-table th,
html[data-density="compact"] table.inc-table td,
html[data-density="compact"] table.data-table th,
html[data-density="compact"] table.data-table td {
  padding: 6px 10px;
  font-size: 12.5px;
}
