/* ============================================================
   育正法则 · 全局移动端补丁 mobile-patch v1 (2026-09-05)
   由 nginx sub_filter 注入所有 Flask 渲染页面（含 portal 壳页与 iframe 模块子页）
   原则：只做保守修复 —— 不改桌面端、不破坏各页自有样式
   ============================================================ */

/* ---- 全局：宽表格横向滚动包装（JS 会把超宽表格包进 .mpt-wrap） ---- */
.mpt-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 1;
}
.mpt-wrap table { margin: 0; }

img, video { max-width: 100%; height: auto; }

/* ---- 汉堡按钮（style.css 已有 .menu-toggle，这里作未引 style.css 页面的兜底） ---- */
.menu-toggle {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #2563eb;
  display: none;
  padding: 4px 8px;
  flex-shrink: 0;
}
/* 无顶栏页面用的浮动汉堡 */
.mp-float-burger {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1001;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, .35);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  font-size: 20px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1f2937;
  padding: 0;
}
.mp-float-burger.mp-on { display: inline-flex; }

/* 抽屉打开时的遮罩 */
.mp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
body.mp-nav-open { overflow: hidden; }
body.mp-nav-open .mp-overlay { opacity: 1; pointer-events: auto; }

/* ============================================================
   ≤768px 移动端
   ============================================================ */
@media (max-width: 768px) {

  .menu-toggle { display: block; }

  /* 侧栏抽屉层级高于遮罩；.active 打开（style.css 已有，此处兜底 + 层级） */
  .sidebar { z-index: 999; }
  .sidebar.active { transform: translateX(0) !important; }

  /* ---- portal 壳页顶栏紧凑化（JS 检测到壳结构后给 body 打 mp-shell） ---- */
  body.mp-shell .topbar {
    height: auto;
    min-height: 52px;
    padding: 8px 12px;
    gap: 8px;
  }
  body.mp-shell .topbar-left {
    min-width: 0;
    flex: 1 1 auto;
  }
  body.mp-shell .topbar-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.mp-shell .topbar-breadcrumb { display: none; }
  body.mp-shell .topbar-right {
    font-size: 12px;
    gap: 6px;
    flex-shrink: 0;
  }
  body.mp-shell .content-dashboard { padding: 14px; }

  /* 筛选工具行：允许换行，输入框弹性收缩 */
  .filter-row { flex-wrap: wrap; row-gap: 8px; }
  .filter-row > input,
  .filter-row > select,
  .filter-row > .search-box,
  .filter-row > .search-input {
    flex: 1 1 140px;
    min-width: 0;
    width: auto;
  }
}
