/* ===== 流程图页面样式 ===== */
:root {
  --red-primary: #C41E24;
  --gold: #D4A843;
  --bg-warm: #F5E6D3;
  --bg-warm-end: #E8D5B7;
  --text-dark: #1A1A1A;
  --text-secondary: #666;
  --card-bg: rgba(255,255,255,0.88);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--bg-warm) 0%, var(--bg-warm-end) 100%);
  min-height: 100vh;
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  padding-bottom: 40px;
}

/* 导航栏 */
.nav-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--red-primary) 0%, #9B1B20 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(196,30,36,0.25);
}
.nav-back {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.2s;
}
.nav-back:active { background: rgba(255,255,255,0.15); }
.nav-title {
  flex: 1;
  text-align: center;
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}
.nav-spacer { width: 36px; }

/* 搜索栏 */
.search-bar {
  display: flex;
  align-items: center;
  margin: 12px 16px;
  padding: 8px 12px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid rgba(212,168,67,0.2);
  backdrop-filter: blur(10px);
}
.search-icon { flex-shrink: 0; margin-right: 8px; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-dark);
  outline: none;
}
.search-input::placeholder { color: #aaa; }
.search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
}

/* 统计概览 */
.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 8px;
}
.summary { font-size: 12px; color: var(--text-secondary); }
.summary-num { color: var(--red-primary); font-weight: 700; font-size: 14px; }
.tab-btn {
  padding: 0.35rem 0.25rem;
  border: 1px solid rgba(196, 30, 36, 0.2);
  border-radius: 16px;
  background: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
}
.tab-btn:active {
  transform: scale(0.95);
}
.tab-btn.active {
  background: var(--red-primary);
  color: #fff;
  border-color: var(--red-primary);
}
.tab-btn-all { margin-left: auto; }

/* 分类标签 */
.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 16px;
  margin-bottom: 12px;
}
.category-tabs .tab-btn {
  width: 100%;
}

/* 内容区域 */
.content { padding: 0 16px; }

/* 分类区块 */
.cat-section { margin-bottom: 12px; }
.cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card-bg);
  border-radius: 10px;
  border: none;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}
.cat-header:active { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.cat-title-wrap { display: flex; align-items: center; gap: 8px; }
.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--red-primary);
  color: #fff;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 600;
}
.cat-title {
  font-family: "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}
.cat-arrow { transition: transform 0.25s ease; flex-shrink: 0; }

.cat-body {
  overflow: hidden;
  transition: max-height 0.35s ease;
  max-height: 5000px;
}
.cat-body.collapsed { max-height: 0; }

/* 流程事项卡片 */
.flow-item {
  margin: 8px 0;
  padding: 14px;
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid rgba(212,168,67,0.12);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.flow-item:active {
  transform: scale(0.98);
  box-shadow: 0 1px 6px rgba(196,30,36,0.12);
}
.flow-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.flow-item-seq {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}
.flow-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.4;
  flex: 1;
}
.flow-item-img-badge {
  background: #4CAF50;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.flow-item.has-image {
  border-left-color: #4CAF50;
}
.flow-item-depts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.flow-dept-tag {
  padding: 2px 8px;
  background: #FFF5F5;
  color: var(--red-primary);
  border-radius: 4px;
  font-size: 11px;
  border: 1px solid rgba(196,30,36,0.15);
}
.flow-item-action {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--red-primary);
  font-size: 12px;
  font-weight: 500;
  padding-top: 8px;
  border-top: 1px dashed rgba(196,30,36,0.15);
}

/* 事项快捷链接 */
.item-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.item-link {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.item-link-blue {
  background: #EEF4FF;
  color: #2563EB;
  border-color: rgba(37,99,235,0.15);
}
.item-link-blue:hover {
  background: #2563EB;
  color: #fff;
}
.item-link-gold {
  background: #FEF6E7;
  color: #B8860B;
  border-color: rgba(212,168,67,0.2);
}
.item-link-gold:hover {
  background: #D4A843;
  color: #fff;
}
.item-link-green {
  background: #E8F5E9;
  color: #2E7D32;
  border-color: rgba(46,125,50,0.15);
}
.item-link-green:hover {
  background: #2E7D32;
  color: #fff;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 14px;
}

/* 返回顶部 */
.back-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(196,30,36,0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 90;
}
.back-top.show { opacity: 1; transform: translateY(0); }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-container {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0e8e0;
  flex-shrink: 0;
}
.modal-title {
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.4;
  flex: 1;
  padding-right: 12px;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #f5f0eb;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  flex-shrink: 0;
  transition: background 0.2s;
}
.modal-close:active { background: #ece4db; }

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px 16px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid #f0e8e0;
  flex-shrink: 0;
  background: #FFFCF8;
  border-radius: 0 0 0 0;
}
.modal-zoom-in, .modal-zoom-out {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(196,30,36,0.3);
  background: transparent;
  color: var(--red-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-zoom-in:active, .modal-zoom-out:active {
  background: var(--red-primary);
  color: #fff;
}
.modal-zoom-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

/* 流程图 SVG 包裹 */
.flow-svg-wrap {
  transform-origin: top center;
  transition: transform 0.2s;
}
