:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b7488;
  --line: #e5e9f2;
  --primary: #2f6bff;
  --primary-dark: #1f52d6;
  --primary-soft: #eaf0ff;
  --pending: #b26a00;
  --pending-bg: #fff4e0;
  --processing: #1558c0;
  --processing-bg: #e6efff;
  --done: #16794a;
  --done-bg: #e3f6ec;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(24, 40, 78, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0.2px; }
h1 { font-size: 22px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(900px 500px at 15% 0%, #e8efff 0%, transparent 60%),
    radial-gradient(700px 500px at 90% 100%, #e9f6f1 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
}

.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.brand-mark {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2f6bff, #5c93ff);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(47, 107, 255, 0.28);
}
.brand-mark.small { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
.brand p { margin-top: 4px; color: var(--muted); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; color: #3d4658; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}
.field textarea { resize: vertical; min-height: 96px; }
.field-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(47, 107, 255, 0.22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #9db6f5; box-shadow: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: #3d4658; }
.btn-ghost:hover { border-color: #c9d2e4; background: #fafbff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; border-color: var(--line); background: #fff; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-ai { background: linear-gradient(135deg, #5b6bff, #8a5cff); color: #fff; box-shadow: 0 6px 16px rgba(110, 92, 255, 0.25); }
.btn-ai:hover { filter: brightness(1.05); }
.btn-ai:disabled { background: #b9c0f5; box-shadow: none; }

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f5c6c1;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.demo-accounts {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.demo-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.demo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fafbff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #3a4358;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.demo-tip { font-size: 12px; color: #8a93a6; margin-top: 6px; }

/* ---------- 主界面 ---------- */
.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-title strong { font-size: 16px; }
.group-tag {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 1px 9px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-tag { font-size: 13px; color: var(--muted); }

.container { max-width: 920px; margin: 0 auto; padding: 26px 18px 70px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h2 { margin-bottom: 3px; }
.page-head .btn { align-self: center; }

.filter-tabs {
  display: flex;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: #55607a;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab em {
  font-style: normal;
  font-size: 12px;
  color: #9aa3b7;
  margin-left: 4px;
}
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tab.active em { color: var(--primary); }

.report-list { display: flex; flex-direction: column; gap: 12px; }

.report-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.16s;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}
.report-card:hover {
  border-color: #c7d5ff;
  box-shadow: 0 8px 22px rgba(24, 40, 78, 0.08);
  transform: translateY(-1px);
}
.rc-main { min-width: 0; flex: 1; }
.rc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; flex-wrap: wrap; }
.rc-title { font-size: 15.5px; font-weight: 600; }
.rc-id { font-size: 12px; color: #98a1b4; }
.badge {
  display: inline-block;
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.pending { color: var(--pending); background: var(--pending-bg); }
.badge.processing { color: var(--processing); background: var(--processing-bg); }
.badge.done { color: var(--done); background: var(--done-bg); }
.rc-desc {
  color: #4c5568;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.rc-meta { margin-top: 7px; font-size: 12.5px; color: #8a93a6; display: flex; gap: 14px; flex-wrap: wrap; }
.rc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ai-flag { font-size: 12px; color: #6a5cff; background: #f0eeff; border-radius: 999px; padding: 2px 9px; }

.empty {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border: 1px dashed #d8dfee;
  border-radius: var(--radius);
}
.empty-icon { font-size: 34px; margin-bottom: 10px; }
.empty p { font-weight: 600; margin-bottom: 4px; }

/* ---------- 表单 ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(24, 40, 78, 0.03);
}
.form-card { padding: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- 详情 ---------- */
.detail-card { padding: 22px; margin-bottom: 16px; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 16px;
}
.detail-grid > div { display: flex; flex-direction: column; gap: 3px; }
.detail-grid label { font-size: 12.5px; color: #8a93a6; }
.detail-grid span { font-size: 14px; word-break: break-word; }
.span-2 { grid-column: span 2; }
.status-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.ai-card { padding: 22px; }
.ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.ai-head h3 { margin-bottom: 2px; }
.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f6f4ff;
  border: 1px solid #e4ddff;
  color: #5a4bd6;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #d8d0ff;
  border-top-color: #6a5cff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-error {
  background: var(--danger-bg);
  border: 1px solid #f5c6c1;
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.ai-result { display: flex; flex-direction: column; gap: 10px; }
.suggestion {
  border: 1px solid #e8e6ff;
  background: #fbfaff;
  border-radius: 11px;
  padding: 13px 15px;
}
.suggestion h4 { margin: 0 0 4px; font-size: 14.5px; color: #3d33a8; }
.suggestion p { font-size: 13.5px; color: #4a5168; }
.suggestion.safety { border-color: #ffe0c2; background: #fff8ef; }
.suggestion.safety h4 { color: #a9600a; }
.ai-foot { margin-top: 12px; font-size: 12.5px; color: #98a1b4; }
.ai-test { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12.5px; }
.link { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 12.5px; padding: 0; font-family: inherit; }
.link:hover { text-decoration: underline; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: rgba(28, 35, 51, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-width: 90vw;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
  .topbar-title strong { display: none; }
  .container { padding: 18px 12px 60px; }
  .report-card { padding: 14px; }
  .rc-right { align-items: flex-end; }
  .ai-head { flex-direction: column; }
  .login-card { padding: 24px 20px; }
}
