/* ============================================================
 * 智慧养老云平台 交互式操作手册 · 样式
 * ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --accent-light: #fffbeb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #1f2937;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --group-border: #93c5fd;
  --group-bg: #f8fafc;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.07), 0 12px 24px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.65;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,58,138,.3);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px;
}
.topbar .logo {
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
}
.topbar .logo .logo-icon {
  width: 38px; height: 38px; border-radius: 9px;
  background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.topbar .logo .logo-text { font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.topbar .logo .logo-sub { font-size: 12px; opacity: .8; }

.search-box {
  flex: 1; max-width: 420px; margin-left: auto;
  position: relative;
}
.search-box input {
  width: 100%; padding: 9px 36px 9px 14px;
  border: none; border-radius: 20px; font-size: 14px;
  background: rgba(255,255,255,.92); color: var(--text);
  outline: none;
}
.search-box input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.search-box .search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-sub); pointer-events: none; }

.search-results {
  position: absolute; top: 44px; left: 0; right: 0;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 320px; overflow-y: auto; z-index: 200; display: none;
}
.search-results.show { display: block; }
.search-results .sr-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-results .sr-item:hover { background: var(--primary-light); }
.search-results .sr-item .sr-title { font-weight: 600; font-size: 14px; }
.search-results .sr-item .sr-menu { font-size: 12px; color: var(--text-sub); }

.topbar .version-tag {
  font-size: 12px; background: rgba(255,255,255,.15);
  padding: 4px 10px; border-radius: 12px; white-space: nowrap;
}

/* ---------- 首页 ---------- */
.home-hero {
  max-width: 1280px; margin: 24px auto 0; padding: 0 24px;
}
.home-hero h1 { font-size: 26px; font-weight: 700; }
.home-hero p { color: var(--text-sub); margin-top: 6px; max-width: 860px; }
.home-hero .hero-badges { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-badge {
  font-size: 13px; background: #fff; border: 1px solid var(--border);
  border-radius: 16px; padding: 5px 12px; color: var(--text-sub);
}

.home-body { max-width: 1280px; margin: 24px auto 60px; padding: 0 24px; }

.cat-section { margin-bottom: 36px; }
.cat-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.cat-header .cat-icon { font-size: 22px; }
.cat-header h2 { font-size: 20px; font-weight: 700; }
.cat-header .cat-desc { color: var(--text-sub); font-size: 13.5px; }

.flow-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.flow-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; transition: all .18s ease;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.flow-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.flow-card.building { opacity: .55; cursor: default; }
.flow-card.building:hover { transform: none; border-color: var(--border); }
.flow-card .fc-code {
  position: absolute; top: 12px; right: 14px; font-size: 12px; font-weight: 700;
  color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 10px;
}
.flow-card .fc-title { font-size: 15.5px; font-weight: 700; padding-right: 42px; }
.flow-card .fc-summary { font-size: 13px; color: var(--text-sub); flex: 1; }
.flow-card .fc-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.flow-card .fc-tag {
  font-size: 12px; color: var(--text-sub); background: var(--bg);
  padding: 2px 8px; border-radius: 8px;
}
.flow-card .fc-tag.role { color: #7c3aed; background: #f5f3ff; }
.flow-card .fc-badge { font-size: 12px; color: var(--warning); }
.flow-card:not(.building):hover .fc-badge { display: none; }

/* 角色入口区块 */
.role-section { margin-bottom: 36px; }
.role-section .role-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.role-chip {
  background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 16px; cursor: pointer; font-size: 14px; transition: all .15s;
  display: flex; align-items: center; gap: 8px;
}
.role-chip:hover { border-color: #7c3aed; color: #7c3aed; background: #faf5ff; }
.role-chip .role-count {
  font-size: 12px; background: var(--bg); border-radius: 10px; padding: 0 7px; color: var(--text-sub);
}

/* ---------- 业务详情页 ---------- */
.flow-page { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.crumbs { font-size: 13px; color: var(--text-sub); margin-bottom: 14px; }
.crumbs a { color: var(--primary); }
.crumbs .sep { margin: 0 6px; color: #c4c9d0; }

.flow-head {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 26px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.flow-head h1 { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 12px; }
.flow-head .fh-code {
  font-size: 13px; color: #fff; background: var(--primary); padding: 3px 10px; border-radius: 10px; font-weight: 600;
}
.flow-head .fh-summary { color: var(--text-sub); margin-top: 10px; max-width: 900px; font-size: 14px; }
.flow-head .fh-roles { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.flow-head .fh-roles .label { color: var(--text-sub); }
.flow-head .role-tag {
  background: #f5f3ff; color: #7c3aed; border: 1px solid #e9d5ff;
  padding: 2px 10px; border-radius: 12px; font-size: 12.5px;
}

.flow-layout {
  display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start;
}

/* 左侧流程图 */
.flowchart { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 14px; position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto; }
.flowchart-title { font-size: 14px; font-weight: 700; color: var(--text-sub); padding: 0 8px 10px; border-bottom: 1px dashed var(--border); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.flowchart-title .hint { font-size: 12px; color: #b0b7c0; font-weight: 400; }

/* 节点 */
.fc-node { position: relative; padding-left: 40px; margin-bottom: 4px; }
.fc-node .fc-line { position: absolute; left: 14px; top: 30px; bottom: -6px; width: 2px; background: var(--border); }
.fc-node:last-child .fc-line { display: none; }
.fc-node .fc-dot {
  position: absolute; left: 6px; top: 10px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-sub); z-index: 2;
}
.fc-node .fc-card {
  background: #fff; border: 1.5px solid var(--border); border-radius: 9px;
  padding: 9px 12px; cursor: pointer; transition: all .15s; margin-bottom: 8px;
  position: relative;
}
.fc-node .fc-card:hover { border-color: var(--primary); background: var(--primary-light); }
.fc-node .fc-card.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.fc-node .fc-card .fc-name { font-size: 14px; font-weight: 600; }
.fc-node .fc-card .fc-menu { font-size: 11.5px; color: var(--text-sub); margin-top: 3px; }
.fc-node .fc-card .fc-menu em { font-style: normal; color: var(--primary); }
.fc-node .fc-card .fc-arrow { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #c4c9d0; font-size: 12px; }
.fc-node .fc-card.active .fc-arrow { color: var(--primary); }

/* 分组节点 */
.fc-group { margin: 6px 0 12px; position: relative; }
.fc-group .fc-group-box {
  border: 2px dashed var(--group-border); border-radius: 12px; background: var(--group-bg);
  padding: 12px 10px 6px;
}
.fc-group .fc-group-head {
  display: flex; align-items: center; gap: 8px; padding: 2px 6px 8px;
  font-weight: 700; font-size: 13.5px; color: var(--primary-dark);
}
.fc-group .fc-group-head .fc-toggle { cursor: pointer; user-select: none; font-size: 11px; color: var(--primary); }
.fc-group .fc-group-note { font-size: 12px; color: #7c8db5; padding: 0 6px 8px; }
.fc-group .fc-group-children.collapsed { display: none; }
.fc-group .fc-group-children .fc-node:last-child .fc-line { display: none; }

/* 普通主流程节点之间的连接箭头（跟随竖线，位于竖线底部） */
.fc-node.main-flow { margin-bottom: 0; }
.fc-node.main-flow > .fc-card { margin-bottom: 16px; }
.fc-node.main-flow::after {
  content: "▼"; position: absolute; left: 10px; bottom: -11px; font-size: 10px; line-height: 1; color: var(--primary); z-index: 3;
}
/* 最后一个节点无后续流程，隐藏竖线与箭头 */
.fc-node.main-flow:last-child::after { display: none; }

/* 右侧说明面板 */
.detail-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 400px; overflow: hidden; }
.detail-empty {
  padding: 80px 40px; text-align: center; color: var(--text-sub);
}
.detail-empty .de-icon { font-size: 48px; margin-bottom: 14px; }
.detail-head {
  padding: 20px 26px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, #fff);
}
.detail-head .dh-title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.detail-head .dh-menu {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  background: var(--primary-light); color: var(--primary-dark); font-size: 13px;
  padding: 5px 12px; border-radius: 8px;
}
.detail-head .dh-menu .pin { font-size: 12px; }
.detail-body { padding: 20px 26px 30px; }

.d-block { margin-bottom: 22px; }
.d-block-title {
  font-size: 14px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.d-block-title .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.d-steps { list-style: none; counter-reset: dstep; }
.d-steps li {
  counter-increment: dstep; position: relative; padding: 7px 0 7px 34px; font-size: 14px;
}
.d-steps li::before {
  content: counter(dstep); position: absolute; left: 0; top: 8px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary-dark); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.d-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.d-field {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 12px; font-size: 13px; color: var(--text);
}

.d-notes { }
.d-note {
  display: flex; gap: 10px; background: var(--accent-light); border: 1px solid #fde68a;
  border-radius: 8px; padding: 9px 14px; font-size: 13.5px; margin-bottom: 8px; color: #92400e;
}
.d-note::before { content: "⚠"; flex-shrink: 0; }

.d-images { }
.d-img { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.d-img img { width: 100%; display: block; cursor: zoom-in; background: #fff; }
.d-img .d-img-cap { padding: 7px 12px; font-size: 12.5px; color: var(--text-sub); background: #fafbfc; border-top: 1px solid var(--border); }

/* 图片放大 */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.78); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 30px;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox .lb-close {
  position: absolute; top: 18px; right: 26px; color: #fff; font-size: 30px; cursor: pointer; opacity: .85;
}
.lightbox .lb-close:hover { opacity: 1; }

/* 建设中提示 */
.building-tip {
  background: var(--card); border: 1px dashed var(--warning); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--text-sub);
}
.building-tip h3 { color: var(--warning); margin-bottom: 8px; }
.building-tip .bt-back { display: inline-block; margin-top: 16px; }

/* 底部 */
.footer {
  border-top: 1px solid var(--border); padding: 22px 24px 30px; text-align: center;
  color: var(--text-sub); font-size: 13px; background: #fff;
}

/* 响应式 */
@media (max-width: 900px) {
  .flow-layout { grid-template-columns: 1fr; }
  .flowchart { position: static; max-height: none; }
  .topbar-inner { flex-wrap: wrap; }
  .search-box { order: 3; max-width: 100%; flex-basis: 100%; margin-left: 0; }
  .flow-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .flow-grid { grid-template-columns: 1fr; }
  .home-hero, .home-body, .flow-page { padding-left: 14px; padding-right: 14px; }
}

/* 关联流程链接 */
.d-links { display: flex; flex-direction: column; gap: 6px; }
.d-link {
  display: block; background: var(--primary-light); border: 1px solid #bfdbfe;
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; color: var(--primary-dark);
  cursor: pointer; transition: all .15s;
}
.d-link:hover { background: #dbeafe; border-color: var(--primary); }

/* ---------- 频率徽标 ---------- */
.freq-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-right: 8px; vertical-align: 3px; }
.freq-low  { background: #f3f4f6; color: #6b7280; }
.freq-mid  { background: #fef3c7; color: #d97706; }
.freq-high { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.freq-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.freq-dot-low  { background: #9ca3af; }
.freq-dot-mid  { background: #f59e0b; }
.freq-dot-high { background: #ef4444; }

/* PC/小程序双路径 */
.d-paths { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.d-path { font-size: 12.5px; padding: 5px 10px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; }
.d-path.pc     { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.d-path.mobile { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

/* 💡 业务提示 */
.d-tip { display: flex; gap: 10px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 9px 14px; font-size: 13.5px; margin-bottom: 8px; color: #1e40af; }
.d-tip::before { content: "💡"; flex-shrink: 0; }
.d-tip.key { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.d-tip.key::before { content: "⭐"; }
