/* ============================================================
 * form-v2.css — 飞书问卷风格（移动端优先）
 * 设计语言：白卡 + 灰底 + 3370FF 主色，12px 圆角，宽松行距
 * ============================================================ */
:root {
  --fb-primary: #3370ff;
  --fb-primary-press: #245bdb;
  --fb-primary-weak: #e1eaff;
  --fb-bg: #f2f3f5;
  --fb-card: #ffffff;
  --fb-text: #1f2329;
  --fb-sub: #646a73;
  --fb-hint: #8f959e;
  --fb-line: #eff0f1;
  --fb-danger: #f54a45;
  --fb-success: #34c724;
  --fb-warn: #ff8800;
  --fb-radius: 12px;
  --fb-shadow: 0 1px 2px rgba(31, 35, 41, 0.04);
  --fb-safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body { padding-bottom: calc(76px + var(--fb-safe)); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--fb-primary); text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.fb-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.fb-nav.scrolled { border-bottom-color: var(--fb-line); }
.fb-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fb-text);
}
.fb-nav-btn:active { background: #f2f3f5; }
.fb-nav-btn[hidden] { display: none; }
.fb-nav-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}
.fb-nav-side { width: 36px; flex: none; }

/* ---------- 表单头 ---------- */
.fb-hero {
  padding: 20px 20px 18px;
  background: var(--fb-card);
}
.fb-hero h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.fb-hero p {
  margin: 0;
  color: var(--fb-sub);
  font-size: 13.5px;
  line-height: 1.7;
}
.fb-hero-lead {
  padding-top: 2px;
  color: var(--fb-sub) !important;
  font-size: 14px !important;
}

.fb-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.fb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  background: #f2f3f5;
  color: var(--fb-sub);
  font-size: 12px;
  font-weight: 500;
}
.fb-badge.primary { background: var(--fb-primary-weak); color: var(--fb-primary); }
.fb-badge.urgent { background: #ffece8; color: var(--fb-danger); }
.fb-badge.ok { background: #e8f8e6; color: #1f8b17; }

.fb-progress {
  padding: 0 20px 14px;
  background: var(--fb-card);
}
.fb-progress-track {
  height: 3px;
  border-radius: 3px;
  background: #e9ebef;
  overflow: hidden;
}
.fb-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--fb-primary);
  transition: width 0.24s ease;
}
.fb-progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--fb-hint);
  font-size: 12px;
}

/* ---------- 表单列表 ---------- */
.fb-list { padding: 12px; }
.fb-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 8px 10px;
}
.fb-list-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.fb-list-head span { color: var(--fb-hint); font-size: 12px; }

.fb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px 14px 14px 16px;
  border: 0;
  border-radius: var(--fb-radius);
  background: var(--fb-card);
  box-shadow: var(--fb-shadow);
  text-align: left;
  transition: transform 0.12s ease, background 0.12s;
}
.fb-item:active { transform: scale(0.985); background: #fafbfc; }
.fb-item-body { flex: 1; min-width: 0; }
.fb-item h3 {
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--fb-text);
}
.fb-item p {
  margin: 0;
  color: var(--fb-sub);
  font-size: 13px;
  line-height: 1.5;
}
.fb-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--fb-hint);
  font-size: 12px;
}
.fb-item-meta .fb-dot { flex: none; }
.fb-chev {
  flex: none;
  color: #bbbfc4;
  font-size: 18px;
  line-height: 1;
}
.fb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fb-hint);
}
.fb-dot.published { background: var(--fb-success); }
.fb-dot.paused { background: var(--fb-warn); }
.fb-dot.closed { background: #bbbfc4; }

/* ---------- 分组卡片 ---------- */
.fb-main { padding: 12px; }
.fb-card {
  margin-bottom: 12px;
  padding: 4px 18px 8px;
  border-radius: var(--fb-radius);
  background: var(--fb-card);
  box-shadow: var(--fb-shadow);
}
.fb-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 4px;
}
.fb-card-head h2 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}
.fb-card-head .fb-sec-score {
  color: var(--fb-hint);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.fb-card-sub {
  padding-bottom: 6px;
  color: var(--fb-hint);
  font-size: 12px;
}
.fb-divider { height: 1px; margin: 8px 0; background: var(--fb-line); }

/* ---------- 题目 ---------- */
.fb-q { padding: 14px 0 6px; }
.fb-q + .fb-q { border-top: 1px solid var(--fb-line); }
.fb-q-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.fb-q-idx {
  flex: none;
  min-width: 20px;
  height: 20px;
  margin-top: 2px;
  padding: 0 6px;
  border-radius: 10px;
  background: #f2f3f5;
  color: var(--fb-hint);
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}
.fb-q-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
}
.fb-q-max {
  flex: none;
  margin-top: 3px;
  color: var(--fb-hint);
  font-size: 12px;
}
.fb-q-desc {
  margin: 8px 0 0 28px;
  color: var(--fb-sub);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-line;
}
.fb-q-desc.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fb-q-toggle {
  margin: 6px 0 2px 28px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--fb-primary);
  font-size: 12.5px;
}

/* ---------- 评分（分段格子） ---------- */
.fb-rate {
  display: flex;
  gap: 3px;
  margin: 12px 0 4px 28px;
}
.fb-rate-cell {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 1px solid #e5e6eb;
  border-radius: 7px;
  background: #fff;
  color: var(--fb-sub);
  font-size: 13px;
  font-weight: 500;
  line-height: 34px;
  text-align: center;
  transition: all 0.12s ease;
}
.fb-rate-cell:first-child { border-radius: 8px 4px 4px 8px; }
.fb-rate-cell:last-child { border-radius: 4px 8px 8px 4px; }
.fb-rate-cell:active { background: #f7f8fa; }
.fb-rate-cell.on {
  border-color: var(--fb-primary);
  background: var(--fb-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(51, 112, 255, 0.24);
}
.fb-rate-scale {
  display: flex;
  justify-content: space-between;
  margin: 2px 0 4px 28px;
  color: var(--fb-hint);
  font-size: 11px;
}
.fb-rate-write {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px 28px;
}
.fb-rate-write input {
  width: 90px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}
.fb-rate-write input:focus { border-color: var(--fb-primary); outline: none; }
.fb-rate-write span { color: var(--fb-hint); font-size: 13px; }

.fb-picked {
  margin-left: 28px;
  color: var(--fb-primary);
  font-size: 12px;
  font-weight: 500;
}
.fb-picked[hidden] { display: none; }

/* ---------- 矩阵 ---------- */
.fb-mrow {
  padding: 14px 0 10px;
}
.fb-mrow + .fb-mrow { border-top: 1px solid var(--fb-line); }
.fb-mrow-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
}
.fb-mrow-title span:first-child { flex: 1; }
.fb-mrow-max { flex: none; margin-top: 2px; color: var(--fb-hint); font-size: 12px; }
.fb-mrow-std {
  margin: 6px 0 0;
  color: var(--fb-sub);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-line;
}
.fb-mrow-std.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fb-mrow .fb-rate { margin-left: 0; }
.fb-mrow .fb-rate-scale { margin-left: 0; }
.fb-comment {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fafbfc;
  font-size: 13.5px;
  line-height: 1.6;
  resize: none;
}
.fb-comment:focus { border-color: var(--fb-primary); background: #fff; outline: none; }
.fb-comment-label {
  margin-top: 10px;
  color: var(--fb-hint);
  font-size: 12px;
}

/* ---------- 其它题型 ---------- */
.fb-field { padding: 14px 0 6px; }
.fb-field + .fb-field { border-top: 1px solid var(--fb-line); }
.fb-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
}
.fb-field input[type="text"],
.fb-field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}
.fb-field input:focus, .fb-field select:focus { border-color: var(--fb-primary); outline: none; }

.fb-html {
  padding: 12px 0;
  color: var(--fb-sub);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-line;
}

.fb-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 12px;
  border: 1px dashed #dcdfe3;
  border-radius: 10px;
  background: #fafbfc;
  color: var(--fb-sub);
  font-size: 13px;
}
.fb-file-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--fb-primary-weak);
  color: var(--fb-primary);
  font-size: 15px;
}

/* ---------- 底部提交栏 ---------- */
.fb-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px 16px calc(10px + var(--fb-safe));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--fb-line);
}
.fb-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}
.fb-bar-progress {
  flex: 1;
  min-width: 0;
  color: var(--fb-hint);
  font-size: 12px;
}
.fb-bar-progress strong { color: var(--fb-text); font-size: 15px; font-weight: 600; }
.fb-primary {
  flex: none;
  height: 44px;
  padding: 0 28px;
  border: 0;
  border-radius: 8px;
  background: var(--fb-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}
.fb-primary:active { background: var(--fb-primary-press); }
.fb-primary:disabled {
  background: #c9cdd4;
  color: #fff;
  cursor: default;
}

/* ---------- 空态 / 令牌 ---------- */
.fb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 28px;
  text-align: center;
}
.fb-empty-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: var(--fb-primary-weak);
  color: var(--fb-primary);
  font-size: 28px;
}
.fb-empty h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.fb-empty p { margin: 0 0 22px; color: var(--fb-sub); font-size: 14px; line-height: 1.7; }
.fb-empty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border-radius: 8px;
  background: var(--fb-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}
.fb-token {
  width: 100%;
  margin-top: 8px;
  text-align: left;
}
.fb-token summary {
  color: var(--fb-hint);
  font-size: 12.5px;
  text-align: center;
  cursor: pointer;
  list-style: none;
}
.fb-token summary::-webkit-details-marker { display: none; }
.fb-token-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.fb-token-row input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}
.fb-token-row button {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #f2f3f5;
  color: var(--fb-text);
  font-size: 13px;
  font-weight: 500;
}
.fb-token-tip { margin-top: 8px; color: var(--fb-hint); font-size: 12px; }
.fb-token-tip.error { color: var(--fb-danger); }

/* ---------- 轻提示 ---------- */
.fb-toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--fb-safe));
  z-index: 50;
  max-width: 80vw;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(31, 35, 41, 0.88);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.fb-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 桌面端 ---------- */
@media (min-width: 720px) {
  body { padding-bottom: 96px; }
  .fb-nav, .fb-hero, .fb-progress, .fb-list, .fb-main { max-width: 720px; margin-left: auto; margin-right: auto; }
  .fb-hero { padding: 32px 28px 24px; border-radius: 0 0 16px 16px; }
  .fb-progress { border-radius: 0 0 16px 16px; }
  .fb-hero h1 { font-size: 26px; }
  .fb-card { padding: 8px 24px 12px; }
  .fb-item { padding: 20px; }
  .fb-item:hover { background: #fafbfc; }
  .fb-rate-cell { height: 40px; line-height: 38px; }
}
