* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: #f0f2f5; color: #333; }

/* 登录 */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center;
  /* 2026-10-08 用户需求：背景与登录后界面色调相仿（浅灰主色调，弱渐变） */
  background: linear-gradient(135deg,#f5f6f8,#eef1f4 55%,#e8ecef); }
.login-box { background: #fff; padding: 40px; border-radius: 10px; width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.login-box h2 { text-align: center; color: #046c4e; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #888; font-size: 12px; margin-bottom: 20px; }
.login-box input { width: 100%; padding: 11px 12px; margin-bottom: 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; }
.login-box .err { color: #e74c3c; font-size: 13px; height: 18px; text-align: center; }
.login-tabs { display: flex; margin-bottom: 16px; border-bottom: 2px solid #eee; }
.login-tabs button { flex: 1; padding: 10px 0; background: none; border: none; cursor: pointer;
  font-size: 14px; color: #888; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.login-tabs button.active { color: #046c4e; font-weight: bold; border-bottom-color: #046c4e; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; margin-bottom: 12px; }
.code-row .btn { flex-shrink: 0; padding: 0 12px; font-size: 13px; margin-bottom: 12px;
  border: 1px solid #046c4e; color: #046c4e; background: #fff; }
.code-row .btn:disabled { border-color: #d9d9d9; color: #aaa; cursor: not-allowed; }

/* 布局 */
.app { display: flex; height: 100vh; }
.sidebar { width: 210px; background: linear-gradient(170deg,#fafafa 0%,#f3f4f5 45%,#eaebed 100%); color: #33383d; display: flex; flex-direction: column; box-shadow: inset -1px 0 0 rgba(0,0,0,.07); }
.sidebar .logo { padding: 18px 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid rgba(0,0,0,.09); color: #1f2429; }
.menu { flex: 1; overflow-y: auto; padding: 10px 0; }
.menu-group { color: rgba(0,0,0,.42); font-size: 12px; padding: 12px 20px 6px; }
.menu-item { display: flex; align-items: center; padding: 11px 20px; cursor: pointer; font-size: 14px; color: #454b52; border-left: 3px solid transparent; transition: background .18s, color .18s; }
.menu-item:hover { background: rgba(255,255,255,.9); color: #1f2429; }
.menu-item.active { background: #fff; border-left-color: #0b9e66; color: #046c4e; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.09); }
.menu-item .icon { margin-right: 8px; width: 20px; text-align: center; flex: none; }
.menu-item .cnt { margin-left: auto; background: #ff4d4f; border-radius: 10px; font-size: 11px; padding: 1px 7px; }

.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.topbar .title { font-size: 17px; font-weight: bold; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.topbar .user { font-size: 13px; color: #555; }
.badge { background: #ff4d4f; color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }

.page-body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* 按钮 */
.btn { padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; }
.btn.primary { background: #046c4e; color: #fff; }
.btn.primary:hover { background: #0b9e66; }
.btn.light { background: #fff; border: 1px solid #d9d9d9; color: #333; }
.btn.success { background: #52c41a; color: #fff; }
.btn.danger { background: #ff4d4f; color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 13px; }

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 13px; }

/* 表格 */
table { width: 100%; background: #fff; border-collapse: collapse; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
th { background: #fafafa; color: #555; font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafcff; }
/* 长文本列截断：超宽内容单行显示，溢出省略号，悬停 title 看全文（详情/编辑弹窗仍为完整内容） */
td.cell-clip { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 关键列（状态/操作）不参与挤压：空间不足时浏览器优先压缩 cell-clip 内容列，
   这两列保持自身内容宽度不折行（极窄屏下宁可整表横向滚动也不破坏它们） */
td.cell-nowrap { white-space: nowrap; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.tag.待审批 { background: #fff7e6; color: #d48806; }
.tag.已通过 { background: #f6ffed; color: #389e0d; }
.tag.已驳回 { background: #fff1f0; color: #cf1322; }
.tag.已提交 { background: #e6f4ff; color: #0958d9; }   /* 不审核模块的提交终态（等同「已通过」的语义位） */
.tag.已发布 { background: #e6f4ff; color: #0958d9; }   /* 历史遗留词：旧数据兼容，样式与「已提交」一致 */
.tag.草稿 { background: #e6f4ff; color: #0958d9; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; margin-top: 14px; justify-content: flex-end; font-size: 13px; color: #666; }
.pager button { padding: 4px 12px; }

/* 卡片统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; padding: 18px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat-card .n { font-size: 26px; font-weight: bold; color: #046c4e; }
.stat-card .t { font-size: 13px; color: #888; margin-top: 4px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 10px; width: 560px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column; }
.modal-head { padding: 14px 20px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; font-weight: bold; }
.modal-head .x { border: none; background: none; font-size: 20px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; overflow-y: auto; }
.form-row { margin-bottom: 14px; }
/* 并排组：相邻同名 row_group 的字段同行显示（如「开始日期 / 结束日期」）；窄屏自动折行 */
.form-row-group { display: flex; gap: 12px; align-items: flex-start; }
.form-row-group > .form-col { flex: 1 1 0; min-width: 0; }
@media (max-width: 480px) { .form-row-group { flex-wrap: wrap; } .form-row-group > .form-col { flex-basis: 100%; } }
.form-row label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 9px 10px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; font-family: inherit; }
.form-row textarea { min-height: 70px; resize: vertical; }
.form-row input[readonly], .form-row input:disabled { background: #f5f5f5; color: #999; }
/* 多选复选框组（用户管理·角色多选）：横向流式排布，勾选框恢复原生尺寸 */
.check-group { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 4px 2px; }
.check-item { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #333; cursor: pointer; margin: 0; }
.check-item input[type="checkbox"] { width: auto; padding: 0; margin: 0; accent-color: #0b9e66; cursor: pointer; }
.check-item input[type="checkbox"]:disabled { cursor: not-allowed; }
/* 日期时间四级下拉（年/月/日/小时）单行排布：不换行、select 不撑满 */
.dt-row { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.dt-row select { width: auto; flex: 0 0 auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* 通知 */
.notify-item { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.notify-item:hover { background: #fafcff; }
.notify-item .t { font-size: 14px; }
.notify-item .d { font-size: 12px; color: #999; margin-top: 4px; }

/* 详情 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-item { background: #fafafa; padding: 10px 12px; border-radius: 6px; }
.detail-item .k { font-size: 12px; color: #888; }
.detail-item .v { font-size: 14px; margin-top: 3px; word-break: break-all; }

/* toast */
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; padding: 10px 22px; border-radius: 6px; font-size: 14px; z-index: 999; display: none; }
.empty { text-align: center; color: #aaa; padding: 60px 0; }

/* ================= 移动端适配（PWA） ================= */
/* 桌面端隐藏移动专用控件 */
.menu-toggle, .user-toggle { display: none; }
.topbar .left { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* 移动端抽屉遮罩 */
.sidebar-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; }

/* 移动端「更多」底部面板 */
.more-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: flex; align-items: flex-end; }
.more-sheet-box { width: 100%; background: #fff; border-radius: 14px 14px 0 0; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
.ms-item { display: block; width: 100%; text-align: center; padding: 15px 0; font-size: 16px; background: #fff; border: none; border-bottom: 1px solid #f0f0f0; color: #333; cursor: pointer; }
.ms-item.danger { color: #ff4d4f; }

@media (max-width: 768px) {
  /* 登录页：全宽卡片 */
  .login-box { width: calc(100% - 40px); max-width: 360px; padding: 28px 22px; }
  .login-box input, .code-row input { height: 46px; font-size: 16px; } /* 16px 防 iOS 聚焦缩放 */
  #loginBtn { height: 46px; font-size: 16px; }
  .code-row .btn { height: 46px; }

  /* 侧边栏 → 抽屉 */
  .app { height: 100dvh; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 70; width: 240px;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 2px 0 12px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar .menu-item { padding: 14px 20px; font-size: 15px; }
  .sidebar .menu-group { padding: 14px 20px 6px; }

  /* 顶栏：汉堡 + 标题 + 通知；其余收进「更多」 */
  .menu-toggle { display: inline-block; padding: 8px 13px; font-size: 18px; line-height: 1; }
  .user-toggle { display: inline-block; padding: 8px 13px; font-size: 18px; line-height: 1; }
  .topbar { padding: 0 12px; height: 56px; padding-top: env(safe-area-inset-top); }
  .topbar .title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .right { gap: 8px; }
  .hide-sm { display: none !important; }

  /* 内容区 */
  .page-body { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

  /* 表格：容器横向滚动，首列吸底不换行 */
  .page-body > * { min-width: 0; }
  .page-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 10px 10px; white-space: nowrap; }

  /* 弹窗：接近全屏、底部弹出 */
  .modal-box { width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 14px 14px 0 0;
    margin-top: auto; display: flex; flex-direction: column; }
  .modal { align-items: flex-end; }
  .modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-body input, .modal-body select, .modal-body textarea { font-size: 16px; }

  /* 工作台统计卡片两列 */
  .stats { grid-template-columns: repeat(2, 1fr) !important; display: grid; gap: 10px !important; }

  /* 触控目标 */
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; padding: 6px 12px; }
}

/* 安全区（iPhone 刘海/底部横条） */
@supports (padding: env(safe-area-inset-top)) {
  .sidebar { padding-top: env(safe-area-inset-top); }
}
