/* ====== 主容器 ====== */
#appMain { display: none; height: 100vh; flex-direction: column; background: var(--bg); }

/* 右侧主内容容器（PC端占满剩余空间） */
.app-main-right {
  display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0;
  height: 100vh;
}
@media (min-width: 768px) {
  .app-main-right { height: 100vh; }
}

/* 顶部Header - 公共页头 */
.app-header {
  height: var(--header-height); background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 100; flex-shrink: 0;
}

/* ====== 页头左侧：用户信息区（参考图片风格） ====== */
.header-user-zone {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 8px; border-radius: 8px; transition: background 0.2s; flex: 1; min-width: 0;
}
.header-user-zone:active { background: var(--bg-grey); }
/* 蓝色圆角标签（用户名首字） */
.header-name-tag {
  flex-shrink: 0;
  background: #E6F2FF; color: #3370ff;
  font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px;
  line-height: 1;
}
.header-user-info { flex: 1; min-width: 0; }
.header-username {
  font-size: 15px; font-weight: 700; color: #222;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3;
}
.header-enterprise {
  font-size: 11px; color: #888; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ====== 企业切换弹窗 ====== */
.enterprise-popup {
  position: absolute; top: calc(var(--header-height) - 1px); left: 8px;
  background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  width: 280px; max-height: 420px; overflow: hidden; z-index: 200;
  border: 1px solid var(--border-light);
  display: flex; flex-direction: column;
}
.enterprise-popup-title {
  font-size: 12px; font-weight: 600; color: var(--text-hint);
  padding: 12px 16px 8px; border-bottom: 1px solid var(--border-light);
}
.enterprise-popup-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.enterprise-popup-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer;
  transition: background 0.2s;
}
.enterprise-popup-item:active { background: var(--bg-grey); }
.enterprise-popup-item.current { background: var(--primary-light); }
.enterprise-popup-item .ep-logo {
  width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3370ff, #5b9cff);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.enterprise-popup-item .ep-info { flex: 1; min-width: 0; }
.enterprise-popup-item .ep-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enterprise-popup-item .ep-role { font-size: 11px; color: var(--text-hint); }
.enterprise-popup-item .ep-check { color: var(--primary); font-size: 14px; }
.enterprise-popup-footer {
  display: flex; border-top: 1px solid var(--border-light); padding: 8px; gap: 4px;
}
.enterprise-popup-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; font-size: 11px; color: var(--text-secondary); background: none;
  border-radius: 8px; transition: background 0.2s;
}
.enterprise-popup-btn:active { background: var(--bg-grey); }
.enterprise-popup-btn i { font-size: 16px; color: var(--primary); }

/* ====== 页头右侧：搜索 + 消息 + 新建 ====== */
.header-right-zone { display: flex; align-items: center; gap: 8px; flex-shrink: 0; position: relative; }
/* 搜索按钮（浅灰色圆角） */
.header-search-btn {
  display: flex; align-items: center; gap: 4px;
  background: #F5F5F7; border-radius: 8px; padding: 6px 10px;
  cursor: pointer; transition: background 0.2s; font-size: 13px; color: #888;
}
.header-search-btn:active { background: #E8E8ED; }
.header-search-btn i { font-size: 13px; }
/* 圆形+按钮 */
.header-add-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid #222; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.header-add-btn:active { background: #222; }
.header-add-btn:active i { color: #fff; }
.header-add-btn i { font-size: 14px; color: #222; }
/* 消息铃铛 */
.header-icon-btn {
  width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s; position: relative;
}
.header-icon-btn:active { background: var(--bg-grey); }
.header-icon-btn i { font-size: 18px; color: var(--text-secondary); }
.header-icon-btn:active i { color: var(--primary); }

/* ====== 功能列表弹窗 ====== */
.header-menu-popup {
  position: absolute; top: calc(var(--header-height) - 1px); right: 8px;
  background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  width: 300px; max-height: 400px; overflow-y: auto; z-index: 200;
  border: 1px solid var(--border-light); padding: 12px;
}
.header-menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; }
.header-menu-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border-radius: 8px; cursor: pointer; transition: background 0.2s;
}
.header-menu-item:active { background: var(--bg-grey); }
.header-menu-item .hm-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.header-menu-item .hm-label { font-size: 11px; color: var(--text-secondary); text-align: center; }

/* ====== 搜索弹窗 ====== */
.header-search-popup {
  position: absolute; top: calc(var(--header-height) - 1px); right: 8px;
  background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  width: 300px; max-height: 400px; overflow-y: auto; z-index: 200;
  border: 1px solid var(--border-light); padding: 12px;
}
.header-search-popup input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-light);
  border-radius: 8px; font-size: 14px; outline: none;
}
.header-search-popup input:focus { border-color: var(--primary); }
.header-search-results { margin-top: 8px; }
.header-search-result-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 8px;
  border-radius: 8px; cursor: pointer; transition: background 0.2s;
}
.header-search-result-item:active { background: var(--bg-grey); }
.header-search-result-item i { font-size: 16px; color: var(--primary); }
.header-search-result-item span { font-size: 14px; color: var(--text); }

/* 内容区 */
.app-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; padding-bottom: var(--tab-height);
}

/* ====== 底部4Tab导航 - 钉钉风格 ====== */
.bottom-tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--tab-height); background: #fff;
  display: flex; z-index: 200; padding-bottom: var(--safe-bottom);
  box-shadow: 0 -1px 0 var(--border-light);
}
.bottom-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: var(--text-hint);
  font-size: 10px; background: none; transition: all 0.25s ease; position: relative;
  padding-top: 4px;
}
.bottom-tab i { font-size: 22px; transition: all 0.25s ease; }
.bottom-tab.active { color: var(--primary); }
.bottom-tab.active i { transform: scale(1.08); }
.bottom-tab .badge {
  position: absolute; top: 2px; right: calc(50% - 18px);
  min-width: 16px; height: 16px; background: var(--danger);
  color: #fff; font-size: 10px; border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ====== Tab页面容器 ====== */
.tab-page { display: none; height: 100%; flex-direction: column; }
.tab-page.active { display: flex; }

/* ====== 工作台Tab ====== */
.work-tabs {
  display: flex; background: #fff; border-bottom: 1px solid var(--border-light);
  overflow-x: auto; flex-shrink: 0; -webkit-overflow-scrolling: touch;
  padding: 0 8px;
}
.work-tab {
  padding: 12px 18px; font-size: 14px; color: var(--text-secondary);
  white-space: nowrap; background: none; border-bottom: 2px solid transparent; transition: all 0.25s;
  font-weight: 500;
}
.work-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.work-content { flex: 1; overflow-y: auto; padding: 12px 16px 80px; }

/* 工作台 - 功能入口网格 */
.work-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; padding: 8px 0; }
.work-grid-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; transition: transform 0.2s ease;
}
.work-grid-item:active { transform: scale(0.9); }
.work-grid-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.work-grid-item:active .work-grid-icon { box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.work-grid-label { font-size: 12px; color: var(--text-secondary); text-align: center; font-weight: 500; }
.work-section-title {
  font-size: 15px; font-weight: 600; color: var(--text); margin: 20px 0 10px; padding-left: 2px;
  display: flex; align-items: center; gap: 8px;
}
.work-section-title::before {
  content: ''; width: 3px; height: 16px; background: var(--primary); border-radius: 2px;
}
.work-section-title:first-child { margin-top: 0; }
.work-section-desc {
  font-size: 12px; color: var(--text-hint); margin: -6px 0 10px; padding-left: 13px; line-height: 1.5;
}

/* ====== 管理页面 - 制度/规则卡片 ====== */
.gov-section-title {
  font-size: 15px; font-weight: 600; color: var(--text); margin: 20px 0 10px; padding-left: 2px;
  display: flex; align-items: center; gap: 8px;
}
.gov-section-title::before {
  content: ''; width: 3px; height: 16px; background: var(--primary); border-radius: 2px;
}
.gov-section-title:first-child { margin-top: 0; }
.gov-card {
  background: #fff; border-radius: 12px; border: 1px solid var(--border-light);
  overflow: hidden;
}
.gov-card-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border-light);
}
.gov-card-item:last-child { border-bottom: none; }
.gov-card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.gov-card-head b { font-size: 14px; color: var(--text); }
.gov-card-head i { font-size: 16px; }
.gov-card-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0;
}
.gov-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gov-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--primary-light); color: var(--primary);
}

/* 时间线 */
.gov-timeline { position: relative; padding-left: 4px; }
.gov-timeline-item {
  position: relative; padding: 0 0 20px 24px; padding-left: 24px;
}
.gov-timeline-item::before {
  content: ''; position: absolute; left: 5px; top: 16px; bottom: 0;
  width: 2px; background: var(--border-light);
}
.gov-timeline-item:last-child::before { display: none; }
.gov-timeline-dot {
  position: absolute; left: 0; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--border-light);
}
.gov-timeline-content b { font-size: 13px; color: var(--text); display: block; margin-bottom: 4px; }
.gov-timeline-content p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* 日志条目 */
.gov-log-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px !important; }
.gov-log-action { font-size: 13px; color: var(--text); font-weight: 500; }
.gov-log-meta { font-size: 11px; color: var(--text-hint); }

/* 空状态 */
.empty-mini { font-size: 13px; color: var(--text-hint); padding: 12px 16px; text-align: center; }
