/* ---------- Design tokens ----------
   色板：
   --ink        #2B2A25  深炭黑（正文）
   --forest     #1F3A2E  深松林绿（主色/顶栏）
   --forest-lt  #2E5240  浅一号森林绿（hover）
   --moss       #7C9B82  苔藓绿（次要/边框）
   --amber      #E8935A  篝火橙（强调色/按钮）
   --amber-dk   #CE7642  深篝火橙（hover）
   --clay       #C1573F  陶土红（缺口/警示）
   --paper      #FAF6EC  牛皮纸背景
   --paper-dk   #F1EADA  卡片底色
   --line       #E4DCC7  分隔线/描边
--------------------------------------- */
:root {
  --ink: #2B2A25;
  --forest: #1F3A2E;
  --forest-lt: #2E5240;
  --moss: #7C9B82;
  --amber: #E8935A;
  --amber-dk: #CE7642;
  --clay: #C1573F;
  --paper: #FAF7F0;
  --paper-dk: #F1EADA;
  --line: #E4DCC7;

  --font-display: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;

  --shadow-sm: 0 2px 8px rgba(31,58,46,0.06);
  --shadow-md: 0 4px 16px rgba(31,58,46,0.10);
  --shadow-lg: 0 8px 28px rgba(31,58,46,0.14);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg width='260' height='260' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23a8c4ae' stroke-width='1.2'%3E%3Cpath d='M30 90c35-25 70-12 95 6s58 24 95-6'/%3E%3Cpath d='M15 140c45-30 80-6 115 12s65 18 100-12'/%3E%3Cpath d='M35 190c30-18 65-10 100 10s58 14 90-10'/%3E%3Cpath d='M5 45c40-22 75-6 110 10s70 22 105-4'/%3E%3Ccircle cx='130' cy='130' r='40'/%3E%3Ccircle cx='130' cy='130' r='62'/%3E%3Ccircle cx='130' cy='130' r='85'/%3E%3Ccircle cx='55' cy='55' r='28'/%3E%3Ccircle cx='55' cy='55' r='46'/%3E%3Ccircle cx='210' cy='210' r='24'/%3E%3Ccircle cx='210' cy='210' r='42'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 260px 260px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
body {
  min-height: 100vh;
}
/* 文档级永不出现滚动条：本项目为 100vh 全屏布局，所有滚动均发生在内部容器（列表/弹窗/留言区） */
button, input, textarea {
  font-family: inherit;
  font-size: 16px;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}
a { color: inherit; text-decoration: none; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 48px;
}

/* 首页：固定头部 + 列表独立滚动 */
#app.page-home {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: unset;
  overflow: hidden;
  padding-bottom: 0;
}
#app.page-home .topbar,
#app.page-home .tab-bar {
  flex-shrink: 0;
}
#app.page-home .topbar {
  position: relative;
  top: 0;
}
#app.page-home #list-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 90px;
}
#app.page-home #list-area::-webkit-scrollbar {
  display: none;
}
#app.page-home .footer-note {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 0;
}

/* ---------- 详情页固定头部 + 内容区滚动 ---------- */
#app.page-trip {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: unset;
  overflow: hidden;
  padding-bottom: 0;
}
.trip-sticky {
  flex-shrink: 0;
}
.trip-sticky .topbar {
  position: relative;
  top: 0;
}
.trip-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  scrollbar-width: none;
}
.trip-scroll::-webkit-scrollbar {
  display: none;
}
/* 留言板模式：输入框钉底，消息区独立滚动 */
.trip-scroll.chat-mode {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.trip-scroll.chat-mode .chat-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.trip-scroll.chat-mode .chat-area::-webkit-scrollbar {
  display: none;
}

/* 物品清单模式：列表滚动，添加/导入按钮钉底 */
.trip-scroll.items-mode {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.trip-scroll.items-mode .items-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 12px;
}
.trip-scroll.items-mode .items-scroll::-webkit-scrollbar {
  display: none;
}
.trip-scroll.items-mode .add-item-bar {
  flex-shrink: 0;
  margin: 0 14px;
  padding: 8px 0 10px;
  background: linear-gradient(180deg, transparent 0%, var(--paper) 20%);
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #1a3328 0%, var(--forest) 50%, #264a3a 100%);
  color: var(--paper);
  padding: 14px 16px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(31, 58, 46, 0.25);
}
.topbar .row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .back-btn {
  color: var(--paper);
  opacity: 0.85;
  font-size: 20px;
  padding: 4px 6px 4px 0;
  line-height: 1;
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.topbar .tagline {
  margin-top: 4px;
  font-size: 13px;
  color: var(--moss);
  opacity: 0.95;
}
.topbar .trip-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .meta {
  margin-top: 5px;
  font-size: 12px;
  color: var(--moss);
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.topbar .meta span {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 2px 7px;
  line-height: 1.3;
}
.icon-btn {
  color: var(--paper);
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 8px;
  opacity: 0.9;
}
.icon-btn:active { background: rgba(255,255,255,0.12); }
.more-btn {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 12px;
  flex-shrink: 0;
}

/* ---------- 更多操作面板 ---------- */
.action-sheet {
  padding: 16px 16px 20px;
}
.action-sheet-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--clay);
  text-align: center;
  padding: 2px 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: rgba(93,118,84,0.06);
  transition: background .15s;
}
.action-item:active {
  background: rgba(93,118,84,0.14);
}
.action-item.danger {
  color: #c0392b;
  background: rgba(192,57,43,0.06);
}
.action-item.danger:active {
  background: rgba(192,57,43,0.13);
}
.action-icon {
  font-size: 19px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}
.action-cancel {
  margin-top: 10px;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--moss);
  background: rgba(0,0,0,0.04);
}
.action-cancel:active {
  background: rgba(0,0,0,0.08);
}

/* ---------- 通用区块 ---------- */
.section {
  padding: 10px 14px 4px;
}

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(31,26,20,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 50;
  overflow: hidden;
  overscroll-behavior: contain;
}
/* 弹窗打开时锁定底层滚动（轻量方案，不引起布局抖动） */
body.sheet-open {
  overflow: hidden;
}
.sheet {
  background: var(--paper);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px 28px;
  max-height: 86vh;
  overflow-y: auto;
  scrollbar-width: none;
  animation: sheet-up .22s cubic-bezier(.32,.72,.37,1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
}
.sheet::-webkit-scrollbar {
  display: none;
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet h3 {
  font-family: var(--font-display);
  margin: 0 0 14px;
  color: var(--forest);
  font-size: 18px;
}
.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.sheet-actions .btn { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--forest);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all .2s ease;
  z-index: 100;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.footer-note {
  text-align: center;
  font-size: 12.5px;
  color: #a39d86;
  margin: 28px 0 8px;
  letter-spacing: 0.2px;
}

/* ---------- 骨架屏 ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--paper-dk) 25%, #f7f2e8 50%, var(--paper-dk) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card {
  margin: 0 18px 14px;
  padding: 18px 16px;
  border-radius: 16px;
  height: 96px;
}
.skeleton-bar {
  height: 7px;
  width: 60%;
  margin-top: 14px;
}
.skeleton-line {
  height: 14px;
  width: 45%;
  margin-bottom: 8px;
}
.skeleton-line.short { width: 30%; }

/* ---------- 进度条动画 ---------- */
.bar > i {
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 列表入场动画 ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim-in {
  animation: fade-up .35s ease both;
}
.anim-in:nth-child(1) { animation-delay: 0s; }
.anim-in:nth-child(2) { animation-delay: .05s; }
.anim-in:nth-child(3) { animation-delay: .1s; }
.anim-in:nth-child(4) { animation-delay: .15s; }
.anim-in:nth-child(5) { animation-delay: .2s; }
.anim-in:nth-child(6) { animation-delay: .25s; }
.anim-in:nth-child(7) { animation-delay: .3s; }
.anim-in:nth-child(8) { animation-delay: .35s; }

/* ---------- 删除动画 ---------- */
@keyframes collapse-out {
  to { opacity: 0; transform: scale(.95) translateY(-8px); height: 0; margin: 0; padding: 0; overflow: hidden; }
}
.removing {
  animation: collapse-out .25s ease forwards;
  pointer-events: none;
}

/* ---------- 自定义确认弹窗 ---------- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31,26,20,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: fade-in .15s ease;
  overscroll-behavior: contain;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.confirm-box {
  background: var(--paper);
  border-radius: 18px;
  padding: 24px 22px 18px;
  width: 82%;
  max-width: 320px;
  text-align: center;
  animation: pop-in .2s ease;
}
@keyframes pop-in {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.confirm-box .confirm-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--forest);
  margin-bottom: 8px;
}
.confirm-box .confirm-msg {
  font-size: 13.5px;
  color: #6b6a5e;
  margin-bottom: 18px;
  line-height: 1.5;
}
.confirm-box .confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-box .confirm-actions .btn { flex: 1; }
.code-prompt-input {
  width: 100%;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  font-family: var(--font-display);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  background: #fff;
  color: var(--forest);
  transition: border-color .15s;
}
.code-prompt-input:focus {
  outline: none;
  border-color: var(--amber);
}
.btn-danger { background: var(--clay); color: #fff; }
.btn-danger:active { background: #a84832; }

/* ---------- 认领成功微反馈 ---------- */
@keyframes claim-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.claim-success {
  animation: claim-pop .35s ease;
  background: var(--forest) !important;
}

::selection { background: var(--amber); color: #fff; }

@media (max-width: 380px) {
  .section, .topbar { padding-left: 12px; padding-right: 12px; }
  .trip-card, .item-tag, .overview, .category-heading { margin-left: 12px; margin-right: 12px; }
  .person-section, .tab-bar { margin-left: 12px; margin-right: 12px; }
}
