/* ============================================================
   谁能测 · 统一设计系统（响应式，环保绿主题）
   ============================================================ */
:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  --accent: #2563eb;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --bg: #f6f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff; border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; height: 60px; gap: 8px;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; color: var(--primary-dark); white-space: nowrap; flex-shrink: 0; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #34d399);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 17px;
  flex-shrink: 0;
}
.brand .sub { font-size: 12px; color: var(--text-3); font-weight: 400; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 14px; border-radius: 8px; color: var(--text-2);
  font-weight: 500; transition: all .15s;
}
.nav-links a:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; }
.nav-links a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 18px; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.page-head p { color: var(--text-2); margin-top: 4px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title::before { content: ""; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all .15s;
  background: var(--primary); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--primary-dark); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; color: var(--text); background: #fff; transition: border .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* 选项 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 20px;
  background: #fff; cursor: pointer; font-size: 14px; color: var(--text-2);
  transition: all .15s; user-select: none;
}
.chip:hover { border-color: var(--primary); }
.chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }

/* ---------- 标签 / 徽章 ---------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px;
  font-weight: 500; background: #eef2ff; color: #4338ca; margin: 0 4px 4px 0;
}
.tag.green { background: var(--primary-light); color: var(--primary-dark); }
.tag.gray { background: #f3f4f6; color: var(--text-2); }
.badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.claimed { background: var(--primary-light); color: var(--primary-dark); }
.badge.official { background: #eff6ff; color: #1d4ed8; }
.badge.pending { background: var(--warn-bg); color: var(--warn); }

/* ---------- 首页筛选栏（flex 布局，全屏一行） ---------- */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-bar .input { flex: 1 1 240px; min-width: 160px; }
.filter-bar .select { width: auto; flex: 0 0 auto; min-width: 0; }
.filter-bar .select#fCity { width: 108px; }
.filter-bar .select#fScope { width: 150px; }

.view-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 12px;
}
.view-switch { display: flex; align-items: center; gap: 6px; }
.view-label { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.view-count { margin-left: auto; color: var(--text-2); font-size: 13px; white-space: nowrap; }

/* ---------- 分页 ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 18px; flex-wrap: wrap;
}
.pg-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  color: var(--text-2); font-size: 14px; cursor: pointer; transition: all .15s;
}
.pg-btn:hover:not(:disabled):not(.on) { border-color: var(--primary); color: var(--primary-dark); }
.pg-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-note { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 8px; }

/* ---------- 机构列表 ---------- */
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.inst-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: all .15s; }
.inst-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--primary-border); }
.inst-card .name { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.inst-card .meta { color: var(--text-2); font-size: 13px; margin: 6px 0; }
.inst-card .meta span { margin-right: 12px; }
.inst-card .scopes { margin: 8px 0 2px; }
.inst-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px;
  padding-top: 10px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; }

/* ---------- 匹配结果 ---------- */
.match-item { display: flex; gap: 16px; padding: 18px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; margin-bottom: 12px; position: relative; }
.score-ring { flex-shrink: 0; width: 64px; height: 64px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; }
.match-body { flex: 1; }
.match-body .mname { font-size: 16px; font-weight: 700; }
.match-body .factors { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.factor-chip { font-size: 12px; background: var(--bg); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px; color: var(--text-2); }
.factor-chip b { color: var(--text); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); }
.kpi .num { font-size: 28px; font-weight: 800; color: var(--primary-dark); }
.kpi .label { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.kpi .num.blue { color: var(--accent); }
.kpi .num.warn { color: var(--warn); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; font-weight: 600; color: var(--text-2); white-space: nowrap; }
tr:hover td { background: #fafbfc; }

/* ---------- 提示 / 空态 ---------- */
.empty { text-align: center; color: var(--text-3); padding: 48px 0; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert.warn { background: var(--warn-bg); border: 1px solid #fde68a; color: #92400e; }
.alert.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert.ok { background: var(--primary-light); border: 1px solid var(--primary-border); color: #065f46; }

/* ---------- 加载 ---------- */
.loading { text-align: center; color: var(--text-3); padding: 32px 0; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -5px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); max-width: 560px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow-lg); }
.modal h3 { margin-bottom: 12px; }

/* ---------- 页脚 ---------- */
.footer { text-align: center; color: var(--text-3); font-size: 12px; padding: 30px 16px; }

/* ---------- 资质附表查询 ---------- */
.qual-count { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.qual-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.qual-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.qual-table th, .qual-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.qual-table thead th { background: var(--bg); color: var(--text-2); font-weight: 600; white-space: nowrap; }
.qual-table tbody tr:last-child td { border-bottom: none; }
.qual-table tbody tr:hover { background: var(--primary-light); }

/* ---------- 登录态 / 认证 / 用户中心 ---------- */
.nav-user { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-user a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 14px; white-space: nowrap; }
.nav-user a:hover { background: var(--primary-light); color: var(--primary-dark); text-decoration: none; }
.nav-user a.nav-reg { background: var(--primary); color: #fff; }
.nav-user a.nav-reg:hover { background: var(--primary-dark); color: #fff; }

.auth-card { max-width: 440px; margin: 40px auto; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tab { flex: 1; text-align: center; padding: 9px 0; border-radius: 8px; cursor: pointer;
  font-weight: 600; color: var(--text-2); font-size: 14px; }
.auth-tab.on { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow); }
.code-row { display: flex; gap: 8px; }
.code-row .input { flex: 1; }
.code-btn { flex-shrink: 0; white-space: nowrap; }
.opt-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* 打码联系方式 */
.masked { color: var(--text-3); letter-spacing: 1px; }
.mask-tip { font-size: 13px; color: var(--warn); background: var(--warn-bg); border: 1px solid #fde68a;
  border-radius: 10px; padding: 10px 14px; margin-top: 8px; }

/* 扫码关注弹窗 */
.qr-modal .modal { max-width: 400px; text-align: center; }
.qr-img { width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); margin: 12px auto; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13px; }
.qr-img img { width: 100%; height: 100%; border-radius: 12px; object-fit: contain; }

/* 用户中心布局 */
.center-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.center-grid { display: grid; grid-template-columns: 240px 1fr; gap: 16px; margin-top: 16px; }
.center-side { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; align-self: start; }
.center-side a { display: block; padding: 10px 14px; border-radius: 8px; color: var(--text-2);
  font-size: 14px; margin-bottom: 2px; }
.center-side a:hover { background: var(--bg); text-decoration: none; }
.center-side a.on { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  body { font-size: 14px; }
  .nav-links { display: none; position: absolute; top: 60px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border); flex-direction: column; padding: 8px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .inst-grid { grid-template-columns: 1fr; }
  .match-item { flex-direction: column; }
  .page-head h1 { font-size: 20px; }
  .container { padding: 14px 12px; }
  .nav-user { margin-left: 0; }
  .center-grid { grid-template-columns: 1fr; }
  .center-side { display: flex; flex-wrap: wrap; gap: 2px; }
  .center-side a { flex: 0 0 auto; }
}
