/* ==========================================================================
   校园墙 · 后台管理 样式表
   路径：/admin/assets/admin.css
   --------------------------------------------------------------------------
   视觉规范 1:1 对齐参考项目「外卖卷包 / admin」的后台（Ant Design 风格）：
     侧栏 228px（品牌 58px + 扁平图标菜单）/ 主区顶栏 58px（页面标题 + 右侧操作）
     / 内容区 24px 内边距 / 卡片 6px 圆角 + 16px 20px 内边距 + 1px 边框
     / 表格全边框（th 底 #fafafa）/ 按钮 7px 14px 圆角 6px / 输入框 36px 圆角 6px
     / 徽标圆角 12px / 主色 #1677ff / 背景 #f0f2f5

   兼容策略：页面里已在用的类名（.card/.btn/.form-grid/.table-wrap/.badge/
   .flash/.tabs/.stat-card/...）全部保留，换皮不需要改页面。
   ========================================================================== */

:root {
  --primary: #1677ff;
  --primary-hover: #4096ff;
  --primary-light: #e6f4ff;
  --bg: #f0f2f5;
  --card: #fff;
  --text: #333;
  --text2: #555;
  --muted: #8c8c8c;
  --text3: #8c8c8c;
  --border: #e8e8e8;
  --border-strong: #d9d9d9;
  --danger: #ff4d4f;
  --danger-light: #fff2f0;
  --success: #52c41a;
  --success-light: #f6ffed;
  --warning: #faad14;
  --warning-light: #fffbe6;
  --sidebar-active: #e6f4ff;
  --header-h: 58px;
  --sider-w: 228px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
body.admin-body { height: 100vh; max-height: 100vh; overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .code {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text2);
}

/* ==========================================================================
   1. 壳层：侧栏 + 主区（顶栏 / 内容）
   ========================================================================== */
.layout-shell { display: flex; min-height: 100vh; }

.layout-sider {
  width: var(--sider-w);
  min-width: var(--sider-w);
  height: 100vh;
  max-height: 100vh;
  background: #fff;
  padding: 0 0 12px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden; /* 由内部 nav 滚动，避免长菜单被 body 裁掉 */
}
.layout-sider .brand {
  height: var(--header-h);
  min-height: var(--header-h);
  max-height: var(--header-h);
  flex: 0 0 var(--header-h);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--border);
}
.layout-sider .brand .brand-logo {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
}
.layout-sider .brand .brand-logo svg { width: 100%; height: 100%; display: block; }
.layout-sider .brand .brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 菜单区滚动：flex:1 + min-height:0 是关键，否则长菜单不出现滚动条 */
.layout-sider nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.layout-sider nav::-webkit-scrollbar { width: 6px; }
.layout-sider nav::-webkit-scrollbar-track { background: transparent; }
.layout-sider nav::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
.layout-sider nav::-webkit-scrollbar-thumb:hover { background: #bfbfbf; }
.layout-sider nav { scrollbar-width: thin; scrollbar-color: #d9d9d9 transparent; }

/* 侧栏分组：可折叠（父行 = 图标 + 名称 + 箭头；子项缩进） */
.menu-group { margin: 2px 0; }
.menu-group-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  transition: background .2s, color .2s;
}
.menu-group-hd:hover { background: #fafafa; color: var(--primary); }
.menu-group-hd .menu-hd-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-group-hd .menu-hd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-group-hd .nav-icon-svg { width: 20px; height: 20px; opacity: .78; }
.menu-group-hd .caret { width: 14px; height: 14px; flex-shrink: 0; opacity: .55; transition: transform .2s; }
/* 当前页所在分组的父行：只用主色提示，不加粗（加粗会显得只有一个分组特别粗） */
.menu-group-hd.on { color: var(--primary); }
.menu-group-hd.on .nav-icon-svg { opacity: 1; }
.menu-group-hd.on .caret { opacity: .8; }
.menu-group.open > .menu-group-hd .caret { transform: rotate(180deg); }
.menu-sub { display: none; padding: 0 0 6px; }
.menu-group.open > .menu-sub { display: block; }
/* 子菜单：图标与大菜单标题文字对齐（nav 8px + 42px = 50px，正好是父项标题的起点）
   字体与图标保持和父项一致（15px / 20px），只把行距收紧一点
   ⚠ 必须带 .layout-sider nav 前缀，否则会被上面的 `.layout-sider nav .nav-item`（0,2,1）压过 */
.layout-sider nav .menu-sub .nav-item {
  padding: 9px 12px 9px 42px;
  color: var(--text2);
  font-size: 15px;
}
.layout-sider nav .menu-sub .nav-item .nav-icon-svg { width: 20px; height: 20px; opacity: .72; }

/* 兼容旧写法（早期版本用的是小灰标题） */
.nav-group-title {
  margin: 8px 0 2px;
  padding: 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.layout-sider nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  padding: 11px 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  border-radius: var(--radius);
  transition: background .2s, color .2s;
}
.layout-sider nav .nav-item > span { line-height: 1; }
.layout-sider nav .nav-item:hover { color: var(--primary); background: #fafafa; }
.layout-sider nav .nav-item.on { color: var(--primary); background: var(--sidebar-active); }
.layout-sider nav .nav-item svg { display: block; flex-shrink: 0; }
.layout-sider nav .nav-item .nav-icon-svg { width: 20px; height: 20px; opacity: .75; }
.layout-sider nav .nav-item.on .nav-icon-svg,
.layout-sider nav .nav-item:hover .nav-icon-svg { opacity: .95; }
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.layout-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  max-height: 100vh;
  overflow: hidden;
}
.layout-header {
  flex-shrink: 0;
  height: var(--header-h);
  min-height: var(--header-h);
  max-height: var(--header-h);
  flex: 0 0 var(--header-h);
  box-sizing: border-box;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 20;
}
.layout-header .page-title { font-size: 18px; font-weight: 600; color: var(--text); }
.layout-header .header-right { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--muted); }
.layout-header .header-logout { color: var(--primary); font-size: 14px; }
.layout-header .header-logout:hover { color: var(--primary-hover); text-decoration: underline; }
.layout-content { flex: 1; min-height: 0; padding: 24px; overflow: auto; position: relative; z-index: 1; }

/* 兼容旧壳层类名（历史页面/预览） */
.layout { display: flex; min-height: 100vh; }
.main, .top { display: flex; }
.content { padding: 24px; }

/* 管理范围切换（沿用 POST 表单结构，样式对齐参考的下拉按钮） */
.switch-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin: 0;
  max-width: 240px;
}
.switch-box:hover { border-color: var(--primary); }
.switch-box .muted { font-size: 13px; color: var(--muted); white-space: nowrap; }
.switch-box select {
  width: auto;
  min-width: 120px;
  max-width: 180px;
  height: 34px;
  margin: 0;
  padding: 0 20px 0 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8c8c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 14px 14px;
}
.switch-box select:focus { outline: none; }

/* 账号下拉（点击展开，与参考一致） */
.admin-dd { position: relative; }
.admin-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  line-height: 1;
}
.admin-dd-btn:hover { border-color: var(--primary); color: var(--primary); }
.admin-avatar-icon { width: 18px; height: 18px; opacity: .85; }
.admin-dd-caret { width: 16px; height: 16px; opacity: .7; }
.admin-dd-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
}
.admin-dd-menu.show { display: block; }
.admin-dd-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}
.admin-dd-menu a:hover { background: #fafafa; color: var(--primary); }
.admin-dd-menu a svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ==========================================================================
   2. 页面卡片（内容区：一张卡 + 渐变标题条，对齐参考的内页）
   ========================================================================== */
.page-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.page-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 20px;
  background: linear-gradient(90deg, #1677ff 0%, #6d31c1 100%);
  color: #fff;
}
.page-card-title { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.page-card-tools { display: flex; align-items: center; gap: 8px; }
.page-card-tools .btn,
.page-card-tools .btn-ghost,
.page-card-tools .btn-default {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .16);
  color: #fff !important;
  padding: 5px 12px;
  font-size: 13px;
}
.page-card-tools .btn:hover { background: rgba(255, 255, 255, .28); border-color: #fff; }
.page-card-body { padding: 16px 20px 20px; }

/* 卡内标签行（图标 + 文字 + 蓝色下划线，对齐参考的卡内 Tab） */
.card-tabs {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  overflow-x: auto;
}
.card-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  color: var(--text2);
  font-size: 15px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.card-tab svg { width: 18px; height: 18px; flex-shrink: 0; }
.card-tab:hover { color: var(--primary); }
.card-tab.on { color: var(--primary); font-weight: 500; border-bottom-color: var(--primary); }

/* 页面卡片内的直属卡片去掉自身边框与内边距，变成「分区」；有标题的分区用下边框分隔 */
.page-card-body > .card {
  border: 0;
  padding: 0;
  margin: 0 0 20px;
  border-radius: 0;
}
.page-card-body > .card:last-child { margin-bottom: 0; }
.page-card-body .card-hd,
.page-card-body .card-toolbar {
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-card-body .card-hd h3,
.page-card-body .card-toolbar h3 { font-size: 15px; }
.page-card-body > .card > h3:first-child {
  font-size: 15px;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   3. 卡片（页面卡片内部 / 独立使用）
   ========================================================================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.card h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; color: var(--text); }
.card > h3 { font-size: 16px; margin: 0 0 16px; }
.card-tight { padding: 12px 16px; }
.card-toolbar, .card-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-toolbar h3, .card-hd h3 { font-size: 16px; font-weight: 600; margin: 0; }
.card-toolbar-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.card-toolbar-actions, .page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-desc { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.sec-title {
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.sec-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { font-size: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stat-card .k { color: var(--muted); font-size: 13px; }
.stat-card .v { font-size: 26px; font-weight: 600; line-height: 1.3; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-card .v.ok { color: var(--success); }
.stat-card .v.off { color: var(--muted); }
.stat-card .d { color: var(--muted); font-size: 12px; }

/* ==========================================================================
   3. 按钮（.btn = 主按钮，等价参考的 .btn-primary；.btn-ghost = 参考的默认 .btn）
   ========================================================================== */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff !important;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff !important; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost, .btn-default { background: #fff; border-color: var(--border); color: var(--text) !important; }
.btn-ghost:hover, .btn-default:hover { border-color: var(--primary); color: var(--primary) !important; background: #fff; }
.btn-muted { background: #e4e6eb; border-color: #e4e6eb; color: #909399 !important; }
.btn-muted:hover { background: #d8dae0; border-color: #d8dae0; color: #6b7280 !important; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff !important; }
.btn-danger:hover { background: #ff7875; border-color: #ff7875; color: #fff !important; }
.btn-ok, .btn-success { background: var(--success); border-color: var(--success); color: #fff !important; }
.btn-ok:hover, .btn-success:hover { background: #73d13d; border-color: #73d13d; }
.btn-sm, .btn-small { padding: 4px 10px; font-size: 12px; }
.btn-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary) !important;
  font-size: 13px;
}
.btn-link:hover { background: none; color: var(--primary-hover) !important; text-decoration: underline; }

/* 工具栏 / 筛选行 / 表单行 / 表格里的按钮：与输入框同高（36px），否则按钮比输入框矮一截 */
.card-toolbar-actions > .btn,
.card-toolbar-actions > .btn-ghost,
.card-toolbar-actions > .btn-default,
.card-toolbar-actions > .btn-ok,
.card-toolbar-actions > .btn-success,
.card-toolbar-actions > .btn-danger,
.page-actions > .btn,
.page-actions > .btn-ghost,
.filter-bar > .btn,
.filter-actions > .btn,
.form-inline > .btn,
.form-actions > .btn,
.table-wrap td > .btn:not(.btn-sm),
.table-wrap td > form > .btn:not(.btn-sm),
.table-wrap td > div > .btn:not(.btn-sm) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  line-height: 1;
}

/* ==========================================================================
   4. 表格（对齐参考 table.data：全边框 + th 灰底 + 行 hover）
   ========================================================================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin: 8px 0 14px;
}
/* 表格基础样式统一由第 15 节（material_management.php 原值）提供，此处不再重复定义边框/表头 */
.table-wrap input, .table-wrap select, .table-wrap textarea { max-width: none; width: 100%; min-width: 0; }
.table-wrap input[type="checkbox"], .table-wrap input[type="radio"] { width: auto; min-width: 0; }
.table-wrap .btn { width: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap, th.nowrap { white-space: nowrap; }
.table-empty-tip { text-align: center !important; color: var(--muted); padding: 40px 12px !important; }
.table-empty-box { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 14px; }

.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline-block; margin: 0 6px 4px 0; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.pager-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-btns .btn { min-width: 32px; padding: 4px 10px; }
.pager-btns .page-num.on { background: var(--primary); border-color: var(--primary); color: #fff !important; }

/* ==========================================================================
   5. 表单
   ========================================================================== */
label { display: block; margin: 0 0 6px; font-size: 13px; color: var(--muted); }
input:not([type]),
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="email"], input[type="url"], input[type="search"],
input[type="tel"], select, textarea {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  min-width: 120px;
  max-width: 100%;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  transition: border-color .2s;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
select {
  padding-right: 32px;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8c8c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; min-width: 0; margin: 0; accent-color: var(--primary); cursor: pointer; }
input[type="file"] { height: auto; padding: 6px 0; border: 0; }
input[readonly], input[disabled], select[disabled], textarea[disabled] { background: #f5f5f5; color: var(--muted); }

/* 表单字段流：定宽字段并排（对齐参考 .form-inline-row 的做法），长字段整行；
   所有短字段宽度一致，避免「两列 430px + 整行 930px」参差 */
.form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-start;
  max-width: none;
}
.form-grid > .form-row,
.form-grid > .form-check {
  flex: 0 0 340px;
  width: 340px;
  max-width: 100%;
  margin-bottom: 0;
}
.form-grid.form-grid-3 > .form-row,
.form-grid.form-grid-3 > .form-check { flex: 0 0 260px; width: 260px; }
/* 表单里没有包装的裸控件（例如学校列表的行内表单）也按定宽排 */
.form-grid > input,
.form-grid > select,
.form-grid > textarea { flex: 0 0 340px; width: 340px; }
.form-grid > .full { flex: 1 1 100%; width: 100%; }
.form-grid > .form-row.full { flex: 1 1 100%; width: 100%; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; max-width: none; }
/* 整行字段的输入框封顶，避免 1100px 的超长输入框 */
.form-grid > .form-row.full > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-grid > .form-row.full > select,
.form-grid > .form-row.full > textarea,
.form-grid > input.full,
.form-grid > select.full,
.form-grid > textarea.full { max-width: 720px; }
.form-grid textarea { min-height: 96px; }
.form-row { margin-bottom: 16px; }
.form-row.full { width: 100%; }
.form-row > label { margin-bottom: 6px; }
.form-row .hint, .form-row .muted { margin: 6px 0 0; }
.form-check { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 14px; cursor: pointer; }
.form-check input { flex: none; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-inline input, .form-inline select { width: auto; min-width: 120px; max-width: 220px; }
.form-inline > input, .form-inline > select, .form-inline > .btn { height: 36px; }
.table-wrap td input, .table-wrap td select { height: 36px; }
.input-sm { height: 30px; font-size: 13px; padding: 0 8px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* 开关（Ant Design 风格） */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: #bfbfbf;
  border-radius: 11px;
  transition: background .2s;
  cursor: pointer;
}
.switch .slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ==========================================================================
   6. 徽标 / 状态 / 标签
   ========================================================================== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  background: #f4f4f5;
  color: var(--muted);
}
.badge-soft { background: var(--primary-light); color: var(--primary); }
.badge-primary { background: var(--primary); color: #fff; }
.badge-ok { background: #f0f9eb; color: var(--success); }
.badge-warn { background: var(--warning-light); color: #d48806; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-muted { background: #f4f4f5; color: var(--muted); }

.tag {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  color: var(--text2);
  font-size: 12px;
  line-height: 20px;
}
.tag-chip {
  display: inline-block;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 30px;
}
.tag-chip.on, .tag-chip.picked { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
}
.status-1 { background: #f0f9eb; color: var(--success); }
.status-0 { background: #f4f4f5; color: var(--muted); }
.status-2 { background: var(--danger-light); color: var(--danger); }
.status-3 { background: var(--warning-light); color: #d48806; }
.st { color: #d48806; font-size: 12px; }
.st.ex { color: var(--danger); }

/* .tabs 用于筛选条（对齐参考的筛选控件：白底描边，选中变蓝） */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; border: 0; align-items: center; }
.tabs a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}
.tabs a:hover { color: var(--primary); border-color: var(--primary); }
.tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tabs a.active:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

/* 分段控件（对齐参考的「其他小程序 / 本小程序」两颗大按钮） */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.segmented a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
}
.segmented a svg { width: 16px; height: 16px; }
.segmented a:hover { color: var(--primary); border-color: var(--primary); }
.segmented a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.segmented a.on:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

/* 筛选行右侧的主操作按钮组（新增分类=绿，新增小程序=蓝） */
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* 筛选条（select / input + 主按钮），页面可直接用 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { height: 36px; min-width: 140px; }
.filter-bar .btn { height: 36px; }

/* 分页（对齐参考：上一页 / 当前页 / 下一页 / 页码输入 + 跳转） */
.pager-jump { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.pager-jump input { width: 56px; min-width: 0; height: 30px; text-align: center; padding: 0 6px; }

/* ==========================================================================
   7. 提示条 / 键值 / 折叠 / 图片
   ========================================================================== */
.flash {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-ok { background: var(--success-light); border-color: #b7eb8f; color: #389e0d; }
.flash-err { background: var(--danger-light); border-color: #ffccc7; color: #cf1322; }
.flash-warn { background: var(--warning-light); border-color: #ffe58f; color: #d48806; }
.flash-info { background: var(--primary-light); border-color: #91caff; color: #0958d9; }
.muted, .hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.hint strong, .muted strong { color: var(--text2); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.details-box { margin: 8px 0 12px; }
.details-box summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.details-box .body { font-size: 13px; color: var(--text2); line-height: 1.6; word-break: break-all; margin: 8px 0 0; }

.avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #fafafa; border: 1px solid var(--border); display: block; }
.thumb { width: 48px; height: 48px; border-radius: var(--radius); object-fit: cover; background: #fafafa; border: 1px solid var(--border); display: block; }
.thumb-lg { width: 88px; height: 88px; }
.icon-preview {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-block;
  vertical-align: middle;
}
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.grid-auto > .card { margin-bottom: 0; }
@media (max-width: 900px) { .grid-auto { grid-template-columns: 1fr; } }

.avatar-preview { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0 16px; align-items: flex-end; }
.avatar-preview .item { text-align: center; }
.avatar-preview img, .avatar-preview .avatar-svg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #fafafa;
  border: 1px solid var(--border);
  object-fit: cover;
  display: block;
  overflow: hidden;
  margin: 0 auto;
}
.avatar-preview .avatar-svg svg { width: 100%; height: 100%; display: block; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; max-width: 720px; }
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }
.color-swatch-tip { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, .12);
  vertical-align: -3px;
  margin-right: 6px;
}
.swatch-blue { background: #1677ff; }
.swatch-teal { background: #13c2c2; }
.swatch-pink { background: #eb2f96; }
.swatch-rose { background: #ff4d4f; }
.swatch-orange { background: #fa8c16; }

/* 顶栏到期提醒（对齐参考 .pwd-expire-alert） */
.alert-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #ffccc7;
  border-radius: 8px;
  background: var(--danger-light);
  color: #cf1322;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  box-sizing: border-box;
  max-width: 300px;
}
.alert-bell:hover { border-color: #ff7875; background: #ffe7e6; color: #a8071a; }
.alert-bell .dot {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.alert-pop {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 320px;
  max-height: 340px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
  padding: 4px;
  font-weight: 400;
}
.alert-bell:hover .alert-pop, .alert-bell:focus-within .alert-pop { display: block; }
.alert-pop a { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--text); font-size: 12px; }
.alert-pop a:hover { background: #fafafa; }

/* ==========================================================================
   8. 工具类
   ========================================================================== */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.w-auto { width: auto; }
.max-w-md { max-width: 520px; }
.max-w-lg { max-width: 760px; }
.max-h-180 { max-height: 180px; overflow: auto; }
.nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* ==========================================================================
   9. 登录页（不走壳层）
   ========================================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 20px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.login-card label { margin-top: 12px; }
.login-card input { width: 100%; max-width: none; }
.login-card .btn { display: block; width: 100%; height: 36px; margin-top: 18px; }
.login-foot { margin-top: 14px; color: var(--muted); font-size: 12px; }

/* ==========================================================================
   10. 响应式
   ========================================================================== */
@media (max-width: 900px) {
  body.admin-body { height: auto; max-height: none; overflow: auto; }
  .layout-shell { flex-direction: column; }
  .layout-sider { width: 100%; min-width: 0; height: auto; max-height: none; min-height: 0; overflow: visible; border-right: 0; border-bottom: 1px solid var(--border); }
  .layout-sider nav { flex: none; min-height: 0; max-height: none; overflow: visible; }
  .layout-main { max-height: none; overflow: visible; }
  .layout-header { height: auto; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .layout-content { padding: 12px; overflow: visible; }
  .form-grid, .form-grid-3 { display: block; }
  .form-grid > .form-row,
  .form-grid > .form-check,
  .form-grid.form-grid-3 > .form-row,
  .form-grid.form-grid-3 > .form-check,
  .form-grid > input,
  .form-grid > select,
  .form-grid > textarea,
  .form-grid > .full,
  .form-grid > .form-row.full { width: 100%; flex: none; margin-bottom: 14px; }
  .form-grid > .form-row.full > input,
  .form-grid > .form-row.full > textarea { max-width: 100%; }
  .kv { grid-template-columns: 100px 1fr; }
  .header-right { flex-wrap: wrap; }
}

/* ==========================================================================
   13. 与参考项目同名组件（外卖卷包 / admin）
   —— 类名与参考一一对应，直接沿用参考的 HTML 片段也能正确渲染。
   ========================================================================== */

/* 内页容器与操作按钮 */
.admin-inner-page, .admin-ip-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.admin-inner-page > h2, .admin-ip-panel > h2 { margin: 0 0 16px; font-size: 16px; font-weight: 600; color: var(--text); }
.admin-ip-btn {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}
.admin-ip-btn:hover { border-color: var(--primary); color: var(--primary); }

/* 表单字段（参考写法） */
.form-inline-row { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; }
.form-field { margin-bottom: 14px; min-width: 0; }
.form-field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.form-field-spacer { display: block; visibility: hidden; font-size: 13px; line-height: 1.4; margin: 0; height: 19px; }

/* 区块标题 + 右侧操作 */
.head, .head-actions { display: flex; align-items: center; gap: 10px; }
.head { justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.head h2, .head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.head-action-btn, .btn-light {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}
.head-action-btn:hover, .btn-light:hover { border-color: var(--primary); color: var(--primary); }
.btn-jump {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff !important;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}
.btn-jump:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.arrow { width: 12px; height: 12px; opacity: .7; }

/* 筛选区（下拉 + 按钮） */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.filter-dd { position: relative; display: inline-flex; }
.filter-dd-btn, .filter-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.filter-dd-btn:hover, .filter-select:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.filter-btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.filter-dd-menu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
}
.filter-dd-menu.show { display: block; }
.filter-dd-menu button {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.filter-dd-menu button:hover { background: #fafafa; color: var(--primary); }
.filter-dd-menu button.is-active, .filter-dd-menu .current { color: var(--primary); background: var(--primary-light); }
.filter-dd-menu.menu-hovering button.is-active { background: transparent; color: var(--text); }
.filter-dd-menu.menu-hovering button.is-active:hover { background: #fafafa; color: var(--primary); }

/* 通用状态类（参考页面直接在用） */
.is-active, .current { color: var(--primary); }
.disabled { opacity: .5; cursor: not-allowed; }
.notice { color: var(--muted); font-size: 13px; line-height: 1.5; }
.label { color: var(--muted); font-size: 13px; }
.container { width: 100%; }

/* 顶栏小程序下拉（参考 .tenant-dd*） */
.tenant-dd { position: relative; }
.tenant-dd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  max-width: 220px;
}
.tenant-dd-btn:hover { border-color: var(--primary); color: var(--primary); }
.tenant-icon, .tenant-dd-caret { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.tenant-label { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-dd-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  max-height: 320px;
  overflow: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 120;
}
.tenant-dd-menu.show { display: block; }
.tenant-dd-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); font-size: 14px; }
.tenant-dd-menu a:hover { background: #fafafa; color: var(--primary); }
.tenant-dd-menu a.current { color: var(--primary); background: var(--primary-light); }
.pwd-expire-alert-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 分页（参考 .pagination / .pg-*） */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pg-group { display: inline-flex; align-items: center; gap: 6px; }
.pg-prev, .pg-next, .pg-num {
  display: inline-block;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 30px;
  text-align: center;
}
.pg-prev:hover, .pg-next:hover, .pg-num:hover { color: var(--primary); border-color: var(--primary); }
.pg-num.current, .pg-num.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg-num.disabled, .pg-prev.disabled, .pg-next.disabled { opacity: .5; cursor: not-allowed; }
.pg-ellipsis { padding: 0 4px; color: var(--muted); }
.pg-jump { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.pg-jump input { width: 56px; min-width: 0; height: 30px; padding: 0 6px; text-align: center; }

/* 参考的侧栏图标尺寸微调 */
.nav-icon-tenant, .nav-icon-material, .nav-icon-online-shop, .nav-icon-couponsearch {
  width: 20px;
  height: 20px;
  opacity: .85;
}

/* 参考的主表格类名：样式统一由第 15 节提供，这里只保留类名占位说明 */
/* table.data 的边框/表头见第 15 节（th, td, table.data th, table.data td） */

/* ==========================================================================
   * 弹窗组件（sub-mass-mask / sub-mass-modal）：照抄 外卖卷包/admin/ad_management.php
   ========================================================================== */
.sub-mass-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 22000;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.sub-mass-mask.show { display: flex; }
.sub-mass-modal {
  width: 560px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #dfe4ee; border-radius: 14px;
  box-shadow: 0 18px 45px rgba(20, 33, 61, .18); overflow: hidden;
}
.sub-mass-modal.lg { width: 680px; }
.sub-mass-modal-head {
  height: 56px; flex: 0 0 auto; padding: 0 20px;
  border-bottom: 1px solid #e8ebf2;
  background: linear-gradient(180deg, #f9fbff 0%, #ffffff 100%);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sub-mass-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: #1f2a44; }
.sub-mass-close {
  width: 32px; height: 32px; border: none; border-radius: 8px; background: #f2f4f8;
  font-size: 22px; color: #7d8799; cursor: pointer; line-height: 1;
}
.sub-mass-close:hover { background: #e8ecf3; color: #4b5563; }
.sub-mass-modal-body {
  flex: 1 1 auto; padding: 18px 22px 8px; overflow: auto; background: #fbfcff;
}
.sub-mass-modal-foot {
  flex: 0 0 auto; padding: 12px 22px 16px; border-top: 1px solid #e8ebf2;
  background: #fff; display: flex; justify-content: flex-end; gap: 8px;
}
.sub-mass-modal-body .field { margin-bottom: 14px; }
.sub-mass-modal-body .field label {
  display: block; margin-bottom: 6px; color: #2f3b52; font-size: 13px; font-weight: 500;
}
.sub-mass-modal-body .field .hint { margin-top: 4px; font-size: 12px; color: var(--muted); }
.sub-mass-modal-body .field input,
.sub-mass-modal-body .field select,
.sub-mass-modal-body .field textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; font-size: 14px;
}
.sub-mass-modal-body .field textarea { height: auto; min-height: 80px; padding: 8px 12px; }
.sub-mass-modal-body .field-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px;
}
@media (max-width: 640px) {
  .sub-mass-modal-body .field-grid { grid-template-columns: 1fr; }
}
.sub-mass-modal-body .field.wide { grid-column: 1 / -1; }
.sub-mass-modal-body .form-check {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 14px; color: var(--text2);
}
.sub-mass-modal-body .form-check input { width: auto; height: auto; }
body.modal-open { overflow: hidden; }

/* 学校列表筛选框 + 行内按钮（数据取自 外卖卷包/admin/material_management.php） */
.tenants-filters .tenants-filter-input,
.tenants-filters .tenants-filter-select {
  height: 34px;
  min-width: 160px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #374151;
  box-sizing: border-box;
}
.tenants-filters .tenants-filter-input:hover,
.tenants-filters .tenants-filter-select:hover { border-color: #9ca3af; }
.tenants-filters .tenants-filter-input:focus,
.tenants-filters .tenants-filter-select:focus {
  outline: none;
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, .12);
}

.ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ops form { margin: 0; }
/* 行内操作按钮统一 36px / 圆角 8（对齐参考 tenants.php 的 .btn）；
   不要与下面的 .table-wrap td > div > .btn 规则打架，否则同一排按钮两种高度 */
.ops .btn {
  height: 36px;
  min-height: 36px;
  min-width: 48px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* 紧凑小按钮（参考 .btn-small） */
.ops .btn.btn-small, .ops .btn.btn-sm {
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}
.btn.mm-op-edit {
  background: #1890ff !important;
  border: 1px solid #1890ff !important;
  color: #fff !important;
}
.btn.mm-op-edit:hover {
  background: #40a9ff !important;
  border-color: #40a9ff !important;
  color: #fff !important;
}
.btn.mm-op-del {
  background: #ff4d4f !important;
  border: 1px solid #ff4d4f !important;
  color: #fff !important;
}
.btn.mm-op-del:hover {
  background: #ff7875 !important;
  border-color: #ff7875 !important;
  color: #fff !important;
}
.btn.mm-op-muted {
  background: #f3f4f6 !important;
  border: 1px solid #d1d5db !important;
  color: #374151 !important;
}
.btn.mm-op-muted:hover {
  background: #e5e7eb !important;
  border-color: #c4c9d1 !important;
  color: #111827 !important;
}

/* 表格单元格单行省略 + 必填红星（替代内联 style） */
.cell-ellipsis { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req { color: #ff4d4f; }

/* ==========================================================================
   15. 以 外卖卷包/admin/material_management.php 为唯一标准（1:1 移植，全局生效）
   —— 数值逐条抄自该文件 <style> 块（第 905~1780 行），其它页面一律以本节为准。
   ========================================================================== */

/* 15.1 页面卡片与标题条（.container / .head） */
.page-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  overflow: hidden;
}
.page-card-hd {
  height: 55px;
  min-height: 55px;
  padding: 0 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.page-card-title { font-size: 18px; font-weight: 700; }

/* 15.2 按钮基类与配色（.btn / .btn-primary / .btn-success / .btn-light） */
.btn {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.btn, .btn-primary { background: #1890ff; border-color: #1890ff; color: #fff !important; }
.btn:hover, .btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff !important; }
.btn-ok, .btn-success { background: #22c55e; border-color: #22c55e; color: #fff !important; }
.btn-ok:hover, .btn-success:hover { background: #16a34a; border-color: #16a34a; color: #fff !important; }
.btn-danger { background: #ff4d4f; border-color: #ff4d4f; color: #fff !important; }
.btn-danger:hover { background: #ff7875; border-color: #ff7875; color: #fff !important; }
.btn-ghost, .btn-default, .btn-light {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151 !important;
}
.btn-ghost:hover, .btn-default:hover, .btn-light:hover { background: #e5e7eb; border-color: #c4c9d1; color: #111827 !important; }
.btn-sm, .btn-small { height: 30px; min-height: 30px; padding: 0 10px; border-radius: 6px; font-size: 13px; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }

/* 15.3 工具栏 / 表单行里的按钮：与参考 .btn 一致 34px（覆盖早先的 36px 规则） */
.card-toolbar-actions > .btn,
.card-toolbar-actions > .btn-ghost,
.card-toolbar-actions > .btn-default,
.card-toolbar-actions > .btn-ok,
.card-toolbar-actions > .btn-success,
.card-toolbar-actions > .btn-danger,
.page-actions > .btn,
.page-actions > .btn-ghost,
.filter-bar > .btn,
.filter-actions > .btn,
.form-inline > .btn,
.form-actions > .btn,
.table-wrap td > .btn:not(.btn-sm),
.table-wrap td > form > .btn:not(.btn-sm),
.table-wrap td > div > .btn:not(.btn-sm) {
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
}

/* 15.4 行内操作按钮（.ops）：全部统一 34px / padding 0 14px / 圆角 6
   —— 与参考 .btn（编辑/删除）同尺寸，避免同一排出现大小不一致 */
.ops { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; white-space: nowrap; min-height: 34px; }
.ops form { margin: 0; }
.ops .btn {
  height: 34px;
  min-height: 34px;
  min-width: 48px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.mm-op-move {
  height: 30px;
  min-height: 30px;
  min-width: 48px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #fff !important;
  background: #64748b;
  cursor: pointer;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}
.mm-op-move:hover:not(:disabled) { background: #475569; }
.mm-op-move:disabled { opacity: .45; cursor: not-allowed; }
.mm-op-move:disabled:hover { background: #64748b; }

/* 15.5 筛选行（.filters） */
.filters, .filter-bar { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input, .filters select, .tenants-filter-input, .tenants-filter-select {
  height: 34px;
  min-width: 160px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}

/* 15.6 分类 / 筛选按钮（.cat-tabs / .tab-btn，等价于我们的 .tabs a） */
.tabs a, .tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 92px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  text-decoration: none;
}
.tabs a.active, .tabs a.on, .tab-btn.on {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
  font-weight: 700;
}

/* 15.7 卡内标签行（.main-tabs / .main-tab） */
.card-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  background: #fff;
  padding: 0 16px;
  overflow-x: auto;
}
.card-tab {
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 22px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.card-tab svg { width: 20px; height: 20px; }
.card-tab:hover { color: #1677ff; }
.card-tab.on, .card-tab.active { color: #1677ff; border-bottom-color: #1677ff; z-index: 1; }

/* 15.8 表格（.table-wrap / table / th,td / th） */
.table-wrap {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  overflow-x: hidden;
  margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
/* ⚠ 必须先 border:0 清掉旧规则的四边框，否则左右相邻边框叠加成 2px（看着有的粗有的细）；
   table.data th/td 也要一起覆盖（旧规则比单写 th,td 更具体） */
th, td, table.data th, table.data td {
  border: 0;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #374151;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}
/* 表头：背景 #f8fafc + 字重 600 + 文字 #374151（material_management.php 原值）
   把 .table-wrap th / table.data th / thead th 都列上，避免被更具体的选择器抢走 */
th, table.data th, .table-wrap th, .table-wrap thead th, table.data thead th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
}
th:last-child, td:last-child { border-right: none; }
/* 最后一行不画下边框（容器边框兜住），其余行分隔线 = 单元格 border-bottom（折叠后就是 1px） */
tbody tr:last-child > td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
/* 表格里的小控件不再铺满单元格（参考表格单元格只放文字/胶囊/按钮） */
.table-wrap input:not([type="checkbox"]):not([type="radio"]), .table-wrap select { max-width: 100%; min-width: 0; }

/* 15.9 胶囊徽标 / 状态 / 缩略图（.mp-type 为参考唯一形态：26px 实心圆角 + 白字 700） */
.mp-type, .badge, .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #6b7280;
}
.mp-type.in, .badge-ok, .badge-primary, .badge-soft, .status-1 { background: #22c55e; }
.mp-type.out, .badge-soft { background: #1890ff; }
.badge-soft { background: #1890ff; }
.status-0, .badge-muted { background: #e5e7eb; color: #6b7280; }
.status-2, .badge-danger { background: #ff4d4f; }
.status-3, .badge-warn { background: #faad14; }
.status-on { color: #16a34a; }
.status-off { color: #6b7280; }
.thumb { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; border: 1px solid #e5e7eb; background: #fff; }

/* 15.10 学校列表列宽（照参考的 nth-child 定宽写法，避免 table-layout:fixed 等分导致操作列太窄）
   操作列给足宽度放 4 个按钮，后台账号列吃掉剩余空间 */
#tenantTable th:nth-child(1), #tenantTable td:nth-child(1) { width: 80px; max-width: 80px; }
#tenantTable th:nth-child(2), #tenantTable td:nth-child(2) { width: 220px; max-width: 220px; }
#tenantTable th:nth-child(3), #tenantTable td:nth-child(3) { width: 90px; max-width: 90px; }
#tenantTable th:nth-child(4), #tenantTable td:nth-child(4) { width: 90px; max-width: 90px; }
#tenantTable th:nth-child(5), #tenantTable td:nth-child(5) { width: auto; }
#tenantTable th:nth-child(6), #tenantTable td:nth-child(6) { width: 330px; max-width: 330px; }
#tenantTable td:nth-child(6) { padding: 10px 6px; }
#tenantTable td:nth-child(6) .ops { justify-content: flex-start; }
