:root {
  --bg: #f7f2ed;
  --card: #ffffff;
  --ink: #241f1c;
  --ink-2: #6d635c;
  --ink-3: #9a8f88;
  --line: #ece4dc;
  --primary: #b8493f;
  --primary-dark: #9c3a31;
  --primary-soft: #f6e5e1;
  --gold: #b9915c;
  --ok: #2f7d5d;
  --warn: #b06a17;
  --danger: #b8493f;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(58, 38, 28, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.page { max-width: 560px; margin: 0 auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 头部 ---------- */
.hero {
  position: relative;
  padding: 28px 22px 52px;
  background:
    radial-gradient(120% 90% at 80% 0%, #f2cfc8 0%, rgba(242, 207, 200, 0) 60%),
    radial-gradient(100% 80% at 0% 10%, #f7e3d6 0%, rgba(247, 227, 214, 0) 55%),
    linear-gradient(160deg, #fdf7f4 0%, #f8efe8 100%);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; right: -60px; top: -70px;
  width: 220px; height: 220px; border-radius: 50%;
  border: 1px solid rgba(184, 73, 63, 0.14);
}
.brand-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(184, 73, 63, 0.16);
  border-radius: 999px;
  font-size: 12px; letter-spacing: 0.5px; color: var(--primary);
  backdrop-filter: blur(6px);
}
.brand-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.hero h1 {
  margin: 14px 0 6px;
  font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: 0.5px;
}
.hero h1 span { color: var(--primary); }
.hero .sub { margin: 0; color: var(--ink-2); font-size: 14px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-badge {
  font-size: 12px; color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(184, 73, 63, 0.14);
  padding: 4px 10px; border-radius: 8px;
}

/* ---------- 主体卡片 ---------- */
.sheet {
  margin: -32px 14px 0;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 6px 18px 18px;
  position: relative;
  z-index: 2;
}

.intro {
  margin: 14px 0 4px;
  padding: 14px 14px;
  background: linear-gradient(135deg, #fdf6f2, #faf2ec);
  border: 1px solid #f3e6dd;
  border-radius: 14px;
  color: var(--ink-2);
  font-size: 14px;
  white-space: pre-wrap;
}
.notice-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px 12px;
  cursor: pointer;
  font-size: 14px; color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.notice-toggle .chev { transition: transform 0.2s; color: var(--ink-3); }
.notice-toggle.open .chev { transform: rotate(180deg); }
.notice-body {
  display: none;
  padding: 12px 2px 4px;
  color: var(--ink-2); font-size: 13px; line-height: 1.8;
  white-space: pre-wrap;
  border-bottom: 1px solid var(--line);
}
.notice-body.show { display: block; }

/* ---------- 表单 ---------- */
form { margin-top: 6px; }
.field { padding: 16px 2px 2px; }
.field-label {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin-bottom: 8px;
}
.req { color: var(--primary); font-size: 12px; font-weight: 500; }
.opt { color: var(--ink-3); font-size: 11px; font-weight: 400; }

.input, .textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fcfaf8;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;           /* 防止 iOS/微信聚焦时放大 */
  color: var(--ink);
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: #bfb4ad; font-size: 15px; }
.input:focus, .textarea:focus, select:focus {
  border-color: rgba(184, 73, 63, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(184, 73, 63, 0.1);
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.field-help { margin: 6px 2px 0; font-size: 12px; color: var(--ink-3); }
.field-error { margin: 6px 2px 0; font-size: 12px; color: var(--danger); display: none; }
.field.invalid .input, .field.invalid .textarea, .field.invalid select { border-color: var(--danger); background: #fff7f6; }
.field.invalid .field-error { display: block; }

/* 选项 */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  position: relative;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: #fcfaf8;
  border-radius: 999px;
  font-size: 14px; color: var(--ink-2);
  cursor: pointer;
  transition: all 0.16s;
  user-select: none;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.sel {
  background: var(--primary-soft);
  border-color: rgba(184, 73, 63, 0.45);
  color: var(--primary-dark);
  font-weight: 600;
}
.chip.sel::after {
  content: "✓";
  font-size: 12px;
  margin-left: 6px;
}
.qlink { color: var(--primary); font-size: 13px; text-decoration: none; border-bottom: 1px dashed rgba(184, 73, 63, 0.4); padding-bottom: 2px; }
select.input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%239a8f88' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* 图片上传 */
.uploader {
  border: 1px dashed #ddd1c8;
  background: #fcfaf8;
  border-radius: 14px;
  min-height: 108px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  color: var(--ink-3); font-size: 13px;
  cursor: pointer; position: relative; overflow: hidden;
}
.uploader input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.uploader .plus { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 20px; }
.uploader img { width: 100%; height: 160px; object-fit: cover; display: block; }
.uploader.has-img { border-style: solid; border-color: var(--line); background: #fff; }
.uploader-overlay {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(36, 31, 28, 0.72); color: #fff;
  font-size: 12px; padding: 4px 10px; border-radius: 8px;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* note 类型 */
.note-block {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: #fffaf0;
  border: 1px solid #f4e7d2;
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  font-size: 13px; color: #7a6551;
  white-space: pre-wrap;
}

/* ---------- 底部提交 ---------- */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bottom-bar .inner { max-width: 532px; margin: 0 auto; }
.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px;
  font-size: 17px; font-weight: 600; letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #c8554a, #a53b32);
  box-shadow: 0 8px 20px rgba(184, 73, 63, 0.28);
  cursor: pointer;
  transition: transform 0.12s, opacity 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.6; box-shadow: none; }
.tip-line { text-align: center; font-size: 11px; color: var(--ink-3); margin: 8px 0 0; }

/* ---------- 成功页 ---------- */
.success {
  display: none;
  padding: 40px 22px 30px;
  text-align: center;
  animation: fadeUp 0.4s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.success .check {
  width: 68px; height: 68px; margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e9f3ee, #d8ebe2);
  color: var(--ok); font-size: 32px;
  display: grid; place-items: center;
}
.success h2 { margin: 0 0 8px; font-size: 22px; }
.success p { margin: 0 auto; max-width: 380px; color: var(--ink-2); font-size: 14px; }
.code-box {
  margin: 22px auto 0; max-width: 340px;
  background: #fcfaf8; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px;
}
.code-box .k { font-size: 12px; color: var(--ink-3); }
.code-box .v { font-size: 20px; font-weight: 700; letter-spacing: 1.5px; color: var(--primary); margin-top: 2px; }
.code-box .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.actions { display: flex; gap: 10px; margin: 22px auto 0; max-width: 340px; }
.btn-ghost {
  flex: 1; padding: 12px; border-radius: 12px; font-size: 14px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn-soft {
  flex: 1; padding: 12px; border-radius: 12px; font-size: 14px;
  background: var(--primary-soft); border: 1px solid rgba(184, 73, 63, 0.18); color: var(--primary-dark);
  cursor: pointer; text-decoration: none; text-align: center; font-weight: 600;
}

/* ---------- 查询页 ---------- */
.query-card { margin: 22px 14px 0; background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 22px 18px; }
.query-card h2 { margin: 0 0 4px; font-size: 19px; }
.query-card .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 18px; }
.result-list { margin-top: 18px; display: grid; gap: 12px; }
.result-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fcfaf8; }
.result-item .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.result-item .code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--ink-2); }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.badge.pending { background: #fdf3e3; color: var(--warn); }
.badge.approved { background: #e9f4ee; color: var(--ok); }
.badge.paid { background: #e8f0f8; color: #2c5f8a; }
.badge.rejected { background: #fdeceb; color: var(--danger); }
.result-item .meta { margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 30px 0; }

/* ---------- 首页 ---------- */
.home-wrap { max-width: 560px; margin: 0 auto; padding: 48px 18px 40px; }
.home-wrap h1 { font-size: 24px; margin: 0 0 6px; }
.home-wrap .sub { color: var(--ink-3); margin: 0 0 26px; font-size: 14px; }
.act-list { display: grid; gap: 12px; }
.act-item {
  display: block; text-decoration: none;
  background: #fff; border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow); border: 1px solid #f2ebe5;
  transition: transform 0.15s;
}
.act-item:active { transform: scale(0.99); }
.act-item .t { font-size: 17px; font-weight: 600; color: var(--ink); }
.act-item .s { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.act-item .go { color: var(--primary); font-size: 13px; margin-top: 10px; font-weight: 600; }

/* 通用提示条 */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(10px);
  background: rgba(36, 31, 28, 0.9); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all 0.24s; z-index: 50;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
