/* ========== 告知书生成器 公共样式 ========== */

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

:root {
  --brand-red: #c81623;
  --brand-red-dark: #a01018;
  --brand-red-bg: #fce8ea;
  /* 烫金色系 */
  --gold: #d4af37;
  --gold-dark: #8a6d1f;
  --gold-deep: #b8860b;
  --gold-light: #f7e8b8;
  --gold-bg: #fbf5e6;
  --text-main: #222;
  --text-sub: #666;
  --text-light: #999;
  --border: #eee;
  --bg-page: #f7f3ea;
  --bg-card: #fff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* 暖纸底纹：斜向烫金细纹 + 顶部柔光 */
body {
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(184, 134, 11, 0.028) 0px,
      rgba(184, 134, 11, 0.028) 1px,
      transparent 1px,
      transparent 9px
    ),
    radial-gradient(ellipse at 50% 0%, #fffdf6 0%, #f8f2e4 45%, #f3ebd9 100%);
  background-attachment: fixed;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

input, textarea {
  width: 100%;
}

/* ========== 应用外壳 ========== */

.app {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-page);
  min-height: 100vh;
  padding-bottom: 80px;
  position: relative;
}

/* ========== 顶部导航 ========== */

.app-header {
  background:
    radial-gradient(ellipse at 50% -30%, rgba(247, 232, 184, 0.28) 0%, transparent 62%),
    linear-gradient(150deg, #8e0f18 0%, var(--brand-red) 45%, #960d16 100%);
  color: #fff;
  padding: 22px 20px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 6px 20px rgba(120, 12, 20, 0.28);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, #9c7a1a, #e8c76a, #fdf3d4, #e8c76a, #9c7a1a) 1;
  text-align: center;
  overflow: hidden;
}

/* 顶部金色饰线：线—菱形—线 */
.header-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.header-ornament .ornament-line {
  display: block;
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e8c76a);
}

.header-ornament .ornament-line:last-child {
  background: linear-gradient(90deg, #e8c76a, transparent);
}

.header-ornament .ornament-diamond {
  display: block;
  width: 7px;
  height: 7px;
  background: linear-gradient(135deg, #fdf3d4, #d4af37);
  transform: rotate(45deg);
}

.app-header h1 {
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 3px;
  background: linear-gradient(100deg, #f6e2a8 0%, #fffaf0 45%, #f6e2a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.app-header p {
  font-size: 11.5px;
  opacity: 0.9;
  font-weight: 300;
  color: #ffe4bb;
  letter-spacing: 0.5px;
}

/* ========== 通用区块 ========== */

.section {
  background: linear-gradient(180deg, #fffefb 0%, #fefbf3 100%);
  margin: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 10px rgba(150, 116, 30, 0.07);
  border: 1px solid rgba(224, 205, 160, 0.5);
  position: relative;
}

/* 卡片顶部烫金细线 */
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, transparent, var(--gold-deep), var(--gold-light), var(--gold-deep), transparent);
  opacity: 0.75;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 15px;
  background: linear-gradient(180deg, var(--gold-deep), var(--gold), var(--gold-light));
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(184, 134, 11, 0.35);
}

/* ========== 模板选择卡片 ========== */

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.template-card {
  background: linear-gradient(180deg, #fffefb 0%, #fdf9f0 100%);
  border: 1.5px solid rgba(224, 205, 160, 0.6);
  border-radius: 14px;
  padding: 15px 10px 13px;
  text-align: center;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.template-card:active {
  transform: scale(0.97);
}

.template-card.active {
  border-color: var(--gold-deep);
  background: linear-gradient(160deg, #fffdf5 0%, #fbf3dd 100%);
  box-shadow: 0 4px 16px rgba(184, 134, 11, 0.22), inset 0 0 0 1px rgba(247, 232, 184, 0.8);
}

.template-card.active::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(247, 232, 184, 0.55), transparent 70%);
  pointer-events: none;
}

.template-card.active::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 19px;
  height: 19px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  line-height: 19px;
  font-weight: bold;
  box-shadow: 0 1px 5px rgba(184, 134, 11, 0.5);
}

.template-icon {
  font-size: 21px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(150deg, #fdf6e4 0%, #f5e9cd 100%);
  border: 1px solid rgba(224, 205, 160, 0.8);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.9);
  transition: all 0.22s;
}

.template-card.active .template-icon {
  background: linear-gradient(150deg, #fbeec4 0%, #e8cf87 100%);
  border-color: var(--gold-deep);
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.template-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  letter-spacing: 0.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}

.template-card.active .template-name {
  color: var(--gold-dark);
  font-weight: 700;
}

/* ========== 表单 ========== */

.form-item {
  margin-bottom: 14px;
}

.form-item:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 7px;
  font-weight: 500;
}

.form-label .required {
  color: var(--brand-red);
  margin-left: 2px;
}

/* 报价实时合计（自动累计，与生成逻辑一致） */
.quote-total {
  margin: 2px 0 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--brand-red-dark);
  background: var(--brand-red-bg);
  border: 1px solid #f3c9cd;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.quote-total b {
  font-size: 17px;
  color: var(--brand-red);
  padding: 0 2px;
}

.autosave-tag {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--gold-dark);
  background: linear-gradient(135deg, #fdf6e4 0%, #f5e9cd 100%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(224, 205, 160, 0.75);
  border-radius: 10px;
  font-size: 14px;
  background: linear-gradient(180deg, #fffefb 0%, #fdf8ec 100%);
  transition: all 0.2s;
  box-shadow: inset 0 1px 2px rgba(150, 116, 30, 0.05);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--gold-deep);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.16), inset 0 1px 2px rgba(150, 116, 30, 0.04);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ========== 按钮 ========== */

.btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
  letter-spacing: 1px;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #d11c2a 0%, var(--brand-red) 45%, #960d16 100%);
  color: #fff;
  box-shadow: 0 5px 16px rgba(180, 18, 30, 0.32), inset 0 1px 0 rgba(253, 243, 212, 0.4);
  border: 1px solid rgba(232, 199, 106, 0.6);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* 掠过的金色高光 */
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 248, 224, 0.35), transparent);
  transform: skewX(-22deg);
  animation: btn-sheen 3.4s ease-in-out infinite;
}

@keyframes btn-sheen {
  0%, 62% { left: -60%; }
  88%, 100% { left: 130%; }
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(200, 22, 35, 0.26);
}

.btn-secondary {
  background: linear-gradient(180deg, #fffefb 0%, #fdf7ea 100%);
  color: var(--brand-red);
  border: 1px solid rgba(200, 22, 35, 0.45);
  box-shadow: 0 2px 6px rgba(150, 116, 30, 0.08);
}

.btn-row {
  display: flex;
  gap: 10px;
  padding: 0 12px;
}

.btn-row .btn {
  flex: 1;
}

/* ========== 预览区（重写：直接显示 img，长按更稳） ========== */

.preview-section {
  background: var(--bg-card);
  margin: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.long-press-hint {
  background: linear-gradient(135deg, #fffaea 0%, #fbf2d9 100%);
  border-left: 4px solid var(--gold-deep);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #7a5f12;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.12);
  animation: pulse-hint 2.2s ease-in-out infinite;
}

.long-press-hint .hint-icon {
  font-size: 20px;
  flex-shrink: 0;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.img-stage {
  background:
    repeating-conic-gradient(#f7f1e2 0% 25%, #fdfaf2 0% 50%) 50% / 18px 18px;
  border-radius: 12px;
  padding: 10px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(224, 205, 160, 0.7);
  box-shadow: inset 0 2px 8px rgba(150, 116, 30, 0.08);
}

.img-loading {
  color: var(--text-sub);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
}

.img-loading .mask-spinner {
  border-color: rgba(200, 22, 35, 0.2);
  border-top-color: var(--brand-red);
}

.final-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(120, 90, 20, 0.18), 0 0 0 1px rgba(184, 134, 11, 0.35);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: default; /* 关键：允许 iOS 长按弹出菜单 */
  touch-action: manipulation;
  animation: img-in 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes img-in {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 4px;
  background: linear-gradient(180deg, #fffefb 0%, #fdf7ea 100%);
  border: 1px solid rgba(224, 205, 160, 0.8);
  border-radius: 11px;
  font-size: 12px;
  color: var(--text-sub);
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(150, 116, 30, 0.06);
}

.action-btn:active {
  background: linear-gradient(180deg, #fdf3dd 0%, #f8ead0 100%);
  border-color: var(--gold-deep);
  color: var(--gold-dark);
  transform: scale(0.96);
}

.action-icon {
  font-size: 21px;
  filter: saturate(0.9);
}

/* ========== 大图预览弹层 ========== */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.2s;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}

.lightbox-close {
  color: #fff;
  font-size: 22px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.lightbox-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  -webkit-touch-callout: default;
  user-select: none;
}

/* ========== 引导浮层 ========== */

.guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.3s;
}

.guide-card {
  background: linear-gradient(180deg, #fffefb 0%, #fdf8ec 100%);
  border-radius: 16px;
  padding: 26px 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(224, 205, 160, 0.8);
}

.guide-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 1px;
  background: linear-gradient(100deg, #a67c1a, #d9b64a, #a67c1a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.guide-steps {
  text-align: left;
  background: linear-gradient(180deg, #fffdf7 0%, #fbf5e6 100%);
  border: 1px solid rgba(224, 205, 160, 0.7);
  border-radius: 11px;
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-main);
}

.guide-step {
  margin: 4px 0;
}

.guide-step b {
  color: var(--brand-red);
  margin-right: 4px;
}

.guide-img {
  width: 100%;
  max-width: 240px;
  border-radius: var(--radius-sm);
  margin: 0 auto 16px;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tip {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
  margin-top: 10px;
  line-height: 1.6;
}

.tip b {
  color: var(--brand-red);
}

/* ========== 告知书海报内部样式 ========== */

.poster-container {
  width: 750px;
  background: #fff;
  padding: 50px 60px 60px;
  position: relative;
  color: #222;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
}

.poster-logo {
  height: 56px;
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.poster-logo-img {
  height: 48px;
  object-fit: contain;
}

.poster-logo-text {
  font-size: 28px;
  font-weight: bold;
  color: var(--brand-red);
  letter-spacing: 2px;
}

.poster-title {
  text-align: center;
  font-size: 56px;
  font-weight: bold;
  color: var(--brand-red);
  margin: 24px 0 36px;
  letter-spacing: 4px;
}

.poster-greeting {
  font-size: 30px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #222;
}

.poster-body {
  font-size: 28px;
  color: #333;
  line-height: 1.9;
  margin-bottom: 24px;
  text-align: justify;
}

.poster-card {
  background: var(--brand-red-bg);
  border-left: 6px solid var(--brand-red);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 20px 0;
}

.poster-card-title {
  font-size: 30px;
  font-weight: bold;
  color: var(--brand-red);
  margin-bottom: 12px;
}

.poster-card-content {
  font-size: 26px;
  color: #333;
  line-height: 1.8;
}

.poster-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.poster-list li {
  font-size: 28px;
  color: #333;
  line-height: 1.9;
  padding-left: 36px;
  position: relative;
  margin-bottom: 8px;
}

.poster-list li::before {
  content: attr(data-num);
  position: absolute;
  left: 0;
  color: var(--brand-red);
  font-weight: bold;
}

.poster-section-title {
  font-size: 30px;
  font-weight: bold;
  color: var(--brand-red);
  margin: 24px 0 12px;
}

.poster-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
  margin: 32px 0 24px;
}

.poster-footer {
  background: linear-gradient(135deg, #fef6f7 0%, #fce8ea 100%);
  border-radius: 12px;
  padding: 24px 28px;
  margin-top: 32px;
}

.poster-footer-item {
  font-size: 24px;
  color: #444;
  line-height: 1.7;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.poster-footer-item strong {
  color: var(--brand-red);
  font-weight: 600;
  min-width: 110px;
  flex-shrink: 0;
}

.poster-sign {
  text-align: right;
  font-size: 24px;
  color: #666;
  margin-top: 20px;
  font-style: italic;
}

.poster-sign strong {
  color: var(--brand-red);
  font-style: normal;
  font-weight: 600;
}

/* 装修公司函版式：更紧凑 */
.poster-decoration-company .poster-title {
  font-size: 44px;
  letter-spacing: 2px;
}
.poster-decoration-company .poster-body,
.poster-decoration-company .poster-list li {
  font-size: 24px;
}
.poster-decoration-company .poster-section-title {
  font-size: 28px;
}

/* 报价函：表格 */
.poster-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 24px;
}

.poster-table thead th {
  background: var(--brand-red);
  color: #fff;
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
}

.poster-table tbody td {
  border: 1px solid #eee;
  padding: 10px 8px;
  text-align: center;
  color: #333;
}

.poster-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.poster-table .total-row {
  background: var(--brand-red-bg) !important;
  font-weight: bold;
  color: var(--brand-red);
}

.poster-plan-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--brand-red);
  margin: 20px 0 8px;
  text-align: center;
}

/* ========== Toast ========== */

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(160deg, rgba(48, 40, 26, 0.94) 0%, rgba(30, 24, 14, 0.94) 100%);
  color: #fdf3d4;
  padding: 13px 22px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 80%;
  text-align: center;
  border: 1px solid rgba(212, 175, 55, 0.5);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.toast.show {
  opacity: 1;
}

/* ========== 加载遮罩 ========== */

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  flex-direction: column;
  gap: 12px;
  color: #fff;
  font-size: 14px;
}

.mask.show {
  display: flex;
}

.mask-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 响应式 ========== */

@media (max-width: 360px) {
  .template-grid {
    grid-template-columns: 1fr;
  }
  .template-name {
    font-size: 12px;
  }
}

/* ========== 顶部导航（三页通用） ========== */

.topnav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
}
.topnav-brand {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-red);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.topnav-links {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.topnav-links a {
  text-decoration: none;
  font-size: 12.5px;
  color: var(--text-sub);
  padding: 6px 10px;
  border-radius: 999px;
  transition: all 0.15s;
  white-space: nowrap;
}
.topnav-links a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
  font-weight: 600;
}
.topnav-links a:not(.active):active {
  background: var(--brand-red-bg);
  color: var(--brand-red);
}

/* ========== 问卷页 / 展示页 通用骨架 ========== */

.subpage {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 90px;
  min-height: 100vh;
}
.subpage .app-header {
  position: static;
}
.subpage-head {
  text-align: center;
  padding: 18px 20px 6px;
}
.subpage-head h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 1px;
}
.subpage-head p {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* ========== 问卷表单 ========== */

.survey-form .field {
  margin-bottom: 18px;
}
.survey-form label.q {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}
.survey-form label.q .req {
  color: var(--brand-red);
  margin-left: 2px;
}
.survey-form .hint {
  font-size: 11.5px;
  color: var(--text-light);
  margin-top: 6px;
  line-height: 1.5;
}

.opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.opt-chip {
  flex: 1 1 auto;
  min-width: 88px;
  text-align: center;
  padding: 10px 12px;
  border: 1.5px solid #e4dcc4;
  border-radius: var(--radius-sm);
  background: #fffdf7;
  font-size: 13px;
  color: var(--text-sub);
  transition: all 0.15s;
  cursor: pointer;
  user-select: none;
}
.opt-chip.active {
  border-color: var(--brand-red);
  background: var(--brand-red-bg);
  color: var(--brand-red);
  font-weight: 600;
}

.star-row {
  display: flex;
  gap: 8px;
  font-size: 34px;
  line-height: 1;
}
.star {
  color: #e0d6bd;
  cursor: pointer;
  transition: transform 0.1s, color 0.1s;
  user-select: none;
}
.star.active { color: #f5b400; }
.star:active { transform: scale(1.2); }
.star-label {
  font-size: 13px;
  color: var(--brand-red);
  font-weight: 600;
  margin-top: 8px;
  min-height: 18px;
}

.two-col {
  display: flex;
  gap: 10px;
}
.two-col .form-item { flex: 1; }
.saving-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fff7e6, #fdeccd);
  border: 1px solid #f0d49a;
  font-size: 13px;
  color: #8a5a00;
  display: none;
}
.saving-preview.show { display: block; }
.saving-preview b { color: var(--brand-red); font-size: 16px; }

/* ========== 问卷成功页 ========== */

.thank-card {
  text-align: center;
  padding: 30px 20px;
}
.thank-icon {
  font-size: 56px;
  margin-bottom: 12px;
}
.thank-card h2 {
  font-size: 20px;
  color: var(--brand-red);
  margin-bottom: 10px;
}
.thank-card p {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
}
.thank-saving {
  margin: 18px auto;
  max-width: 280px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff7e6, #fdeccd);
  border: 1px solid #f0d49a;
}
.thank-saving .big {
  font-size: 30px;
  font-weight: 800;
  color: var(--brand-red);
}
.thank-saving .lbl {
  font-size: 12px;
  color: #8a5a00;
  margin-top: 4px;
}

/* ========== 案例展示页 ========== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 14px 12px;
}
.kpi-card {
  background: linear-gradient(160deg, #fffefb, #fef7ea);
  border: 1px solid rgba(224, 205, 160, 0.6);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(150, 116, 30, 0.07);
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 14px; right: 14px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-deep), var(--gold-light), var(--gold-deep), transparent);
  opacity: 0.7;
}
.kpi-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-red);
  line-height: 1.1;
}
.kpi-num .unit { font-size: 14px; font-weight: 600; margin-left: 2px; }
.kpi-lbl {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 6px;
}

.selling-point {
  margin: 8px 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #8e0f18 0%, var(--brand-red) 55%, #960d16 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(150, 18, 24, 0.28);
}
.selling-point .sp-title {
  font-size: 13px;
  color: #ffe4bb;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.selling-point .sp-line {
  font-size: 14px;
  line-height: 1.9;
}
.selling-point .sp-line b {
  color: #ffe27a;
  font-size: 18px;
  margin: 0 2px;
}

.comment-wall {
  margin: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comment-item {
  background: linear-gradient(180deg, #fffefb, #fefbf3);
  border: 1px solid rgba(224, 205, 160, 0.6);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: 0 2px 8px rgba(150, 116, 30, 0.06);
}
.comment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.comment-stars {
  color: #f5b400;
  font-size: 14px;
  letter-spacing: 1px;
}
.comment-meta {
  font-size: 11px;
  color: var(--text-light);
}
.comment-text {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-main);
}
.comment-save {
  display: inline-block;
  margin-top: 8px;
  font-size: 11.5px;
  color: #07a04a;
  background: rgba(7, 160, 74, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.bar-wrap { margin: 4px 12px 0; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.bar-row .bar-name { width: 76px; color: var(--text-sub); flex: none; }
.bar-track { flex: 1; height: 10px; background: #f0e9d6; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-deep), var(--brand-red)); }
.bar-val { width: 44px; text-align: right; color: var(--text-main); flex: none; font-weight: 600; }

.empty-tip-lg {
  text-align: center;
  padding: 50px 24px;
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.8;
}
.empty-tip-lg .em-icon { font-size: 42px; display: block; margin-bottom: 10px; }

.demo-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 11px;
  background: #fff3d6;
  color: #8a5a00;
  border-radius: 999px;
  vertical-align: middle;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin: 14px 12px;
}
.toolbar .btn { flex: 1; }

.dash-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin: 16px 12px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-subtitle::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 15px;
  background: linear-gradient(180deg, var(--gold-deep), var(--gold), var(--gold-light));
  border-radius: 3px;
}

/* ========== 按钮（复用 app 内 .btn 体系，这里补基础定义以防独立页使用） ========== */
.btn {
  display: inline-block;
  text-align: center;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(200, 22, 35, 0.3);
}
.btn-secondary {
  background: #fff;
  color: var(--brand-red);
  border: 1.5px solid var(--brand-red);
}
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: 0.5; }

/* ========== 告知书页 · 客户调研口碑模块 ========== */

.research-module {
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  border: 1px solid #d8e6f5;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 12px rgba(40, 110, 180, 0.06);
}
.module-desc {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
  margin: 0 0 12px;
}
.module-desc b { color: var(--brand-red); }

.module-store {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e3edf6;
  border-radius: var(--radius-sm);
}
.module-store .ms-label {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
}
.module-store .ms-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-red);
  word-break: break-all;
}

.module-link-tip {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: #1a6fb0;
  background: rgba(26, 111, 176, 0.08);
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.module-empty { margin: 6px 12px 2px; }

/* ========== 问卷页 · 门店归属横幅 ========== */

.store-banner {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1a6fb0;
  background: linear-gradient(135deg, #e8f3ff, #d6eaff);
  border: 1px solid #bcdcff;
  border-radius: var(--radius-sm);
  text-align: center;
}
.store-banner b { color: var(--brand-red); }

/* ========== 案例展示页 · 客户真实明细 ========== */

.detail-list {
  margin: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.detail-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fffefb, #fefbf3);
  border: 1px solid rgba(224, 205, 160, 0.6);
  border-radius: var(--radius-md);
  padding: 14px 14px 14px 18px;
  box-shadow: 0 2px 8px rgba(150, 116, 30, 0.06);
}
.detail-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold-deep), var(--brand-red));
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.detail-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}
.detail-meta {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.detail-energy {
  font-size: 12.5px;
  color: var(--text-sub);
  background: linear-gradient(135deg, #f4fbf4, #eafaef);
  border: 1px solid #cfe9d6;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.7;
}
.detail-energy b {
  color: var(--brand-red);
  font-size: 14px;
  margin: 0 2px;
}
.detail-energy .save {
  font-style: normal;
  color: #07a04a;
  font-weight: 700;
  margin-left: 4px;
}
.detail-rec {
  font-size: 12.5px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.detail-comment {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-main);
  background: linear-gradient(180deg, #fffdf7, #fbf5e6);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 8px;
  border-left: 3px solid var(--gold-deep);
}
.detail-foot {
  font-size: 11px;
  color: var(--text-light);
  text-align: right;
}

/* ============ 媒体上传（电费截图 / 语音评价） ============ */
.media-up {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.media-pick-btn {
  align-self: flex-start;
}
.media-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fffdf7;
  border: 1px solid rgba(224, 205, 160, 0.7);
  border-radius: var(--radius-md);
  padding: 10px;
}
.media-preview img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224, 205, 160, 0.8);
}
.media-preview audio {
  width: 100%;
  height: 40px;
  flex: 1;
}
.media-del {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--brand-red);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.voice-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.voice-state {
  font-size: 12px;
  color: var(--text-light);
}
.voice-alt-btn {
  background: none;
  border: none;
  color: var(--gold-deep);
  font-size: 12.5px;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}
#voiceRecBtn.recording {
  background: var(--brand-red);
  color: #fff;
  animation: recPulse 1.2s infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 22, 35, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(200, 22, 35, 0); }
}

/* 评价墙 / 明细里的媒体展示 */
.bill-photo {
  display: block;
  width: 132px;
  max-width: 100%;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(224, 205, 160, 0.9);
  cursor: zoom-in;
}
.voice-clip {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 10px;
}
.media-label {
  display: inline-block;
  margin-top: 8px;
  margin-right: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(184, 134, 11, 0.12);
  color: #7a5f12;
}

/* 待审核列表（店员口碑页） */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 12px;
}
.pending-card {
  background: #fffdf7;
  border: 1px dashed rgba(184, 134, 11, 0.55);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-main);
}
.pending-head .comment-stars { font-size: 12px; }
.pending-comment {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
  margin-bottom: 8px;
}
.pending-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.pending-actions .btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
}
.pending-empty {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  padding: 18px 12px;
}
