/* 后台布局：顶部一级菜单 + 左侧二级菜单 */
/* 顶部横排一级菜单（插入在导航条 brand 之后） */
.nav-tabs { display: flex; align-items: stretch; height: 100%; margin-left: 26px; }
.nav-tabs a {
  display: flex; align-items: center; padding: 0 16px;
  color: #aab4c5; font-size: 14px; text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav-tabs a:hover { color: #fff; }
.nav-tabs a.active { color: #fff; border-bottom-color: #4da1ff; }

/* 当前登录人 + 退出登录统一靠右（#who 推到最右，退出登录跟在其后） */
.navbar #who { margin-left: auto; }

.main { display: flex; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.sidebar { width: 150px; flex-shrink: 0; padding: 18px 0 40px; }
.sidebar .sg-title { font-size: 12px; color: #98a1b3; padding: 12px 12px 5px; }
.sidebar .sg-sub { font-size: 12px; color: #b0b8c7; padding: 10px 12px 3px; margin-top: 4px; border-top: 1px dashed #e4e9f2; }
.sidebar .sg-sub:first-of-type { border-top: none; }
.sidebar a.sub { padding-left: 24px; font-size: 13px; }
.sidebar a {
  display: block; padding: 9px 12px; margin: 2px 0;
  color: #444; font-size: 14px; border-radius: 6px; text-decoration: none;
}
.sidebar a:hover { background: #e8eefb; color: #2f6fed; }
.sidebar a.active { background: #2f6fed; color: #fff; }
.content { flex: 1; min-width: 0; padding: 18px 0 40px 18px; }
/* 统一各页 .wrap 在侧栏布局内的表现 */
.main .wrap { max-width: none; margin: 0; padding: 0; }

/* ===== 报表底部统计条（iPOS 风格） ===== */
.statbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px;
  border-top: 1px solid #e5e9f0; margin-top: 12px; padding-top: 10px;
  font-size: 13px; color: #555;
}
.statbar .sum { color: #d43c33; font-weight: bold; }
.statbar .sum.green { color: #1f8f4d; }
.statbar .sum.blue { color: #2f6fed; }
.statbar .pg { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statbar .pg button { padding: 3px 10px; border: 1px solid #d5dbe4; background: #fff; border-radius: 4px; cursor: pointer; color: #333; font-size: 12px; }
.statbar .pg button:disabled { color: #bbb; cursor: default; }
.statbar .pg button:hover:not(:disabled) { border-color: #2f6fed; color: #2f6fed; }
.statbar .pg button.go { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.statbar .pg button.go:hover { color: #fff; }
.statbar .pg select, .statbar .pg input { padding: 3px 6px; border: 1px solid #d5dbe4; border-radius: 4px; font-size: 12px; width: 52px; text-align: center; }

/* 手机端汉堡菜单按钮 + 抽屉菜单容器（仅移动端媒体查询内显示，桌面端始终隐藏） */
.m-menu-btn, .m-menu-mask { display: none; }

/* ===== 移动端适配（≤768px）：手机浏览器直接可用 ===== */
@media (max-width: 768px) {
  /* 顶部导航：压缩留白，一级菜单横向滑动 */
  .navbar { padding: 0 12px; gap: 10px; }
  .navbar .brand { font-size: 15px; white-space: nowrap; }
  .navbar #who { display: none; }
  .navbar .logout, .navbar #pwdEntry { white-space: nowrap; flex-shrink: 0; font-size: 12px; }
  .navbar #pwdEntry { display: none; } /* 修改密码入口移入抽屉菜单 */
  .nav-tabs { margin-left: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs a { padding: 0 12px; font-size: 13px; flex-shrink: 0; }

  /* 手机端汉堡菜单按钮 + 全屏抽屉菜单 */
  .m-menu-btn {
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
    padding: 4px 8px; margin-left: 2px; flex-shrink: 0; user-select: none;
  }
  .m-menu-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9998; display: none; }
  .m-menu-mask.open { display: block; }
  .m-menu {
    position: absolute; top: 0; right: 0; bottom: 0; width: 280px; max-width: 82vw;
    background: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 10px 0 30px; box-shadow: -4px 0 16px rgba(0,0,0,.18);
  }
  .m-menu .mg-title { font-size: 12px; color: #98a1b3; padding: 13px 18px 4px; }
  .m-menu .mg-sub { font-size: 12px; color: #b0b8c7; padding: 10px 18px 3px; margin-top: 4px; border-top: 1px dashed #e4e9f2; }
  .m-menu a { display: block; padding: 11px 18px; color: #333; font-size: 14px; text-decoration: none; }
  .m-menu a:active { background: #f0f4fc; }
  .m-menu a.active { background: #e8f0fe; color: #2f6fed; box-shadow: inset 3px 0 0 #2f6fed; }

  /* 主体改纵向：左侧子菜单变成顶部横向滑动的胶囊菜单 */
  .main { flex-direction: column; padding: 0 12px; max-width: none; }
  .sidebar { width: 100%; padding: 10px 0 0; display: flex; align-items: center; gap: 6px;
             overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .sg-title, .sidebar .sg-sub { display: none; }
  .sidebar a { white-space: nowrap; flex-shrink: 0; margin: 0; padding: 6px 12px; font-size: 13px;
               background: #fff; border: 1px solid #e2e8f2; border-radius: 15px; }
  .sidebar a:hover { background: #e8eefb; color: #2f6fed; }
  .sidebar a.active { background: #2f6fed; border-color: #2f6fed; color: #fff; }
  .content { padding: 10px 0 30px; }

  /* 内容区留白压缩 */
  .wrap { padding: 12px 0 24px !important; max-width: none !important; }
  .card { padding: 14px 12px !important; border-radius: 8px; }
  .panel { padding: 12px !important; }
  h2 { font-size: 17px; }

  /* 筛选区：两列自适应，控件占满整格 */
  .filters { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 10px !important; align-items: end; }
  .filters .cell { width: auto !important; min-width: 0; }
  .filters .cell-wide { grid-column: 1 / -1; }
  .filters input, .filters select { width: 100% !important; min-width: 0; }
  .filters .range { display: flex; }
  .filters .range input { flex: 1; min-width: 0; }
  .filters .zd-btn { width: 100% !important; max-width: none !important; }
  /* 日期段（起止日期同一行）+ 快捷区间按钮一行排开 */
  .filters .dran { display: flex; gap: 6px; width: 100%; }
  .filters .dran input { flex: 1 1 0; width: auto !important; min-width: 0; padding: 7px 4px; font-size: 12px; }
  .filters .dran .sep { color: #bbb; }
  .filters .quick { display: flex; gap: 5px; width: 100%; }
  .filters .quick button { flex: 1 1 0; min-width: 0; padding: 7px 2px; font-size: 12px; }
  .btnrow { flex-wrap: wrap; }
  .btnrow .stat { margin-left: 0; width: 100%; }

  /* 表格：由 layout.js 包一层 .tbl-scroll，宽表横向滑动 */
  .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-scroll table { min-width: 100%; }

  /* 底部统计条/分页允许换行 */
  .statbar { font-size: 12px; }
  .statbar .pg { margin-left: 0; }

  /* 驾驶舱统计卡：窄屏收窄数值字号 */
  .cards { gap: 10px; }
  .cs-item .v { font-size: 22px; }

  /* 常见双列汇总布局在手机上收为单列；列内元素允许收缩（否则按表格最小宽撑破容器） */
  .grid2 { grid-template-columns: 1fr !important; gap: 14px !important; }
  .grid2 > *, .grid3 > * { min-width: 0; }

  /* 弹窗（新建/编辑方案等）：改为贴边全宽，表单收为单列 */
  .modal {
    left: 10px !important; right: 10px !important; top: 10px !important; bottom: 10px !important;
    width: auto !important; max-width: none !important; max-height: none !important;
    margin: 0 !important; padding: 16px !important;
    transform: none !important; border-radius: 10px !important;
    overflow-y: auto !important; -webkit-overflow-scrolling: touch;
  }
  .modal h3 { font-size: 16px !important; margin: 0 0 12px !important; }
  .modal .fgrid, .modal .form { grid-template-columns: 1fr !important; gap: 10px !important; }
  .modal .fgrid > *, .modal .form > * { grid-column: auto !important; min-width: 0; }
  .modal .zdbox { max-height: 30vh; overflow-y: auto; }
  .modal .modal-foot, .modal .foot { flex-wrap: wrap; }
  .modal .modal-foot button, .modal .foot button { flex: 1; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr !important; }
}
