/* ============================================================
   人泉风格 · AI 无代码平台视觉体系
   主色：#2F6BFF  背景：#F5F7FA  圆角：8px
   ============================================================ */

:root {
  --brand: #2F6BFF;
  --brand-dark: #1E4FD8;
  --brand-light: #EBF2FF;
  --brand-lighter: #F5F8FF;
  --success: #22A06B;
  --success-light: #E8F7F0;
  --warn: #FF8800;
  --warn-light: #FFF3E5;
  --danger: #E5484D;
  --danger-light: #FDECEC;
  --purple: #7A5AF8;
  --purple-light: #F0ECFE;
  --cyan: #0FA8A8;
  --cyan-light: #E4F6F6;

  --text: #1D2129;
  --text-2: #4E5969;
  --text-3: #86909C;
  --text-4: #A9AEB8;
  --border: #E5E6EB;
  --border-2: #EFF0F3;
  --bg: #F5F7FA;
  --bg-white: #FFFFFF;
  --bg-hover: #F7F8FA;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 3px rgba(29,33,41,.06);
  --shadow-2: 0 4px 16px rgba(29,33,41,.10);
  --shadow-3: 0 8px 32px rgba(29,33,41,.14);
  --sidebar-w: 232px;
  --rail-w: 56px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #DCDFE6; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #C3C7D0; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 登录页 ---------------- */
#login-page {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #EEF3FF 0%, #F7F9FC 45%, #EDF6F4 100%);
}
.login-card {
  width: 400px; padding: 40px 36px;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-3);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
}
.login-brand .name { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.login-sub { color: var(--text-3); font-size: 13px; margin: 0 0 24px; }
.login-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.login-tab {
  padding: 8px 0; cursor: pointer; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px;
}
.login-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.field-label { font-size: 13px; color: var(--text-2); margin-bottom: 7px; display: block; }
.inp {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--border); border-radius: var(--radius);
  outline: none; transition: all .15s; background: #fff;
}
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,107,255,.10); }
.inp-row { display: flex; gap: 9px; }
.btn {
  height: 42px; padding: 0 18px; border: none; border-radius: var(--radius);
  background: var(--brand); color: #fff; cursor: pointer; font-size: 14px;
  transition: all .15s; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; white-space: nowrap; font-weight: 500;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: #BED5FF; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--brand); border-color: var(--brand); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #C93B40; }
.btn.text { background: none; color: var(--brand); height: auto; padding: 4px 6px; }
.btn.text:hover { background: var(--brand-light); }
.login-tip { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 16px; line-height: 1.7; }
.login-err { color: var(--danger); font-size: 12px; min-height: 18px; margin-top: 7px; }

/* ---------------- 主框架 ---------------- */
#app-shell { display: none; height: 100%; flex-direction: column; }
#app-shell.on { display: flex; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 18px; gap: 14px; z-index: 40;
}
.topbar .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: 0 0 auto;
}
.topbar .brand-name { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.topbar .env-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: var(--brand-light); color: var(--brand); font-weight: 500;
}
.top-search {
  flex: 1; max-width: 380px; height: 34px; position: relative;
}
.top-search input {
  width: 100%; height: 34px; border-radius: 17px; border: 1px solid var(--border);
  padding: 0 14px 0 34px; background: var(--bg); outline: none; font-size: 13px;
}
.top-search input:focus { background: #fff; border-color: var(--brand); }
.top-search .ico { position: absolute; left: 12px; top: 9px; color: var(--text-4); font-size: 13px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer; flex: 0 0 auto;
}
.avatar.admin { background: linear-gradient(135deg, #7A5AF8, #2F6BFF); }
.top-user { font-size: 13px; text-align: right; line-height: 1.35; }
.top-user .r { font-size: 11px; color: var(--text-3); }

.body-wrap { flex: 1; display: flex; min-height: 0; }

/* 左侧一级导航（图标栏） */
.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w); background: #fff;
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  align-items: center; padding-top: 10px; gap: 4px; z-index: 30;
}
.rail-item {
  width: 40px; height: 44px; border-radius: var(--radius); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: 10px; transition: all .15s;
}
.rail-item .ri { font-size: 17px; line-height: 1; }
.rail-item:hover { background: var(--bg-hover); color: var(--text); }
.rail-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

/* 左侧二级导航（应用列表） */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: #fff;
  border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20;
}
.sidebar-head {
  height: 46px; display: flex; align-items: center; padding: 0 14px;
  border-bottom: 1px solid var(--border-2); font-weight: 600; font-size: 13px;
  justify-content: space-between; flex: 0 0 auto;
}
.sidebar-body { flex: 1; overflow-y: auto; padding: 6px 0 20px; }
.side-group { padding: 10px 14px 4px; font-size: 11px; color: var(--text-4); letter-spacing: .5px; }
.side-item {
  height: 34px; margin: 1px 8px; padding: 0 10px; border-radius: 6px;
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13px; color: var(--text-2); transition: all .12s;
}
.side-item:hover { background: var(--bg-hover); }
.side-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.side-item .si {
  width: 22px; height: 22px; border-radius: 5px; flex: 0 0 22px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff;
}
.side-item .sn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .badge {
  font-size: 10px; background: var(--danger); color: #fff; border-radius: 8px;
  padding: 1px 5px; font-weight: 600;
}

/* 内容区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.page-head {
  flex: 0 0 auto; background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}
.page-title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.page-title .pt-ico {
  width: 28px; height: 28px; border-radius: 7px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: 14px;
}
.page-desc { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.page-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; }

/* 应用内 Tab */
.app-tabs {
  display: flex; gap: 4px; margin-top: 12px; border-bottom: 1px solid var(--border);
  margin-bottom: -13px;
}
.app-tab {
  padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .12s;
  border-radius: 6px 6px 0 0;
}
.app-tab:hover { color: var(--text); background: var(--bg-hover); }
.app-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
  border: 1px solid var(--border-2);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.input-sm {
  height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px;
  outline: none; font-size: 13px; background: #fff;
}
.input-sm:focus { border-color: var(--brand); }
select.input-sm { cursor: pointer; }

/* 表格 */
.tbl-wrap { background: #fff; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #FAFBFC; text-align: left; padding: 10px 12px; font-weight: 600;
  color: var(--text-2); border-bottom: 1px solid var(--border); white-space: nowrap;
  font-size: 12px;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.tbl tbody tr:hover { background: #FAFBFC; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.td-actions { display: flex; gap: 4px; }
.link { color: var(--brand); cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

/* 标签 */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px;
  background: var(--bg); color: var(--text-2); line-height: 1.6; white-space: nowrap;
}
.tag.blue { background: var(--brand-light); color: var(--brand); }
.tag.green { background: var(--success-light); color: var(--success); }
.tag.orange { background: var(--warn-light); color: var(--warn); }
.tag.red { background: var(--danger-light); color: var(--danger); }
.tag.purple { background: var(--purple-light); color: var(--purple); }
.tag.cyan { background: var(--cyan-light); color: var(--cyan); }
.tag.gray { background: #F2F3F5; color: var(--text-3); }

.empty {
  padding: 56px 20px; text-align: center; color: var(--text-4);
}
.empty .e-ico { font-size: 42px; opacity: .35; margin-bottom: 10px; }
.empty .e-txt { font-size: 13px; margin-bottom: 14px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat-card {
  background: #fff; border-radius: var(--radius-lg); padding: 17px 18px;
  border: 1px solid var(--border-2); box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat-card .sc-label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.stat-card .sc-value { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.stat-card .sc-sub { font-size: 11px; color: var(--text-4); margin-top: 7px; }
.stat-card .sc-ico {
  position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}

/* 弹窗 */
.mask {
  position: fixed; inset: 0; background: rgba(29,33,41,.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  width: 560px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column;
  animation: popIn .18s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes popIn { from { transform: scale(.94); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.modal.wide { width: 860px; }
.modal.full { width: 1120px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-close { cursor: pointer; color: var(--text-4); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--border-2);
  display: flex; justify-content: flex-end; gap: 9px; align-items: center;
}
.modal-foot .mf-tip { margin-right: auto; font-size: 12px; color: var(--text-3); }

/* 表单（表单引擎渲染） */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-item { display: flex; flex-direction: column; }
.form-item.span2 { grid-column: span 2; }
.form-item label {
  font-size: 13px; color: var(--text-2); margin-bottom: 7px;
  display: flex; align-items: center; gap: 4px;
}
.form-item label .req { color: var(--danger); }
.form-item .fi-ctrl { width: 100%; }
.form-item .fi-tip { font-size: 11px; color: var(--text-4); margin-top: 5px; }
.ctrl {
  width: 100%; min-height: 34px; padding: 6px 11px; border: 1px solid var(--border);
  border-radius: 6px; outline: none; font-size: 13px; background: #fff; transition: all .15s;
}
.ctrl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,107,255,.10); }
textarea.ctrl { resize: vertical; min-height: 68px; }
.ctrl[readonly] { background: var(--bg); color: var(--text-2); }
.formula-val {
  min-height: 34px; padding: 7px 11px; background: var(--brand-lighter);
  border: 1px dashed var(--brand); border-radius: 6px; color: var(--brand);
  font-weight: 600; font-size: 13px;
}

/* 明细子表 */
.subform { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.subform table { width: 100%; border-collapse: collapse; font-size: 13px; }
.subform th {
  background: #FAFBFC; padding: 8px 10px; text-align: left; font-weight: 600;
  color: var(--text-2); border-bottom: 1px solid var(--border); font-size: 12px;
}
.subform td { padding: 5px 8px; border-bottom: 1px solid var(--border-2); }
.subform td .ctrl { min-height: 30px; padding: 4px 8px; }
.subform .sf-foot {
  padding: 8px 10px; background: #FAFBFC; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center;
}

/* ---------------- 表单设计器 ---------------- */
.designer { display: flex; gap: 0; height: 100%; min-height: 0; }
.dz-palette {
  width: 196px; flex: 0 0 196px; border-right: 1px solid var(--border);
  overflow-y: auto; padding: 12px; background: #fff;
}
.dz-group-title { font-size: 11px; color: var(--text-4); margin: 12px 0 7px; letter-spacing: .5px; }
.dz-group-title:first-child { margin-top: 0; }
.palette-item {
  display: inline-flex; align-items: center; gap: 6px; width: calc(50% - 4px);
  margin: 0 4px 7px 0; padding: 7px 8px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; cursor: grab; background: #fff;
  transition: all .12s; color: var(--text-2);
}
.palette-item:nth-child(even) { margin-right: 0; }
.palette-item:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lighter); }
.palette-item .pi { font-size: 13px; }
.dz-canvas {
  flex: 1; min-width: 0; overflow-y: auto; padding: 20px; background: var(--bg);
}
.dz-canvas-inner {
  background: #fff; border-radius: var(--radius-lg); padding: 22px;
  min-height: 400px; border: 1px solid var(--border-2);
}
.dz-field {
  position: relative; padding: 12px 14px; border: 1px solid transparent;
  border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all .12s;
}
.dz-field:hover { border-color: #C9D8FB; background: #FCFDFF; }
.dz-field.sel { border-color: var(--brand); background: var(--brand-lighter); }
.dz-field.drop-before { box-shadow: 0 -2px 0 var(--brand); }
.dz-field.drop-after { box-shadow: 0 2px 0 var(--brand); }
.dz-field .df-bar {
  position: absolute; right: 8px; top: 8px; display: none; gap: 3px;
}
.dz-field:hover .df-bar, .dz-field.sel .df-bar { display: flex; }
.dz-field .df-bar span {
  width: 22px; height: 22px; border-radius: 4px; background: #fff; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 11px;
  color: var(--text-3);
}
.dz-field .df-bar span:hover { border-color: var(--brand); color: var(--brand); }
.dz-empty {
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 50px;
  text-align: center; color: var(--text-4); font-size: 13px;
}
.dz-props {
  width: 268px; flex: 0 0 268px; border-left: 1px solid var(--border);
  overflow-y: auto; padding: 14px; background: #fff;
}
.props-title {
  font-size: 13px; font-weight: 600; margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border-2); display: flex; justify-content: space-between;
}
.props-row { margin-bottom: 13px; }
.props-row label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.props-row .ctrl { font-size: 13px; }
.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt-row { display: flex; gap: 6px; align-items: center; }
.opt-row .ctrl { flex: 1; }
.opt-row .del {
  cursor: pointer; color: var(--text-4); font-size: 15px; line-height: 1; padding: 0 3px;
}
.opt-row .del:hover { color: var(--danger); }

/* ---------------- 流程设计器 ---------------- */
.flow-designer { display: flex; height: 100%; min-height: 0; }
.fd-canvas {
  flex: 1; min-width: 0; position: relative; overflow: auto; background:
  #FAFBFC;
  background-image: radial-gradient(#DCE0E8 1px, transparent 1px);
  background-size: 18px 18px;
}
.fd-svg { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 1400px; min-height: 700px; }
.fd-node { cursor: move; }
.fd-node rect { filter: drop-shadow(0 2px 6px rgba(29,33,41,.10)); }
.fd-node:hover rect.body { stroke: var(--brand); }
.fd-node.sel rect.body { stroke: var(--brand); stroke-width: 2; }
.fd-add {
  cursor: pointer;
}
.fd-add:hover circle { fill: var(--brand); }
.fd-add:hover text { fill: #fff; }
.fd-props {
  width: 280px; flex: 0 0 280px; border-left: 1px solid var(--border);
  overflow-y: auto; padding: 14px; background: #fff;
}
.fd-palette {
  width: 168px; flex: 0 0 168px; border-right: 1px solid var(--border);
  padding: 12px; background: #fff; overflow-y: auto;
}
.fd-node-item {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px;
  margin-bottom: 8px; cursor: grab; font-size: 12px; display: flex; gap: 7px;
  align-items: center; background: #fff; transition: all .12s;
}
.fd-node-item:hover { border-color: var(--brand); background: var(--brand-lighter); }
.fd-node-item .fni {
  width: 22px; height: 22px; border-radius: 5px; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 11px; flex: 0 0 22px;
}

/* ---------------- 看板视图 ---------------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kb-col {
  width: 268px; flex: 0 0 268px; background: #F2F3F5; border-radius: var(--radius-lg);
  padding: 10px; max-height: 100%;
}
.kb-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 10px; font-size: 13px; font-weight: 600;
}
.kb-col-head .cnt {
  font-size: 11px; background: #fff; border-radius: 9px; padding: 1px 7px;
  color: var(--text-3); font-weight: 500;
}
.kb-list { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 300px); overflow-y: auto; }
.kb-card {
  background: #fff; border-radius: var(--radius); padding: 11px 12px;
  box-shadow: var(--shadow-1); cursor: pointer; border: 1px solid transparent;
  transition: all .12s;
}
.kb-card:hover { border-color: var(--brand); box-shadow: var(--shadow-2); }
.kb-card .kbc-title { font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.kb-card .kbc-meta { font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 3px; }

/* 卡片视图 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 13px; }
.gal-card {
  background: #fff; border-radius: var(--radius-lg); padding: 15px 16px;
  border: 1px solid var(--border-2); cursor: pointer; transition: all .15s;
}
.gal-card:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.gal-card .gc-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.gal-card .gc-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.gal-card .gc-row .k { color: var(--text-3); }
.gal-card .gc-row .v { color: var(--text); font-weight: 500; }

/* 日历视图 */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-cell { background: #fff; min-height: 96px; padding: 6px; }
.cal-cell.other { background: #FAFBFC; color: var(--text-4); }
.cal-cell .cd { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.cal-cell.today .cd { color: var(--brand); font-weight: 700; }
.cal-ev {
  font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--brand-light);
  color: var(--brand); margin-bottom: 3px; cursor: pointer; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.cal-wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); }
.cal-wk div { background: #FAFBFC; padding: 7px 0; text-align: center; font-size: 12px; color: var(--text-2); font-weight: 600; }

/* ---------------- 报表 ---------------- */
.rpt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 14px; }
.rpt-card { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border-2); padding: 16px 18px; }
.rpt-card h4 { margin: 0 0 3px; font-size: 14px; font-weight: 600; }
.rpt-card .rc-sub { font-size: 11px; color: var(--text-4); margin-bottom: 14px; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-row .bl { width: 92px; flex: 0 0 92px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 20px; background: #F2F3F5; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #5B8DFF, var(--brand)); transition: width .5s; min-width: 2px; }
.bar-row .bv { width: 74px; flex: 0 0 74px; text-align: right; font-weight: 600; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.donut-legend .dl { display: flex; align-items: center; gap: 7px; }
.donut-legend .dot { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }
.donut-legend .dl-n { color: var(--text-2); }
.donut-legend .dl-v { margin-left: auto; font-weight: 600; padding-left: 14px; }
.line-chart { position: relative; }
.trend-num { font-size: 24px; font-weight: 700; }
.kpi-row { display: flex; gap: 26px; flex-wrap: wrap; }
.kpi-item .kv { font-size: 22px; font-weight: 700; }
.kpi-item .kl { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---------------- AI 搭建 ---------------- */
.ai-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ai-chat { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ai-msg { display: flex; gap: 11px; max-width: 860px; }
.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-av {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px;
}
.ai-av.bot { background: linear-gradient(135deg, #7A5AF8, #2F6BFF); }
.ai-av.me { background: #C9C9C9; }
.ai-bubble {
  padding: 11px 14px; border-radius: 10px; font-size: 13px; line-height: 1.72;
  background: #fff; border: 1px solid var(--border-2); max-width: 660px;
  white-space: pre-wrap; word-break: break-word;
}
.ai-msg.user .ai-bubble { background: var(--brand); color: #fff; border-color: var(--brand); }
.ai-input {
  border-top: 1px solid var(--border); padding: 14px 20px; background: #fff;
  display: flex; gap: 10px; align-items: flex-end;
}
.ai-input textarea {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; resize: none; outline: none; min-height: 44px; max-height: 140px;
  font-size: 13px; line-height: 1.6;
}
.ai-input textarea:focus { border-color: var(--brand); }
.ai-suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 12px; background: #fff; }
.ai-chip {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 15px;
  font-size: 12px; cursor: pointer; background: #fff; color: var(--text-2);
  transition: all .12s;
}
.ai-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-lighter); }
.ai-preview {
  background: #FAFBFC; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; margin-top: 12px; font-size: 12px;
}
.ai-preview h5 { margin: 0 0 9px; font-size: 13px; font-weight: 600; }
.ai-fields { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ai-field-chip {
  padding: 3px 9px; border-radius: 4px; background: var(--brand-light);
  color: var(--brand); font-size: 11px;
}
.ai-field-chip .t { opacity: .65; margin-left: 4px; }
.typing span {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-4); margin: 0 2px; animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s }
.typing span:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%,60%,100% { opacity: .25 } 30% { opacity: 1 } }

/* ---------------- 提示 ---------------- */
.toast-wrap { position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow-3); font-size: 13px; display: flex; align-items: center; gap: 8px;
  border-left: 3px solid var(--brand); animation: tIn .2s;
}
@keyframes tIn { from { transform: translateY(-10px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }

.loading {
  display: inline-block; width: 15px; height: 15px; border: 2px solid var(--border);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
.center-load { padding: 60px; text-align: center; color: var(--text-4); }

/* ---------- 门户 ---------- */
.portal { padding: 0; }
.portal-hero {
  background: linear-gradient(120deg, #2F6BFF 0%, #5B8DFF 55%, #7A5AF8 100%);
  border-radius: var(--radius-lg); padding: 26px 28px; color: #fff; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.portal-hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  border-radius: 50%; background: rgba(255,255,255,.10);
}
.portal-hero h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; }
.portal-hero p { margin: 0; opacity: .88; font-size: 13px; }
.portal-hero .ph-actions { margin-top: 16px; display: flex; gap: 10px; position: relative; z-index: 1; }
.portal-hero .btn.ghost { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.4); }
.portal-hero .btn.ghost:hover { background: rgba(255,255,255,.28); }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel-grid .full { grid-column: span 2; }
.todo-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 0;
  border-bottom: 1px solid var(--border-2);
}
.todo-item:last-child { border-bottom: none; }
.todo-item .ti-ico {
  width: 32px; height: 32px; border-radius: 8px; flex: 0 0 32px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.todo-item .ti-main { flex: 1; min-width: 0; }
.todo-item .ti-t { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item .ti-s { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ===== AI 额度 ===== */
.quota-bar {
  height: 10px; border-radius: 6px; background: #EEF0F4; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(29,33,41,.06);
}
.quota-fill {
  height: 100%; min-width: 2px; border-radius: 6px;
  background: linear-gradient(90deg, #2F6BFF 0%, #0FA8A8 100%);
  transition: width .4s ease;
}
.quota-pill {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12px; color: #4E5969; background: #F2F5FF; border: 1px solid #D9E2FF;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.quota-pill:hover { background: #E8EFFF; }
.quota-pill.warn { background: #FFF7E8; border-color: #FFE0B2; color: #A2600B; }
.quota-pill.danger { background: #FFECE8; border-color: #FFCDC7; color: #C4271C; }

/* 响应式 */
@media (max-width: 1180px) {
  .panel-grid { grid-template-columns: 1fr; }
  .panel-grid .full { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-item.span2 { grid-column: span 1; }
}
