:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --red: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-wrap[hidden] { display: none; }
.login-card { background: var(--card); border-radius: 16px; padding: 40px 32px; width: 100%; max-width: 400px;
  text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.logo { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 16px; background: var(--primary);
  color: #fff; font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.tip { color: var(--muted); font-size: 13px; line-height: 1.6; margin-top: 12px; text-align: left; }
.error { color: var(--red); font-size: 13px; margin-top: 12px; }
.mock-users { display: grid; gap: 8px; margin-top: 12px; }
.mock-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.brand { font-weight: 700; font-size: 16px; color: var(--primary); }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role-chip { background: #eff6ff; color: var(--primary); font-size: 12px; padding: 2px 8px; border-radius: 999px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.tab { flex: 1; padding: 12px 8px; border: none; background: none; font-size: 15px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

main { max-width: 860px; margin: 0 auto; padding: 16px; }

/* ---------- 卡片与表单 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px 16px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card h2 { font-size: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.full { margin-top: 12px; display: block; }
input, textarea, select {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 15px;
  background: #fff; color: var(--text); width: 100%; font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radio { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.radio input { width: auto; }
#f_solution_other { margin-top: 10px; }

/* 通知人员 */
.notify-group { margin-bottom: 8px; }
.notify-role { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.notify-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 14px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.check input { width: auto; accent-color: var(--primary); }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-block { display: block; width: 100%; margin-top: 16px; padding: 13px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-ghost { border: none; background: none; color: var(--muted); }
.btn-ghost:hover { color: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 8px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat-v { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-k { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 类型筛选 ---------- */
.type-filter { display: flex; gap: 8px; margin-bottom: 12px; }
.tf-btn { border: 1px solid var(--border); background: #f8fafc; border-radius: 999px;
  padding: 6px 18px; font-size: 14px; cursor: pointer; color: var(--muted); }
.tf-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 列表 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input#q { flex: 1; min-width: 160px; }
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range input { width: auto; }
.report-list { display: grid; gap: 10px; }
.report-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  transition: border-color .15s; position: relative; }
.report-item:hover { border-color: var(--primary); }
.ri-type { position: absolute; top: -1px; left: -1px; font-size: 11px; padding: 2px 8px;
  border-radius: 10px 0 8px 0; color: #fff; }
.t-mat { background: #0ea5e9; }
.t-prod { background: #f59e0b; }
.report-item { padding-top: 24px; }
.ri-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ri-no { font-weight: 600; font-size: 14px; }
.ri-product { font-size: 15px; font-weight: 600; }
.ri-spec { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.ri-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.defect { color: var(--red); }
.badge { font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.b-red { background: #fef2f2; color: var(--red); }
.b-blue { background: #eff6ff; color: var(--primary); }
.b-gray { background: #f3f4f6; color: #4b5563; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 500; white-space: nowrap; width: 1%; }
.detail-table td { color: var(--text); }

/* ---------- 弹窗 / 提示 ---------- */
.modal { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 32px; background: #111827;
  color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 14px; z-index: 200; max-width: 90vw; }
.toast.err { background: var(--red); }

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input#q { width: 100%; }
  .date-range input { flex: 1; }
  main { padding: 12px; }
  .card { padding: 16px 14px; }
  .table { display: block; overflow-x: auto; }
}
