/* ==========================================================================
   dsqf-ui —— 企业微信群发系统设计系统
   纯本地样式，不依赖任何外部 CDN。浅色主调 + 深色侧栏 + emerald 品牌色。
   ========================================================================== */

:root {
  --brand: #10b981;
  --brand-dark: #059669;
  --brand-soft: #ecfdf5;
  --brand-ring: rgba(16, 185, 129, .28);

  --bg: #f1f5f9;
  --card: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hi: #1e293b;

  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --border-2: #cbd5e1;

  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #3b82f6;
  --purple: #8b5cf6;

  --r-xs: 6px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;

  --sh-1: 0 1px 2px rgba(15, 23, 42, .06);
  --sh-2: 0 4px 16px -6px rgba(15, 23, 42, .12);
  --sh-3: 0 24px 48px -18px rgba(15, 23, 42, .24);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: none; opacity: .85; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 布局 */
.app { display: flex; height: 100%; }

.sidebar {
  width: 236px; flex: 0 0 236px;
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  color: #cbd5e1;
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 20px;
  font-size: 15px; font-weight: 600; color: #fff;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, #34d399 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #052e22; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(16, 185, 129, .8);
}

.nav-group { padding: 18px 20px 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #64748b; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 10px; padding: 10px 12px;
  border-radius: var(--r-sm);
  color: #a9b6c9; font-size: 13.5px;
  cursor: pointer; user-select: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-item .ico { width: 18px; text-align: center; opacity: .85; font-size: 14px; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, .22), rgba(16, 185, 129, .06));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--brand);
}
.nav-item.active .ico { opacity: 1; color: var(--brand); }

.sidebar-foot { margin-top: auto; padding: 14px 20px; font-size: 11.5px; color: #4b5563; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px; flex: 0 0 64px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .crumb { color: var(--text-3); font-size: 12.5px; margin-left: 4px; }
.topbar .spacer { margin-left: auto; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  background: #f8fafc; border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #0ea5e9);
  color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.content { flex: 1; overflow: auto; padding: 22px; }
.content.frame { padding: 0; overflow: hidden; }
.content iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-1);
  overflow: hidden;
}
.card + .card { margin-top: 18px; }

.card-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fcfdfe, #f8fafc);
}
.card-hd h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-hd .sub { color: var(--text-3); font-size: 12.5px; }
.card-hd .spacer { margin-left: auto; }
.card-bd { padding: 18px 20px; }
.card-bd.tight { padding: 0; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: #fff; color: var(--text-2);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .16s ease;
}
.btn:hover { border-color: #94a3b8; color: var(--text); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #14c88b, var(--brand));
  border-color: var(--brand-dark); color: #fff;
  box-shadow: 0 6px 16px -8px rgba(16, 185, 129, .9);
}
.btn-primary:hover { color: #fff; border-color: var(--brand-dark); filter: brightness(1.03); }

.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }

.btn-warn { background: #fff; color: #b45309; border-color: #fed7aa; }
.btn-warn:hover { background: #fffbeb; border-color: #fdba74; }

.btn-info { background: #fff; color: #1d4ed8; border-color: #bfdbfe; }
.btn-info:hover { background: #eff6ff; border-color: #93c5fd; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f1f5f9; border-color: transparent; box-shadow: none; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn-icon { width: 32px; padding: 0; justify-content: center; }

/* ---------------------------------------------------------------- 表单 */
.field { margin-bottom: 14px; }
.field > label {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
.field .hint { margin-top: 5px; color: var(--text-3); font-size: 12px; }
.field .req::after { content: " *"; color: var(--danger); }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: #fff; color: var(--text);
  font-family: inherit; font-size: 13.5px;
  transition: border-color .16s ease, box-shadow .16s ease;
  outline: none;
}
.textarea { height: auto; padding: 9px 12px; resize: vertical; min-height: 76px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.input::placeholder, .textarea::placeholder { color: #b6c2d2; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* 搜索区 */
.searchbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 20px; background: #fbfcfe;
  border-bottom: 1px solid var(--border);
}
.searchbar .input, .searchbar .select { width: 190px; height: 34px; }
.searchbar .spacer { margin-left: auto; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px 4px; }
.toolbar .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }

table.tbl thead th {
  position: relative;
  padding: 11px 14px; text-align: left; white-space: nowrap;
  background: #f8fafc; color: var(--text-2);
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
table.tbl tbody td {
  padding: 12px 14px; border-bottom: 1px solid #f1f5f9;
  color: var(--text-2); vertical-align: middle;
}
table.tbl tbody tr { transition: background .14s ease; }
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr.selected { background: var(--brand-soft); }
table.tbl tbody tr:last-child td { border-bottom: 0; }

table.tbl .col-id { width: 74px; color: var(--text-3); font-family: var(--mono); font-size: 12.5px; }
table.tbl .col-check { width: 42px; }
table.tbl .col-act { width: 1%; white-space: nowrap; }

.cell-strong { color: var(--text); font-weight: 500; }
.cell-muted { color: var(--text-3); }
.cell-mono { font-family: var(--mono); font-size: 12.5px; }

/* 复选框 */
.cbx {
  appearance: none; width: 16px; height: 16px; margin: 0;
  border: 1.5px solid var(--border-2); border-radius: 5px;
  background: #fff; cursor: pointer; position: relative; top: 2px;
  transition: all .14s ease;
}
.cbx:hover { border-color: var(--brand); }
.cbx:checked { background: var(--brand); border-color: var(--brand); }
.cbx:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------------------------------------------------------------- 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1;
  background: #f1f5f9; color: var(--text-2); border: 1px solid transparent;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.tag.ok { background: #ecfdf5; color: #047857; }
.tag.off { background: #f1f5f9; color: #64748b; }
.tag.err { background: #fef2f2; color: #b91c1c; }
.tag.warn { background: #fffbeb; color: #b45309; }
.tag.info { background: #eff6ff; color: #1d4ed8; }
.tag.purple { background: #f5f3ff; color: #6d28d9; }
.tag.plain { background: #fff; border-color: var(--border); color: var(--text-3); }
.tag.plain::before { display: none; }

/* ---------------------------------------------------------------- 分页 */
.pager { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); }
.pager .meta { color: var(--text-3); font-size: 12.5px; }
.pager .pages { margin-left: auto; display: flex; gap: 6px; }
.pager .pg {
  min-width: 32px; height: 32px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-xs);
  background: #fff; color: var(--text-2); font-size: 13px; cursor: pointer;
  transition: all .14s ease;
}
.pager .pg:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }
.pager .pg.cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager .pg:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- 空状态 / 加载 */
.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 10px; }
.empty .txt { font-size: 13.5px; }

.skeleton { padding: 14px; }
.skeleton .bar { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7); background-size: 200% 100%; animation: sk 1.2s linear infinite; margin-bottom: 12px; }
.skeleton .bar:nth-child(odd) { width: 88%; }
.skeleton .bar:nth-child(even) { width: 70%; }
@keyframes sk { 0% { background-position: 0 0; } 100% { background-position: -200% 0; } }

/* ---------------------------------------------------------------- 模态 */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px 40px; overflow: auto;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(.985); } to { opacity: 1; transform: none; } }

.modal {
  width: 100%; max-width: 560px;
  background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--sh-3); overflow: hidden;
  animation: pop .22s cubic-bezier(.22, 1, .36, 1);
}
.modal.wide { max-width: 880px; }
.modal-hd { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-hd h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-hd .x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text-3); font-size: 17px;
  cursor: pointer; transition: all .14s ease;
}
.modal-hd .x:hover { background: #f1f5f9; color: var(--text); }
.modal-bd { padding: 20px 22px; max-height: 62vh; overflow: auto; }
.modal-ft { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--border); background: #fbfcfe; }

/* ---------------------------------------------------------------- 提示条 */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 200px; max-width: 380px;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-radius: var(--r-sm);
  background: #fff; box-shadow: var(--sh-2); border: 1px solid var(--border);
  font-size: 13.5px; color: var(--text);
  animation: slide .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes slide { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--info); }
.toast .tx { flex: 1 1 auto; min-width: 0; line-height: 1.5; word-break: break-word; }
.toast.ok .dot { background: var(--brand); }
.toast.err .dot { background: var(--danger); }
.toast.warn .dot { background: var(--warn); }

/* ---------------------------------------------------------------- 登录页 */
.login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(16, 185, 129, .28), transparent 60%),
    radial-gradient(700px 460px at 108% 12%, rgba(59, 130, 246, .22), transparent 60%),
    linear-gradient(160deg, #0b1220 0%, #0f172a 55%, #111c33 100%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: rgba(255, 255, 255, .97);
  border-radius: 20px; padding: 34px 32px 28px;
  box-shadow: 0 40px 80px -30px rgba(2, 6, 23, .7);
  border: 1px solid rgba(255, 255, 255, .5);
}
.login-card .lg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-card .lg-logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), #34d399);
  display: flex; align-items: center; justify-content: center;
  color: #04261c; font-weight: 700; font-size: 19px;
  box-shadow: 0 12px 26px -12px rgba(16, 185, 129, .95);
}
.login-card h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.login-card .lg-sub { color: var(--text-3); font-size: 12.5px; margin: 10px 0 24px; }
.login-card .btn-primary { width: 100%; height: 42px; font-size: 14.5px; border-radius: var(--r-sm); margin-top: 6px; }
.login-card .tip { min-height: 20px; margin-top: 12px; font-size: 12.5px; color: var(--danger); }
.login-card .foot { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); color: var(--text-3); font-size: 12px; text-align: center; }
.login-card .row-between { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; }
.login-card .row-between label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; cursor: pointer; }

/* ---------------------------------------------------------------- 统计块 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--sh-1);
}
.stat .k { color: var(--text-3); font-size: 12.5px; }
.stat .v { margin-top: 6px; font-size: 24px; font-weight: 650; letter-spacing: -.5px; }
.stat .v.small { font-size: 18px; }
.stat .v.ok { color: #059669; }
.stat .v.err { color: #dc2626; }
.stat .v.info { color: #2563eb; }

/* ---------------------------------------------------------------- 勾选列表 */
/* 关联项目的「选择包含的项目」等场景 */
.pick-list {
  max-height: 48vh; overflow: auto; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg);
}
.pick-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-xs);
  cursor: pointer; font-size: 13.5px; color: var(--text-2);
  transition: background .12s, color .12s;
}
.pick-item + .pick-item { margin-top: 2px; }
.pick-item:hover { background: #fff; color: var(--text); }
.pick-item input { flex: 0 0 auto; }
.pick-item span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 工具类 */
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.ellipsis { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.right { margin-left: auto; }
.link { color: var(--brand-dark); cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

/* ==========================================================================
   任务附件上传（对齐原 bootstrap-fileinput 的多图上传，但纯手写）
   上传后图片来自企微 CDN，fileUrl 走本机 /profile/upload/** 预览
   ========================================================================== */
.up-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.up-item { position: relative; width: 96px; }
.up-item img {
  width: 96px; height: 96px; object-fit: cover; display: block;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: #f8fafc;
}
.up-item .nm {
  display: block; margin-top: 4px; font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.up-item .rm {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px;
  line-height: 19px; text-align: center; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 13px;
  text-decoration: none; box-shadow: var(--sh-1);
}
.up-item .rm:hover { background: #dc2626; }
.up-add {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  width: 96px; height: 96px; gap: 2px; cursor: pointer;
  border: 1px dashed var(--border-2); border-radius: var(--r-sm);
  color: var(--text-3); font-size: 11.5px; background: #fff;
}
.up-add:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.up-add .plus { font-size: 20px; line-height: 1; }
