/* ===== 社会组织工作台 · 布局与组件 ===== */

/* 整体外壳：左栏 + 右主区，撑满视口高度 */
.wb { display: flex; min-height: 100vh; background: var(--bg); }

/* ---------- 左侧栏 ---------- */
.wb-side {
  width: 244px; flex: none; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.wb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--border);
}
.wb-brand-dot {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 20px;
  box-shadow: 0 4px 12px rgba(31,157,118,.25);
}
.wb-brand-txt { font-weight: 800; font-size: 16px; line-height: 1.25; color: var(--brand-dark); }

.wb-nav { flex: 1; overflow-y: auto; padding: 12px 12px 8px; }
.wb-nav-group {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-soft); text-transform: uppercase;
  padding: 14px 10px 6px;
}
.wb-nav-sub {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  color: var(--brand); opacity: .75;
  padding: 12px 12px 2px 22px; position: relative;
}
.wb-nav-sub::before {
  content: ""; position: absolute; left: 12px; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); transform: translateY(-50%);
}
.wb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  color: var(--text-soft); font-size: 14.5px; font-weight: 600;
  transition: .15s; user-select: none;
}
.wb-item:hover { background: var(--brand-light); color: var(--brand-dark); }
.wb-item.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(31,157,118,.22); }
.wb-ic { font-size: 17px; width: 20px; text-align: center; flex: none; }

.wb-side-foot { padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.wb-foot-link { color: var(--text-soft); font-size: 13px; text-decoration: none; }
.wb-foot-link:hover { color: var(--brand); }

/* 移动端遮罩 */
.wb-mask { display: none; position: fixed; inset: 0; background: rgba(20,40,35,.45); z-index: 35; }

/* ---------- 右侧主区 ---------- */
.wb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.wb-topbar {
  height: 62px; flex: none; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.wb-hamburger {
  display: none; border: 1px solid var(--border); background: #fff;
  width: 40px; height: 40px; border-radius: 10px; font-size: 18px; color: var(--text); cursor: pointer;
}
.wb-crumbs { font-size: 18px; font-weight: 800; color: var(--text); }
.wb-top-spacer { flex: 1; }
.wb-top-actions { display: flex; align-items: center; gap: 12px; }

.wb-icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 18px; cursor: pointer; transition: .15s;
}
.wb-icon-btn:hover { border-color: var(--brand); background: var(--brand-light); }

/* 设置下拉 */
.wb-setwrap { position: relative; }
.wb-setmenu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 200px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; z-index: 80; display: none;
}
.wb-setmenu.show { display: block; animation: fade .18s ease; }
.wb-set-title { font-size: 12px; color: var(--text-soft); padding: 8px 10px 4px; }
.wb-set-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 10px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer; text-decoration: none;
}
.wb-set-item:hover { background: var(--bg); color: var(--brand-dark); }

.wb-content { flex: 1; overflow-y: auto; padding: 24px 26px 48px; }
.wb-content .page { animation: none; }

/* ---------- 数据总览 ---------- */
.wb-welcome {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; border-radius: 16px; padding: 22px 24px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  box-shadow: 0 8px 24px rgba(31,157,118,.18);
}
.wb-welcome h2 { margin: 0 0 6px; font-size: 22px; }
.wb-welcome p { margin: 0; opacity: .92; font-size: 14px; }
.wb-welcome .wb-date { font-size: 13px; opacity: .85; }

.wb-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.wb-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.wb-stat .wb-stat-ic { font-size: 22px; }
.wb-stat .wb-stat-num { font-size: 30px; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.wb-stat .wb-stat-label { font-size: 13px; color: var(--text-soft); }
.wb-stat .wb-stat-sub { font-size: 12px; color: var(--text-soft); opacity: .8; }

.wb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; box-shadow: var(--shadow);
}
.wb-card h3 { margin: 0 0 14px; font-size: 16px; }

.wb-dist { display: flex; flex-direction: column; gap: 12px; }
.wb-dist-row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.wb-dist-name { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-bar-track { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.wb-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .5s ease; }
.wb-dist-num { text-align: right; color: var(--text-soft); font-weight: 600; }

.wb-recent { display: flex; flex-direction: column; gap: 2px; }
.wb-recent-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-radius: 9px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.wb-recent-item:last-child { border-bottom: 0; }
.wb-recent-item:hover { background: var(--bg); }
.wb-recent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.wb-recent-title { flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-recent-date { font-size: 12px; color: var(--text-soft); }
.wb-empty { color: var(--text-soft); text-align: center; padding: 30px 0; font-size: 14px; }

/* ---------- 收藏 ---------- */
.wb-fav-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.wb-fav-tabs button {
  border: 1px solid var(--border); background: #fff; color: var(--text-soft);
  padding: 8px 16px; border-radius: 999px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.wb-fav-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.wb-fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

/* ---------- 会员列表 / 资料 ---------- */
.wb-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.wb-table th, .wb-table td { padding: 12px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--border); }
.wb-table th { background: var(--bg); color: var(--text-soft); font-weight: 700; font-size: 13px; }
.wb-table tr:last-child td { border-bottom: 0; }
.wb-table .wb-av { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-light); color: var(--brand-dark); display: inline-grid; place-items: center; font-weight: 700; overflow: hidden; }
.wb-table .wb-av-img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; display: block; }

.wb-profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); max-width: 520px; }
.wb-profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.wb-profile-av { position: relative; overflow: hidden; width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.wb-profile-av.clickable { cursor: pointer; }
.wb-profile-av-img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; display: block; }
.wb-av-edit { position: absolute; right: -1px; bottom: -1px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; display: grid; place-items: center; pointer-events: none; }
.wb-av-prev, .wb-av-prev-empty { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; border: 0; padding: 0; }
.av-field { display: flex; align-items: center; gap: 14px; }
.av-field .av-prev-wrap { flex: 0 0 auto; }
.wb-profile-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.wb-profile-row:last-child { border-bottom: 0; }
.wb-profile-row .k { color: var(--text-soft); }
.wb-profile-row .v { font-weight: 600; }

/* ---------- 主题选择弹窗 ---------- */
.wb-theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0 4px; }
.wb-swatch {
  border: 2px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer;
  text-align: center; transition: .15s; background: #fff;
}
.wb-swatch:hover { border-color: var(--brand); }
.wb-swatch.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.wb-swatch .wb-sw-bar { height: 26px; border-radius: 8px; margin-bottom: 8px; }
.wb-swatch .wb-sw-name { font-size: 13px; font-weight: 600; color: var(--text); }
.wb-theme-custom { margin-top: 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.wb-theme-custom label { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.wb-theme-custom input[type="color"] { width: 44px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }

/* 关于我们 */
.wb-about-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.wb-about-list li { font-size: 14px; color: var(--text-soft); line-height: 1.7; }
.wb-about-list li b { color: var(--text); }

/* ---------- 响应式：WAP ---------- */
@media (max-width: 860px) {
  .wb-side {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.2);
  }
  .wb-side.open { transform: translateX(0); }
  .wb-mask.show { display: block; }
  .wb-hamburger { display: block; }
  .wb-main { height: auto; min-height: 100vh; overflow: visible; }
  .wb-content { overflow: visible; padding: 16px 14px 40px; }
  .wb-topbar { padding: 0 14px; }
  .wb-crumbs { font-size: 16px; }
  .wb-row { grid-template-columns: 1fr; }
  .wb-dist-row { grid-template-columns: 96px 1fr 38px; }
  .wb-about-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .wb-stat-grid { grid-template-columns: 1fr 1fr; }
  .wb-theme-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== AI 智能生成（统一：输入机构名称 → 一键生成 品牌/制度/项目） ===== */
/* 模块页宽度与「数据总览」主内容区保持一致（铺满右侧内容区，不再限宽 1040px） */
.gen-wrap { max-width: none; margin: 0; padding: 6px 2px 10px; }

.gen-hero {
  background: linear-gradient(135deg, var(--brand-dark, #157a5c), var(--brand, #1f9d76) 55%, var(--accent, #f2994a));
  border-radius: 18px; padding: 30px 26px; color: #fff;
  box-shadow: 0 12px 30px rgba(31,157,118,.22); margin-bottom: 18px;
}
.gen-hero-inner h1 { font-size: 26px; margin: 0 0 8px; font-weight: 800; letter-spacing: .5px; }
.gen-hero-inner > p { margin: 0 0 18px; opacity: .94; font-size: 15px; line-height: 1.6; }

.gen-input-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.gen-org { flex: 2 1 340px; }
.gen-project { flex: 1 1 220px; }
.gen-type { flex: 0 0 190px; }
.gen-hero .input {
  background: rgba(255,255,255,.96); border: 1px solid transparent; color: #1f2d2b;
  border-radius: 10px; padding: 11px 13px; font-size: 14px; width: 100%; box-sizing: border-box;
}
.gen-hero .input::placeholder { color: #6b7c78; }

.gen-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn.ai {
  background: linear-gradient(135deg, #ff8a5b, #ff4d6d); border: none; color: #fff;
  font-weight: 700; padding: 11px 20px; border-radius: 10px; cursor: pointer; font-size: 14px;
  box-shadow: 0 6px 16px rgba(255,77,109,.32); transition: transform .08s ease, box-shadow .2s ease;
}
.btn.ai:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(255,77,109,.4); }
.btn.ai:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.gen-status { margin-top: 13px; font-size: 13.5px; color: #eafff3; min-height: 18px; font-weight: 600; }
.gen-status.ok { color: #e9fff2; }
.gen-status.err { color: #ffe1e1; font-weight: 700; }
.gen-hint { font-size: 12.5px; color: rgba(255,255,255,.88); margin-top: 6px; }

.gen-section {
  background: var(--surface, #fff); border: 1px solid var(--border, #e6ece9);
  border-radius: 14px; padding: 18px 18px 20px; margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(31,157,118,.06);
}
.gen-sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.gen-sec-head h2 { font-size: 18px; margin: 0; color: var(--brand-dark, #157a5c); }
.gen-sec-head .gen-sub { color: var(--text-soft, #7a8a86); font-size: 13px; }

/* 字段网格与单字段 */
.fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-weight: 700; font-size: 13.5px; color: #2c3e39; }
.field .fk { font-weight: 500; font-size: 11px; color: #9aa9a4; font-family: ui-monospace, Menlo, Consolas, monospace; }
.field .hint { font-size: 12px; color: var(--text-soft, #7a8a86); line-height: 1.5; }
.textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--border, #dbe5e1); border-radius: 9px;
  padding: 9px 11px; font-size: 13.5px; line-height: 1.6; color: #2c3e39; resize: vertical;
  background: #fbfdfc; font-family: inherit; min-height: 70px;
}
.textarea:focus { outline: none; border-color: var(--brand, #1f9d76); box-shadow: 0 0 0 3px rgba(31,157,118,.12); }

/* 每个字段旁的「✨ AI 优化 / 📋 复制 / 📄 导出」按钮 + 操作区 */
.field-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.gen-opt-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  background: linear-gradient(135deg, #ff8a5b, #ff4d6d); color: #fff;
  box-shadow: 0 4px 12px rgba(255,77,109,.25); transition: transform .08s ease, box-shadow .2s ease;
}
.gen-opt-btn:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(255,77,109,.34); }
.gen-opt-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.gen-copy-btn, .gen-docx-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--border, #dbe5e1); border-radius: 8px; cursor: pointer;
  background: #fff; color: #2c3e39;
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
}
.gen-copy-btn:hover, .gen-docx-btn:hover { border-color: var(--brand, #1f9d76); background: var(--brand-light, #eafaf3); transform: translateY(-1px); }
.gen-docx-btn { color: var(--brand-dark, #157a5c); }
.gen-copy-btn:disabled, .gen-docx-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* 逐字段生成进度条（位于深色 hero 内，用浅底亮绿） */
.gen-progress { height: 9px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; margin-top: 12px; display: none; }
.gen-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #7ee8c0, #d7fbe9); border-radius: 999px; transition: width .25s ease; }
/* 正在生成 / 已生成的字段高亮 */
.textarea.gen-gening { border-color: #37c79a; box-shadow: 0 0 0 3px rgba(55,199,154,.25); background: #f4fdf9; }
.textarea.gen-done { border-color: #37c79a; }
/* 生成进行中禁用主按钮，避免重复点击 */
.btn.ai:disabled { opacity: .6; cursor: not-allowed; }

/* 优化提示词 chip（深色 hero 内，浅色胶囊展示当前提示词，可修改/清除） */
.gen-hint-chip { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; padding: 7px 12px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.32); border-radius: 999px;
  font-size: 13px; color: #fff; max-width: 100%; }
.gen-hint-chip .ghc-text { opacity: .96; font-weight: 600; word-break: break-all; }
.gen-hint-chip .ghc-edit, .gen-hint-chip .ghc-clear { border: none; cursor: pointer; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; line-height: 1.4; }
.gen-hint-chip .ghc-edit { background: rgba(255,255,255,.92); color: var(--brand-dark, #157a5c); }
.gen-hint-chip .ghc-clear { background: rgba(0,0,0,.2); color: #fff; }
.gen-hint-chip .ghc-edit:hover, .gen-hint-chip .ghc-clear:hover { transform: translateY(-1px); }

/* 优化提示词弹窗（复用 .modal / .foot） */
.gen-pm h3 { margin: 0 0 12px; font-size: 17px; }
.gen-pm-sub { font-size: 12.5px; color: var(--text-soft, #7a8a86); line-height: 1.6; margin: 0 0 12px; }
.gen-pm-sub br + br { margin-top: 4px; }
#gen-pm-input { width: 100%; min-height: 120px; }
.gen-pm-keep { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-soft, #7a8a86); margin: 10px 0 2px; cursor: pointer; }
.gen-pm .foot { margin-top: 12px; }
.input {
  border: 1px solid var(--border, #dbe5e1); border-radius: 9px; padding: 9px 11px; font-size: 14px;
  color: #2c3e39; background: #fff; font-family: inherit; box-sizing: border-box;
}
.input:focus { outline: none; border-color: var(--brand, #1f9d76); box-shadow: 0 0 0 3px rgba(31,157,118,.12); }

/* 制度化建设：三大板块卡片 */
.pol-section {
  border: 1px solid var(--border, #e6ece9); border-radius: 12px; padding: 14px 14px 16px; margin-bottom: 14px;
  background: #fbfdfc;
}
.pol-section.pol-blue { border-left: 4px solid #2f6fed; }
.pol-section.pol-emerald { border-left: 4px solid #1f9d76; }
.pol-section.pol-amber { border-left: 4px solid #f2994a; }
.pol-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pol-sec-head b { font-size: 15.5px; color: #2c3e39; }
.pol-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand, #1f9d76); flex: none; }
.pol-count { font-size: 12px; color: var(--text-soft, #7a8a86); }
.pol-sec-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }

@media (max-width: 640px) {
  .fields-grid, .pol-sec-body { grid-template-columns: 1fr; }
  .gen-org, .gen-project, .gen-type { flex: 1 1 100%; }
}
