:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #6b7686;
  --line: #e6eaf0;
  --brand: #2456e6;
  --brand-soft: #eaf0ff;
  --green: #1fae6b;
  --amber: #e6952b;
  --red: #e0483b;
  --shadow: 0 2px 10px rgba(20, 35, 70, .06);
  --radius: 12px;
  --sidebar-w: 190px;
  --topbar-h: 58px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); }

/* ---------- layout ---------- */
#app-view { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; min-height: var(--topbar-h);
}
.topbar .logo { font-weight: 700; font-size: 17px; }
.topbar .logo small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar .who b { color: var(--ink); }
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 14px; border-radius: 8px; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { opacity: .92; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f3c6c2; }
.btn.danger:hover { background: #fdecea; }
.btn.sm { padding: 4px 10px; font-size: 13px; }

/* ---------- 左侧纵向模块导航（nav-vertical-v1-20261112） ---------- */
.layout { display: flex; flex: 1; align-items: stretch; min-width: 0; }
.nav {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; background: var(--card);
  border-right: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); align-self: flex-start;
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.nav button {
  border: none; background: transparent; color: var(--muted);
  padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 500;
  text-align: left; width: 100%; white-space: nowrap; transition: .15s;
}
.nav button:hover { background: #f5f7fc; color: var(--brand); }
.nav button.active {
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}

main { padding: 18px 22px; max-width: 1120px; width: 100%; min-width: 0; margin: 0 auto; flex: 1; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 4px; font-size: 14px; color: var(--muted); font-weight: 600; }
.card .big { font-size: 30px; font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.section-title h2 { font-size: 18px; margin: 0; }

/* ---------- AI需求池 · 发布类型说明（蓝色加粗） ---------- */
.needs-title h2 { white-space: nowrap; flex: 0 0 auto; }
.needs-title .pool-note {
  flex: 1 1 auto; min-width: 0; margin: 0 16px;
  color: var(--brand); font-weight: 700; font-size: 12.5px; line-height: 1.6;
}
.needs-title .btn { flex: 0 0 auto; }
@media (max-width: 720px) {
  .needs-title { flex-wrap: wrap; gap: 8px; }
  .needs-title .pool-note { order: 3; flex-basis: 100%; margin: 0; }
}

/* ---------- intro banner（拟建智能体清单介绍） ---------- */
.intro-banner { display: flex; align-items: center; gap: 14px; background: linear-gradient(120deg, var(--brand-soft), #f3f6ff); border: 1px solid var(--brand); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.intro-ico { font-size: 30px; line-height: 1; flex: 0 0 auto; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(40,80,200,.15); }
.intro-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.intro-sub { font-size: 13px; margin-top: 3px; }

/* progress bar */
.bar { height: 10px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafbfd; }
tbody tr:hover { background: #fafbff; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.tag.green { background: #e6f7ee; color: var(--green); }
.tag.amber { background: #fdf1e3; color: var(--amber); }
.tag.red { background: #fdecea; color: var(--red); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }
.tag.gray { background: #eef1f6; color: var(--muted); }
.muted { color: var(--muted); }
.row-actions { display: flex; gap: 6px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--card); padding: 6px 14px; border-radius: 8px; color: var(--muted); }
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- forms / modal ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { min-height: 80px; resize: vertical; }
.modal-mask { position: fixed; inset: 0; background: rgba(15,25,45,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; padding: 20px; }
.modal h3 { margin: 0 0 14px; }
.modal .footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- login ---------- */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box p.sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.login-box .hint { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.6; }
.login-box .tabs { margin-bottom: 16px; }
.login-box .tabs button { flex: 1; text-align: center; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.hidden { display: none !important; }

/* ---------- filter bar ---------- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar .filter-q { flex: 1; min-width: 160px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.filter-bar .filter-s { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; font-family: inherit; }

/* ---------- rich text ---------- */
.rich-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.rich-toolbar button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 9px; font-size: 13px; color: var(--ink); }
.rich-toolbar button:hover { border-color: var(--brand); color: var(--brand); }
textarea.rich { min-height: 120px; line-height: 1.6; }
.md h4.md-h { margin: 10px 0 4px; font-size: 15px; }
.md p { margin: 4px 0; }
.md ul.md-ul { margin: 4px 0; padding-left: 22px; }
.md ul.md-ul li { margin: 2px 0; }

/* ---------- detail ---------- */
.detail { display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: flex; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.detail-k { flex: 0 0 92px; color: var(--muted); font-size: 13px; padding-top: 2px; }
.detail-v { flex: 1; min-width: 0; word-break: break-word; }
.detail-v .md { background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }

/* ---------- attachment ---------- */
/* multi-attach-v1-20261112：多附件选择区与文件条目 */
.attach-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attach-row .file-input { flex: 1; min-width: 160px; }
.attach-info { display: inline-block; }
.attach-link { color: var(--brand); cursor: pointer; text-decoration: none; }
.attach-link:hover { text-decoration: underline; }
.attach-row-multi { align-items: flex-start; }
.attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attach-chip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.attach-chip .attach-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.attach-chip .btn.sm { padding: 2px 8px; font-size: 12px; }
td .attach-chip + .attach-chip { margin-top: 4px; }
td .attach-chip .attach-link { max-width: 190px; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
.toast-item { background: #1f2733; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .2s; }
.toast-item.show { opacity: 1; transform: none; }
.toast-item.err { background: var(--red); }
.toast-item.ok { background: var(--green); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.stat-row { display: flex; gap: 18px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
/* 窄屏回退为顶部横向标签栏，避免侧栏挤压内容 */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .nav {
    position: static; align-self: stretch; width: 100%; height: auto; flex: 0 0 auto;
    flex-direction: row; gap: 4px; padding: 8px 12px;
    border-right: none; border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden; white-space: nowrap;
  }
  .nav button { width: auto; flex: 0 0 auto; padding: 8px 14px; }
  main { padding: 16px 14px; }
}
@media (max-width: 560px) {
  th, td { padding: 8px 8px; }
  .topbar .who { display: none; }
}
