/* ============================================================
   云岫茶事 · 设计基础层
   视觉基调：宣纸上的茶档案 — 暖米白纸面 + 茶绿墨色 + NFC 茶叶徽标
   ============================================================ */

:root {
  /* 色彩 */
  --tea-green: #3E7A52;
  --tea-deep: #2B5C3F;
  --tea-dark: #1E4230;
  --paper: #F5F0E4;
  --paper-deep: #EDE6D3;
  --paper-bright: #FCF9F1;
  --ink: #2C2A26;
  --ink-soft: #5A564D;
  --clay: #8A6F52;
  --gold: #C9A227;
  --gold-deep: #A8861C;
  --clay-red: #B4552D;
  --stamp-red: #B03A2E;
  --moss: #7FB8A1;
  --water: #4A90C2;
  --grass: #5B8A4F;
  --line: rgba(62, 122, 82, .20);
  --line-soft: rgba(44, 42, 38, .08);
  --line-strong: rgba(62, 122, 82, .38);

  /* 圆角阶梯 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* 阴影 */
  --sh-1: 0 1px 3px rgba(43, 92, 63, .10);
  --sh-2: 0 4px 16px rgba(43, 92, 63, .10);
  --sh-3: 0 12px 32px rgba(43, 92, 63, .16);

  /* 动效 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 160ms;
  --dur-med: 300ms;
  --dur-slow: 520ms;

  /* 字体 */
  --font-display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-body: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.34 0 0 0 0 0.31 0 0 0 0 0.24 0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; touch-action: manipulation; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--tea-green); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.45; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--tea-green); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -48px; left: 16px; z-index: 300;
  padding: 8px 16px; background: var(--tea-dark); color: var(--paper-bright);
  border-radius: var(--r-sm); transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---------- 页面切换动画 ---------- */
#app { min-height: 100vh; }
.view-enter > * {
  animation: fadeUp var(--dur-med) var(--ease-out) both;
}
.view-enter > *:nth-child(2) { animation-delay: 50ms; }
.view-enter > *:nth-child(3) { animation-delay: 100ms; }
.view-enter > *:nth-child(4) { animation-delay: 150ms; }
.view-enter > *:nth-child(5) { animation-delay: 200ms; }
.view-enter > *:nth-child(6) { animation-delay: 250ms; }
.view-enter > *:nth-child(7) { animation-delay: 300ms; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 排版 ---------- */
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--clay); }
.text-soft { color: var(--ink-soft); }

/* ---------- 按钮 ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px;
  border-radius: var(--r-md);
  font-weight: 500; font-size: 15px;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }
.btn-primary { background: var(--tea-green); color: #FDFBF4; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--tea-deep); }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--tea-deep); }
.btn-ghost:hover { background: rgba(62, 122, 82, .06); }
.btn-danger { background: var(--clay-red); color: #FDFBF4; }
.btn-danger:hover { background: #9C4826; }
.btn-plain { background: transparent; color: var(--tea-deep); }
.btn-plain:hover { background: rgba(62, 122, 82, .06); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 17px; border-radius: var(--r-lg); }

.ripple-ink {
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .35);
  transform: scale(0); pointer-events: none;
  animation: rippleIn 520ms var(--ease-out) forwards;
}
.btn-ghost .ripple-ink, .btn-plain .ripple-ink { background: rgba(62, 122, 82, .15); }
@keyframes rippleIn { to { transform: scale(2.6); opacity: 0; } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--paper-bright);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 20px;
}
.card-flat { background: var(--paper-bright); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card-hover { transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
@media (hover: hover) {
  .card-hover:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
}

/* ---------- 头像 ---------- */
.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-text { display: grid; place-items: center; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field-label { display: block; font-size: 13px; color: var(--clay); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15px;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--tea-green);
  box-shadow: 0 0 0 3px rgba(62, 122, 82, .12);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: #B4AC9C; }
.input-error { border-color: var(--clay-red); animation: shake 420ms var(--ease-out); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.badge-green { background: rgba(62, 122, 82, .12); color: var(--tea-deep); }
.badge-amber { background: rgba(201, 162, 39, .16); color: #8A6D15; }
.badge-amber.breathe { animation: breathe 1.8s ease-in-out infinite; }
.badge-red { background: rgba(180, 85, 45, .12); color: var(--clay-red); }
.badge-gray { background: rgba(44, 42, 38, .07); color: var(--ink-soft); }
.badge-gold { background: rgba(201, 162, 39, .14); color: var(--gold-deep); }
.badge-resubmit { background: rgba(74, 144, 194, .14); color: #2F6A96; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- 记录详情弹层（管理端撤回审批 / 记录审核共用） ---------- */
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.detail-photo {
  position: relative; display: block; width: 100%;
  margin: 14px 0 2px; padding: 0; border: 0;
  border-radius: var(--r-md); overflow: hidden;
  background: var(--paper-deep); cursor: zoom-in;
}
.detail-photo img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.detail-photo span {
  position: absolute; right: 8px; bottom: 8px;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: rgba(30, 66, 48, .62); color: #F4EFE2;
  font-size: 11.5px;
}
.detail-meta { margin-top: 14px; }
.meta-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px dashed var(--line-soft);
  font-size: 13.5px;
}
.meta-row:last-child { border-bottom: 0; }
.meta-row span { color: var(--ink-soft); flex: none; }
.meta-row b { font-weight: 500; text-align: right; word-break: break-all; }
.detail-sec { margin-top: 14px; }
.detail-sec-title { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 4px; }

/* ---------- Toast ---------- */
#toast-root {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  max-width: min(88vw, 420px);
  padding: 11px 18px;
  background: var(--tea-dark); color: #F4EFE2;
  border-radius: var(--r-pill);
  font-size: 14px;
  box-shadow: var(--sh-3);
  animation: toastIn var(--dur-med) var(--ease-out);
}
.toast-warn { background: #7A4A20; }
.toast-err { background: var(--clay-red); }
.toast-ok { background: var(--tea-deep); }
.toast.leaving { opacity: 0; transform: translateY(-8px); transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 底部弹层 Sheet ---------- */
#sheet-root { position: fixed; inset: 0; z-index: 350; pointer-events: none; }
.sheet-mask {
  position: absolute; inset: 0;
  background: rgba(30, 42, 32, .42);
  opacity: 0; pointer-events: auto;
  transition: opacity var(--dur-med) var(--ease-out);
}
.sheet-mask.show { opacity: 1; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--paper-bright);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform var(--dur-med) var(--ease-out);
  pointer-events: auto;
}
.sheet-panel.show { transform: translateY(0); }
.sheet-grip { width: 44px; height: 4px; border-radius: 2px; background: var(--line-soft); margin: 0 auto 18px; }
.sheet-title { font-size: 17px; margin-bottom: 16px; }

/* ---------- 灯箱 Lightbox ---------- */
#lightbox-root { position: fixed; inset: 0; z-index: 380; pointer-events: none; }
.lightbox {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: rgba(24, 32, 24, .92);
  opacity: 0; transition: opacity var(--dur-med) var(--ease-out);
  pointer-events: auto;
}
.lightbox.show { opacity: 1; }
.lightbox-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; color: #E8E2D2;
}
.lightbox-stage { flex: 1; display: grid; place-items: center; padding: 0 20px; overflow: hidden; }
.lightbox-stage img {
  max-width: 100%; max-height: calc(100vh - 220px);
  border-radius: var(--r-md);
  outline: 1px solid rgba(255,255,255,.14); outline-offset: -1px;
  animation: fadeUp var(--dur-med) var(--ease-out);
}
.lightbox-caption { padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); color: #CFC9B8; font-size: 13px; text-align: center; }
.lightbox-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  color: #E8E2D2; font-size: 18px;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.lightbox-btn:hover { background: rgba(255,255,255,.1); }
.lightbox-btn:active { transform: scale(.92); }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }

/* ---------- 印章 ---------- */
.stamp {
  display: grid; place-items: center;
  width: 88px; height: 88px;
  border: 3px solid currentColor;
  border-radius: 50%;
  color: var(--stamp-red);
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  line-height: 1.3; text-align: center;
  transform: rotate(-10deg);
  position: relative;
  flex-shrink: 0;
}
.stamp::before {
  content: ''; position: absolute; inset: 5px;
  border: 1px solid currentColor; border-radius: 50%;
  opacity: .7;
}
.stamp-in {
  animation: stampIn 620ms var(--ease-out) both;
}
@keyframes stampIn {
  from { opacity: 0; transform: rotate(-30deg) scale(.3); }
  to { opacity: 1; transform: rotate(-10deg) scale(1); }
}
.stamp-sm { width: 56px; height: 56px; font-size: 12px; border-width: 2px; }
.stamp-sm::before { inset: 3px; }
/* 品牌徽标端正放置，放大时保持茶叶与 NFC 弧线清晰。 */
.stamp-img {
  display: block;
  width: 112px; height: 112px;
  object-fit: contain;
  flex-shrink: 0;
}
.stamp-img.stamp-in { animation: logoReveal 620ms var(--ease-out) both; }
@keyframes logoReveal {
  from { opacity: 0; transform: scale(.82); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- 时间轴 ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 10px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(to bottom, var(--line-strong), var(--line));
}
.tl-item { position: relative; padding: 0 0 26px 0; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot {
  position: absolute; left: -28px; top: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper-bright);
  border: 2px solid var(--tea-green);
  display: grid; place-items: center;
}
.tl-dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--tea-green); }

/* ---------- 空状态 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 48px 24px; text-align: center; color: var(--clay);
}
.empty-title { font-size: 15px; color: var(--ink-soft); font-weight: 500; }

/* ---------- 加载态 ---------- */
.skeleton {
  background: linear-gradient(100deg, rgba(62,122,82,.07) 40%, rgba(62,122,82,.13) 50%, rgba(62,122,82,.07) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 其他 ---------- */
.divider { height: 1px; background: var(--line-soft); border: none; margin: 16px 0; }
.chip {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 13px; color: var(--tea-deep);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.chip:active { transform: scale(.96); }
.chip.active { background: var(--tea-green); border-color: var(--tea-green); color: #FDFBF4; }
@media (hover: hover) {
  .chip:hover { border-color: var(--line-strong); }
  .chip.active:hover { border-color: var(--tea-green); }
}

/* ---------- 专属字段 chips ---------- */
.f-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.f-chip {
  display: inline-flex; align-items: center;
  padding: 4px 8px;
  background: rgba(44,42,38,.05);
  border-radius: 999px;
  font-size: 11px; color: #6B645A;
  line-height: 1.4;
}
.f-chip b { color: #4A443C; font-weight: 600; margin-right: 4px; }

.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.flex { display: flex; } .flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.hidden { display: none !important; }

/* ---------- 减弱动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
