/* ============================================================
   FLOW 应用增量样式(在 style.css / flow.css 之上)
   ============================================================ */

/* 防御:hidden 属性必须始终生效。
   否则类选择器里的 display(flex / block)会覆盖 UA 的 [hidden]{display:none},
   导致弹窗等元素默认显示且无法关闭。 */
[hidden] { display: none !important; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.login-box {
  width: 372px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 30px 28px 24px;
}
.login-box .login-head {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 19px; color: var(--text);
}
.login-box .login-sub { text-align: center; color: var(--text-3); font-size: 12.5px; margin: 6px 0 20px; }
.login-box .field { margin-bottom: 14px; }
.login-box .field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.login-box .field input {
  width: 100%; height: 38px; border: 1px solid var(--border-2); border-radius: 6px;
  padding: 0 10px; font-size: 14px; outline: none; font-family: inherit;
}
.login-box .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
/* 密码框(带眼睛按钮):右侧留出按钮空间 */
.login-box .pw-wrap input { padding-right: 40px; }

/* ---------- 顶栏补充 ---------- */
.searchbox .search-btn {
  border: none; background: none; padding: 0; display: inline-flex;
  align-items: center; color: var(--text-3); cursor: pointer;
}
.searchbox .search-btn:hover { color: var(--primary); }
.user-item-btn {
  width: 100%; border: none; background: none; font: inherit;
  text-align: left; cursor: pointer; color: inherit;
}

/* ---------- 安装向导 ---------- */
/* 长表单从顶部开始排布:垂直居中会让顶部溢出到视口外而无法滚动到 */
.login-wrap.is-top { align-items: flex-start; padding: 40px 24px; }
.setup-box { width: 620px; max-width: 100%; padding: 28px 30px 22px; }
.setup-box .form-section { font-size: 14px; font-weight: 700; margin: 20px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.setup-box .form-section:first-of-type { margin-top: 4px; }
.setup-box .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .setup-box .field-row { grid-template-columns: 1fr; } }
/* 说明文字与必填标记(style.css 的同名规则限定在 .form-item 内,安装向导需要单独定义) */
.setup-box .field .help { color: var(--text-3); font-size: 12px; margin-top: 5px; line-height: 1.6; }
.setup-box .field label .req { color: var(--red); margin-left: 2px; }
.setup-box code { background: var(--gray-bg); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--text-2); }
.db-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.db-option {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.db-option:hover { border-color: var(--primary); }
.db-option.is-disabled { cursor: not-allowed; opacity: .6; background: var(--gray-bg); }
.db-option.is-disabled:hover { border-color: var(--border); }
.db-option input { margin-top: 3px; }
.db-body { display: flex; flex-direction: column; }
.db-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.db-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check-line input { margin-top: 3px; }

/* ---------- 弹窗 ----------
   复用 style.css 已有的弹层结构:.modal-mask(全屏遮罩 + 居中)
   + .modal(卡片)+ .m-head / .m-body / .m-foot
   此处仅补充尺寸变体、关闭按钮与 JS 显隐控制。
--------------------------------------------------------------- */
.modal-mask[hidden] { display: none; }
/* 遮罩层可滚动,弹窗内容区不再裁剪(否则可搜索下拉会被截断) */
.modal-mask { overflow-y: auto; }
.modal { overflow: visible; }
.modal .m-body { max-height: none; overflow: visible; }
.modal-lg { width: 720px; }
.modal-sm { width: 460px; }
.modal .m-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal .m-head .hint { font-size: 12px; color: var(--text-3); font-weight: 400; }
.modal .m-close {
  border: none; background: none; cursor: pointer; color: var(--text-3);
  padding: 4px; border-radius: 6px; display: inline-flex; align-items: center;
}
.modal .m-close:hover { background: var(--gray-bg); color: var(--text); }
.modal .m-body .form-item:last-child { margin-bottom: 0; }
.modal .m-foot .modal-note { margin-right: auto; font-size: 12px; color: var(--text-3); }
body.modal-open { overflow: hidden; }

/* ---------- 可搜索选择器(联系人下拉 + 新增入口)---------- */
.picker { position: relative; }
.picker-toggle {
  width: 100%; height: 34px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--card); font-size: 13.5px; color: var(--text); cursor: pointer; font-family: inherit;
  text-align: left;
}
.picker-toggle:hover { border-color: var(--primary); }
.picker-toggle .ico { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.picker-toggle.is-empty .picker-label { color: var(--text-3); }
.picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-panel {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.picker-panel[hidden] { display: none; }
.picker-search { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.picker-search input { border: none; outline: none; flex: 1; font-size: 13px; font-family: inherit; background: none; }
.picker-search .ico { width: 14px; height: 14px; color: var(--text-3); flex: none; }
.picker-list { max-height: 236px; overflow-y: auto; padding: 4px; }
.picker-item {
  width: 100%; display: block; text-align: left; border: none; background: none; cursor: pointer;
  padding: 7px 8px; border-radius: 6px; font-family: inherit;
}
.picker-item:hover, .picker-item.is-active { background: var(--gray-bg); }
.picker-item .p-name { font-size: 13px; color: var(--text); }
.picker-item .p-name .small { font-size: 11.5px; }
.picker-item .p-meta {
  display: block; font-size: 12px; color: var(--text-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker-add {
  width: 100%; display: flex; align-items: center; gap: 6px; padding: 8px;
  margin-bottom: 4px; border: none; border-bottom: 1px solid var(--border); background: none;
  cursor: pointer; color: var(--primary); font-size: 13px; font-family: inherit;
}
.picker-add:hover { background: var(--primary-light); }
.picker-add .ico { width: 14px; height: 14px; }
.picker-empty { padding: 10px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.chip .chip-x {
  border: none; background: none; cursor: pointer; color: inherit; padding: 0;
  margin-left: 4px; display: inline-flex; align-items: center; opacity: .7;
}
.chip .chip-x:hover { opacity: 1; }
.chip .chip-x .ico { width: 12px; height: 12px; }

/* 表格里的次要信息 */
.cell-sub { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* ---------- 通用小工具 ---------- */
.kb-empty { color: var(--text-3); font-size: 12.5px; padding: 6px 2px; }
.nowrap { white-space: nowrap; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.w-100 { width: 100%; }

/* 表格内的次要说明 */
.table .sub-line { color: var(--text-3); font-size: 12px; display: block; margin-top: 2px; }

/* 详情页流程输入区 */
.flow-actions select { height: 32px; border: 1px solid var(--border-2); border-radius: 6px; padding: 0 8px; font-size: 13px; }

/* 表单提交按钮组 */
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ============================================================
   事件编辑 / @提及 / 附件 组件样式(对齐原型)
   ============================================================ */

/* 面板标题行(标题 + 右侧小图标) */
.panel-head-row { display: flex; align-items: center; gap: 8px; }
.panel-head-row h3 { margin-bottom: 0; }

/* 小编辑图标(非按钮,仅图标) */
.edit-ico {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  border: none; border-radius: 7px; background: transparent; color: var(--text-3); cursor: pointer;
  margin-left: auto; flex: none;
}
.edit-ico:hover { background: var(--gray-bg); color: var(--primary); }
.edit-ico svg { width: 14px; height: 14px; }

/* 行内编辑区 */
.edit-textarea {
  width: 100%; border: 1px solid var(--border-2); border-radius: 8px;
  padding: 10px 12px; font-size: 13.5px; background: var(--card); color: var(--text);
  outline: none; resize: vertical; min-height: 90px; font-family: inherit;
}
.edit-textarea:focus { border-color: var(--primary); }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* 描述中的提及标签 */
.mention-chip {
  display: inline-flex; align-items: center;
  color: var(--primary); font-weight: 600; cursor: pointer;
  background: var(--primary-light); border-radius: 6px; padding: 1px 6px;
  white-space: nowrap;
}
.mention-chip:hover { background: #dbeafe; }

/* @提及编辑器 */
.mention-wrap { position: relative; }
.mention-wrap textarea { width: 100%; }
.mention-panel {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 120;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); display: none; flex-direction: column; overflow: hidden;
}
.mention-panel.show { display: flex; }
/* 向上空间不足时改为向下弹出(手机端 bottom-sheet 弹窗尤其需要,避免候选被视口顶部裁掉) */
.mention-panel.below { bottom: auto; top: calc(100% + 6px); }
.mp-search {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); color: var(--text-3); flex: none;
}
.mp-search-ico { flex: none; width: 14px; height: 14px; }
.mp-search-input {
  flex: 1; min-width: 0; border: none; outline: none; font-size: 13px;
  background: transparent; color: var(--text);
}
.mp-search-input::placeholder { color: var(--text-3); }
.mp-list { max-height: 210px; overflow-y: auto; padding: 4px; }
.mp-group { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 7px 10px 2px; }
.mention-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  border-radius: 8px;
}
.mention-item:hover, .mention-item.active { background: var(--primary-light); }
.mention-item .mi-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none;
}
.mention-item .mi-name { font-size: 13px; font-weight: 600; }
.mention-item .mi-org { font-size: 11.5px; color: var(--text-3); }
.mention-item .mi-tag { margin-left: auto; flex: none; }
.mention-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.mention-hint b { color: var(--primary); }

/* 手机端:候选面板高度受视口约束(软键盘弹出、视口缩小时不超出屏幕,保证可点选) */
@media (max-width: 767px) {
  .mention-panel { max-height: 50vh; }
  .mp-list { max-height: calc(50vh - 60px); }
}

/* 进度附件 */
.att-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.att-thumb { position: relative; aspect-ratio: 1/1; border-radius: 8px; overflow: hidden; background: var(--gray-bg); display: block; }
.att-thumb img, .att-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-thumb .play-mask {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.25);
  pointer-events: none;
}
.att-thumb .play-mask svg { width: 26px; height: 26px; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.att-file-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  background: var(--gray-bg); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; color: var(--text-2);
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.att-file-row:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.att-file-row svg { width: 15px; height: 15px; color: var(--primary); flex: none; }
.att-file-row .f-size { color: var(--text-3); margin-left: auto; font-size: 11.5px; flex: none; }
.att-count-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 10px;
  border-radius: 11px; background: var(--purple-bg); color: var(--purple);
  font-size: 11.5px; font-weight: 600; flex: none;
}
.att-count-pill svg { width: 12px; height: 12px; }
.att-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.att-upload-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 13px;
  border: 1px dashed var(--border-2); border-radius: 9px; background: var(--card);
  color: var(--text-2); font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.att-upload-btn:hover { border-color: var(--primary); color: var(--primary); }
.att-upload-btn svg { width: 14px; height: 14px; }
.att-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.att-pv {
  position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden;
  background: var(--gray-bg); border: 1px solid var(--border);
}
.att-pv img, .att-pv video { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-pv .pv-x {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
  display: grid; place-items: center; font-size: 11px; line-height: 1; padding: 0;
}
.att-pv .pv-x svg { width: 10px; height: 10px; }
.att-pv.file { width: 100%; height: auto; display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.att-pv.file .f-name { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

/* 分事件节点(进度列表) */
.flow-node.subitem::before { border-color: var(--purple); }
.flow-node.subitem.current::before { background: var(--purple); }
.subitem-card {
  margin-top: 6px; border: 1px dashed var(--purple); border-radius: 10px;
  background: var(--purple-bg); padding: 9px 11px;
}
.subitem-card .si-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.subitem-card .si-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.subitem-card .si-enter { margin-top: 6px; }
.subitem-card .si-enter a { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--purple); font-weight: 600; }
.subitem-card .si-enter a:hover { text-decoration: underline; }

/* 审计页标签 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs .tab {
  border: none; background: none; padding: 9px 16px; font-size: 14px; font-weight: 600;
  color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit;
}
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .tab:hover { color: var(--text-2); }

/* 待办行内编辑图标按钮 */
.btn-edit-todo {
  border: none; background: none; padding: 4px; margin: 0;
  color: var(--text-3); cursor: pointer; line-height: 0;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.btn-edit-todo:hover { color: var(--primary); background: var(--primary-light); }
/* 待办行内删除图标按钮(垃圾桶) */
.btn-del-todo {
  border: none; background: none; padding: 4px; margin: 0;
  color: var(--text-3); cursor: pointer; line-height: 0;
  border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.btn-del-todo:hover { color: var(--red); background: var(--red-bg); }

/* 手机端:行内图标按钮加大触控区 */
@media (max-width: 767px) {
  .btn-edit-todo, .btn-del-todo { padding: 6px; }
}

/* ---------- 浮动新建按钮(FAB):手机端右下角,仿原型 .m-fab ---------- */
.m-fab {
  display: none; /* 桌面端隐藏 */
}
@media (max-width: 767px) {
  .m-fab {
    display: grid; place-items: center;
    position: fixed; right: 20px; bottom: calc(62px + env(safe-area-inset-bottom, 0));
    width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
    color: #fff; z-index: 55; text-decoration: none; font-family: inherit; line-height: 0;
  }
  .m-fab svg { width: 24px; height: 24px; }
  .m-fab:active { opacity: .85; }
  /* 待办页:绿色加号 */
  .m-fab.fab-green { background: #16a34a; box-shadow: 0 6px 16px rgba(22, 163, 74, .45); }
  /* 事件页:蓝色加号 */
  .m-fab.fab-blue { background: var(--primary); box-shadow: 0 6px 16px rgba(37, 99, 235, .45); }
}
