/* 管理端视觉规整与美化 */

/* 管理首页（克制规整风格） */
.dash-welcome { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid #eef0f4; border-radius: 14px; padding: 20px 24px; margin-bottom: 18px; box-shadow: 0 3px 14px rgba(15,23,42,.035); }
.dash-welcome-icon { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; background: #eef2ff; color: #4f46e5; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.dash-welcome-text { flex: 1; min-width: 0; }
.dash-welcome-text h2 { margin: 0; font-size: 18px; font-weight: 700; color: #1f2937; }
.dash-welcome-text p { margin: 4px 0 0; font-size: 13px; color: #64748b; }
.dash-welcome-date { font-size: 12px; color: #94a3b8; background: #f8fafc; border: 1px solid #eef0f4; border-radius: 99px; padding: 6px 14px; white-space: nowrap; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dash-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dash-shortcut { display: flex; align-items: center; gap: 11px; padding: 13px 14px; background: #fff; border: 1px solid #eef0f4; border-radius: 10px; font-size: 13px; font-weight: 600; color: #334155; cursor: pointer; text-align: left; transition: .15s; }
.dash-shortcut:hover { border-color: #c7d2fe; background: #f8faff; transform: translateY(-1px); }
.sc-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sc-icon.blue { background: #eff6ff; color: #2563eb; }
.sc-icon.violet { background: #f5f3ff; color: #7c3aed; }
.sc-icon.green { background: #ecfdf5; color: #059669; }
.sc-icon.orange { background: #fff7ed; color: #ea580c; }
.dash-info .info-row + .info-row { margin-top: 4px; }
.dash-info .info-value { font-size: 13px; word-break: break-all; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } .dash-welcome { flex-wrap: wrap; padding: 16px; } .dash-welcome-date { width: 100%; text-align: center; } }

/* 通讯录顶部（企业微信风格） */
.wx-contact-head { background: #fff; border: 1px solid #eef0f4; border-radius: 14px; padding: 18px 22px; margin-bottom: 18px; box-shadow: 0 3px 14px rgba(15,23,42,.035); }
.wx-contact-title { font-size: 18px; font-weight: 750; color: #1f2937; margin-bottom: 14px; }
.wx-contact-title span { font-size: 13px; font-weight: 500; color: #94a3b8; }
.wx-contact-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wx-contact-actions .btn { border-radius: 8px; padding: 7px 14px; }
.wx-contact-actions .btn.primary { background: #2563eb; }
.wx-contact-actions .btn.primary:hover { background: #1d4ed8; }
.danger-text { color: #dc2626 !important; }
.wx-dropdown { position: relative; }
.wx-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(15,23,42,.12); min-width: 150px; padding: 5px; }
.wx-dropdown-menu.open { display: block; }
.wx-dropdown-menu button { display: block; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; font-size: 13px; border-radius: 6px; cursor: pointer; }
.wx-dropdown-menu button:hover { background: #f1f5f9; }

/* 成员可修改字段 */
.self-edit-panel { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.self-edit-head { flex: 0 0 220px; }
.self-edit-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.self-edit-toggle { border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; margin-left: 6px; }
.self-edit-toggle:hover { text-decoration: underline; }
.self-edit-box { flex: 1; min-width: 260px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fafbfc; }
.self-edit-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.self-edit-values { font-size: 14px; font-weight: 600; }
.self-edit-edit { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.self-edit-edit label { font-size: 13px; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.hidden { display: none !important; }

/* 统一卡片与标题 */
.main-content .card { border-radius: 14px; box-shadow: 0 3px 14px rgba(15,23,42,.035); }
.main-content .panel { padding: 20px 22px; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.btn { border-radius: 8px; }
input, textarea, select { border-radius: 8px; }

@media (max-width: 640px) {
  .dash-hero { padding: 18px; }
  .dash-greeting { font-size: 19px; }
  .dash-shortcuts { grid-template-columns: 1fr; }
  .wx-contact-head { padding: 14px; }
  .wx-contact-actions .btn { flex: 1 1 auto; font-size: 12px; }
  .self-edit-panel { gap: 12px; }
}


/* 待签任务查询字段配置 */
.self-query-config { margin-bottom: 18px; }
.self-query-fields { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.sq-field { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.sq-field b { font-weight: 650; }
.sq-field span { color: var(--muted); font-size: 12px; }
.sq-hint { font-size: 13px; color: var(--green); }
@media (max-width: 640px) { .self-query-fields { gap: 10px; } .sq-field span { display: none; } }


/* 组织架构选人器 */
.tp-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.tp-modal { width: 100%; max-width: 820px; max-height: 86vh; background: #fff; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(15,23,42,.25); }
.tp-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.tp-head h3 { margin: 0; font-size: 16px; }
.tp-close { border: 0; background: none; font-size: 24px; color: #94a3b8; cursor: pointer; line-height: 1; }
.tp-body { flex: 1; display: grid; grid-template-columns: 240px 1fr; min-height: 360px; overflow: hidden; }
.tp-tree { border-right: 1px solid var(--line); overflow-y: auto; background: #fafbfc; padding: 12px 0; user-select: none; -webkit-user-select: none; }
.tp-tree *, .tp-node * { user-select: none; -webkit-user-select: none; outline: none !important; }
.tp-tree ::selection { background: transparent; }
.tp-tree-title { font-size: 12px; font-weight: 700; color: #64748b; padding: 0 14px 10px; }
.tp-node { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; padding-left: calc(9px + var(--depth, 0) * 16px); cursor: pointer; font-size: 13px; outline: none !important; user-select: none; box-sizing: border-box; border-left: 3px solid transparent; height: 36px; }
.tp-node:hover { background: #f1f5f9; }
.tp-node:focus, .tp-node:focus-visible, .tp-node:active { outline: none !important; box-shadow: none !important; }
.tp-node.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); }
.tp-node-label { display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tp-caret { flex: 0 0 14px; display: inline-block; color: #94a3b8; font-size: 11px; text-align: center; cursor: pointer; border-radius: 4px; line-height: 16px; }
.tp-caret:hover { color: var(--accent); background: #e8eef7; }
.tp-caret.empty { width: 14px; cursor: default; background: none; }
.tp-node-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-node-count { font-size: 11px; color: #94a3b8; flex: 0 0 auto; }
.tp-right { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px; }
.tp-toolbar { display: flex; gap: 10px; align-items: center; }
.tp-toolbar input { flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.tp-count { font-size: 12px; color: #94a3b8; white-space: nowrap; }
.tp-select-all { font-size: 12px; color: #64748b; padding: 10px 2px 6px; }
.tp-select-all label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tp-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.tp-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid #eef0f3; border-radius: 9px; cursor: pointer; font-size: 13px; }
.tp-row:hover { background: #f8fafc; border-color: #dbe3ee; }
.tp-person { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tp-person b { font-weight: 650; }
.tp-person small { color: #94a3b8; font-size: 11px; }
.tp-dept { margin-left: auto; color: #64748b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.tp-empty { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 13px; }
.tp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.tp-selected { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-actions { display: flex; gap: 8px; flex: 0 0 auto; }
@media (max-width: 640px) {
  .tp-overlay { padding: 6px; }
  .tp-modal { max-height: 94vh; }
  .tp-body { grid-template-columns: 1fr; }
  .tp-tree { max-height: 140px; border-right: 0; border-bottom: 1px solid var(--line); }
  .tp-foot { flex-direction: column; align-items: stretch; }
  .tp-actions .btn { flex: 1; }
}


/* 活动参与人员名单 */
.event-members { margin-top: 8px; }
.em-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.em-chip { display: inline-block; background: #eff6ff; color: #2563eb; border-radius: 99px; padding: 3px 10px; font-size: 12px; }
.em-clear { border: 0; background: none; color: #dc2626; font-size: 12px; cursor: pointer; margin-top: 8px; }


/* ==================== 管理端手机端深度适配 ==================== */
@media (max-width: 760px) {
  /* 布局：侧栏变顶部横向导航，主内容独占全宽 */
  .app-shell { flex-direction: column !important; display: block !important; }
  .sidebar { position: sticky !important; top: 0; width: 100% !important; height: auto !important; bottom: auto !important; z-index: 30; padding: 8px 10px !important; box-shadow: 0 2px 12px rgba(15,23,42,.12); }
  .sidebar-brand, .sidebar-label, .sidebar-foot { display: none !important; }
  .side-nav { flex-direction: row !important; flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .nav-tab { flex: 0 0 auto !important; width: auto !important; white-space: nowrap; padding: 9px 11px !important; font-size: 12px; border-radius: 9px; gap: 5px; }
  .side-nav .nav-tab > span:not(.nav-icon):not(.nav-arrow) { white-space: nowrap; }
  .side-nav .nav-icon { display: inline !important; font-size: 14px; }
  .main-area { margin-left: 0 !important; width: 100%; }
  .main-head { position: static; height: auto; padding: 14px 14px !important; }
  .head-title { font-size: 19px; }
  .head-sub { font-size: 11px; word-break: break-all; }
  .head-date { display: none; }
  .main-content { padding: 14px 12px 40px !important; }
  .stats-row { padding: 0 !important; grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .stat-card { padding: 13px !important; }
  .stat-num { font-size: 22px !important; }
  .stat-label { font-size: 11px !important; }

  /* 卡片与栅格 */
  .section-grid, .dash-grid, .contacts-layout, .mail-layout { grid-template-columns: 1fr !important; gap: 12px; }
  .panel, .card { padding: 15px 14px !important; border-radius: 12px !important; }
  .panel-head { margin-bottom: 13px; }
  .panel-head h2 { font-size: 15px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .field-row { flex-direction: column !important; gap: 0; }
  .field { width: 100%; }
  .field input, .field select, .field textarea { width: 100%; font-size: 16px; }
  .btn { min-height: 38px; }
  .btn-block { width: 100%; }

  /* 表格：横向滚动，防止撑破页面 */
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .contact-table, .people-table { min-width: 620px; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 任务卡片 */
  .task-head { flex-direction: column; gap: 12px; }
  .task-title { flex-wrap: wrap; }
  .task-actions { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  .task-actions .btn { flex: 1 1 44%; }
  .signer-item { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* 通讯录树 */
  .contacts-layout .tree-panel { position: static !important; max-height: 220px; overflow: auto; }

  /* 弹窗：几乎全屏 */
  .modal-card { width: calc(100vw - 20px) !important; max-height: 92vh; overflow-y: auto; padding: 18px 14px !important; border-radius: 14px !important; }
  .modal-card.wide { width: calc(100vw - 16px) !important; }
  .modal-actions-row { flex-wrap: wrap; }
  .modal-actions-row .btn { flex: 1 1 45%; }
  .perm-list { max-height: 45vh; overflow-y: auto; }

  /* 登录页 */
  .login-view { padding: 16px !important; align-items: flex-start !important; }
  .login-card { width: 100% !important; padding: 22px 18px !important; margin-top: 4vh; }
  .login-card h1 { font-size: 21px; }
  .role-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .role-card { padding: 12px !important; }
  .role-card small { display: block; }
  .brand-logo { width: 42px; height: 42px; }
}
@media (max-width: 480px) {
  .stats-row { gap: 8px; }
  .stat-card { padding: 11px !important; gap: 9px; }
  .stat-icon { width: 32px; height: 32px; font-size: 15px; }
  .app-grid { grid-template-columns: repeat(4, 1fr); }
  .dash-shortcuts { grid-template-columns: 1fr 1fr !important; }
  .tp-modal { max-height: 94vh; }
  .tp-body { grid-template-columns: 1fr !important; }
  .tp-tree { max-height: 120px; border-right: 0; border-bottom: 1px solid var(--line); }
}


/* 通知公告 */
.ann-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.ann-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; }
.ann-main { flex: 1; min-width: 0; }
.ann-title { font-size: 14px; font-weight: 650; color: #1f2937; }
.ann-content { font-size: 12px; color: #64748b; margin-top: 5px; white-space: pre-wrap; word-break: break-word; }
.ann-meta { font-size: 11px; color: #94a3b8; margin-top: 7px; }


/* 首页最近任务 */
.dash-recent { margin-top: 18px; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid #eef0f4; border-radius: 10px; background: #fff; cursor: pointer; text-align: left; font-size: 13px; transition: .15s; }
.recent-item:hover { background: #f8faff; border-color: #c7d2fe; }
.recent-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.recent-icon.blue { background: #eff6ff; color: #2563eb; }
.recent-icon.violet { background: #f5f3ff; color: #7c3aed; }
.recent-icon.green { background: #ecfdf5; color: #059669; }
.recent-name { flex: 1; min-width: 0; font-weight: 600; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-type { flex: 0 0 auto; font-size: 11px; color: #64748b; background: #f1f5f9; border-radius: 99px; padding: 3px 9px; }
.recent-date { flex: 0 0 auto; font-size: 11px; color: #94a3b8; }
@media (max-width: 640px) { .recent-date { display: none; } .recent-item { padding: 9px 10px; } }


/* 管理员模块权限 */
.am-box { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.am-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; cursor: pointer; }
.am-item:hover { background: #f8fafc; }
.am-item b { font-weight: 600; }
/* 自定义字段 */
.cf-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cf-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.cf-row .cf-label { flex: 1 1 140px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; }
.cf-row .cf-type, .cf-row .cf-options { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; }
.cf-row .cf-options { flex: 1 1 160px; }
.cf-visible { display: flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.cf-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.cf-add-row input[type=text], .cf-add-row select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; }
.cf-add-row #cfNewLabel { flex: 1 1 160px; }


/* 表格任务详情入口 */
.sheet-detail-link { color: #1e293b; text-decoration: none; font-weight: 700; }
.sheet-detail-link:hover { color: #4f46e5; text-decoration: underline; }
.sheet-card-hint { margin-top: 10px; padding: 9px 12px; border-radius: 8px; background: #f8fafc; font-size: 12px; color: #64748b; border: 1px dashed #dbe3ee; }


.wm-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 12px; cursor: pointer; }
.wm-fields, .wm-custom-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; }
.wm-fields select, .wm-custom-fields select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }


/* 日志查看 */
.log-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 12px; align-items: center; }
.log-tab { border: 0; background: none; padding: 8px 14px; font-size: 13px; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.log-tab.active { color: #0891b2; border-bottom-color: #0891b2; }
.log-list { max-height: 62vh; overflow-y: auto; display: flex; flex-direction: column; }
.log-row { display: flex; gap: 12px; padding: 10px; border-bottom: 1px solid #f1f5f9; font-size: 12px; align-items: center; }
.log-row:hover { background: #f8fafc; }
.log-at { flex: 0 0 140px; color: #94a3b8; font-family: monospace; }
.log-who { flex: 0 0 130px; font-weight: 600; color: #4f46e5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-page { flex: 0 0 110px; color: #0891b2; }
.log-action { flex: 1; color: #334155; word-break: break-all; }
@media (max-width: 640px) { .log-row { flex-wrap: wrap; gap: 4px; } .log-at, .log-who { flex: 1 1 100%; } }


/* 徽章统一改为描边（outline）样式 */
.badge { background: transparent !important; border: 1px solid currentColor; height: 22px; padding: 0 9px; }
.badge.pending, .badge.closed { color: #64748b !important; background: transparent !important; border-color: #cbd5e1 !important; }
.badge.completed, .badge.signed, .badge.open { color: #16a34a !important; background: transparent !important; border-color: #86efac !important; }
.badge.partial, .badge.ready { color: #d97706 !important; background: transparent !important; border-color: #fcd34d !important; }
.badge.closed { color: #94a3b8 !important; border-color: #cbd5e1 !important; }


/* ============ 管理首页 UI 重设计 ============ */
#pageHome .dash-welcome { background: linear-gradient(110deg, #eef2ff 0%, #f5f3ff 55%, #ecfeff 100%); border: 1px solid #dfe6f5; position: relative; overflow: hidden; }
#pageHome .dash-welcome::after { content: ''; position: absolute; right: 6%; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(99,102,241,.14), transparent 70%); }
#pageHome .dash-welcome-icon { background: #fff; color: #4f46e5; box-shadow: 0 4px 12px rgba(79,70,229,.15); }
#pageHome .dash-welcome-text h2 { background: none; font-size: 19px; }
#pageHome .stat-card { transition: .18s; cursor: default; }
#pageHome .stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,23,42,.08); }
#pageHome .dash-grid { grid-template-columns: 1fr 1fr; }
#pageHome .dash-shortcut { border-radius: 10px; }
#pageHome .dash-shortcut:hover { transform: translateY(-1px); }
.dash-recent { margin-top: 18px; }
.dash-settings { margin-top: 18px; background: #fff; border: 1px solid #eef0f4; border-radius: 14px; padding: 0 20px; box-shadow: 0 3px 14px rgba(15,23,42,.035); }
.dash-settings > summary { cursor: pointer; padding: 15px 0; font-size: 14px; font-weight: 700; color: #334155; list-style: none; display: flex; align-items: center; gap: 8px; }
.dash-settings > summary::-webkit-details-marker { display: none; }
.dash-settings > summary::before { content: '▸'; color: #94a3b8; transition: .15s; }
.dash-settings[open] > summary::before { transform: rotate(90deg); }
.dash-settings > summary .muted { font-size: 12px; font-weight: 400; }
.dash-settings-body { padding-bottom: 18px; }
.dash-settings-body .panel { box-shadow: none; }
@media (max-width: 900px) { #pageHome .dash-grid { grid-template-columns: 1fr; } }


.log-head { display: flex; gap: 12px; padding: 8px 10px; font-size: 11px; color: #94a3b8; font-weight: 700; border-bottom: 1px solid #eef0f4; }
.log-head span:nth-child(1) { flex: 0 0 140px; }
.log-head span:nth-child(2) { flex: 0 0 130px; }
.log-head span:nth-child(3) { flex: 0 0 110px; }
.log-head span:nth-child(4) { flex: 1; }
@media (max-width: 640px) { .log-head { display: none; } }
/* 徽章：方框（非圆角胶囊） */
.badge { border-radius: 4px !important; }
