/* 行李清单 · 框架版 v2 样式
 * 清单是「物品 × 成员」的格子表；两人并排，三人以上可横向滚动。
 */
:root {
  --blue: #2F6BFF;
  --blue-soft: #EAF0FF;
  --ink: #1B2233;
  --ink-2: #5B6478;
  --ink-3: #9AA3B5;
  --line: #E6E9F0;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --ok: #12A594;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.5;
}

body { min-height: 100vh; }

#app {
  max-width: 560px; margin: 0 auto;
  padding: 20px 14px calc(28px + var(--safe-b));
}

h1 { font-size: 21px; margin: 0 0 3px; letter-spacing: .2px; }
h2 { font-size: 16px; margin: 0; }

.muted { color: var(--ink-2); font-size: 14px; }
.tiny  { color: var(--ink-3); font-size: 12px; }

/* 顶栏 */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 按钮 */
.btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--blue); color: #fff;
  font-size: 15px; font-weight: 600;
  padding: 11px 18px; border-radius: 12px;
  transition: transform .06s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--card); color: var(--blue); box-shadow: inset 0 0 0 1px var(--line); }
.btn.block { display: block; width: 100%; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }

.linkish { appearance: none; border: 0; background: none; cursor: pointer; color: var(--blue); font-size: 14px; padding: 4px 0; }
.linkish.danger { color: #E5484D; font-size: 13px; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(27, 34, 51, .05), 0 6px 18px rgba(27, 34, 51, .04);
}

.trip {
  display: block; width: 100%; text-align: left;
  padding: 15px 16px; margin-bottom: 12px;
  border: 0; cursor: pointer;
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(27, 34, 51, .05);
  font: inherit; color: inherit;
}
.trip:active { background: #FAFBFF; }
.trip .name { font-size: 17px; font-weight: 650; margin-bottom: 2px; }
.trip .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }

/* 进度条 */
.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 99px; transition: width .25s ease; }
.bar.done > i { background: var(--ok); }

/* 分组 */
.group { margin-bottom: 16px; }
.group-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 8px; }
.group-head .count { color: var(--ink-3); font-size: 12px; }

/* 物品 × 成员 格子表 */
.trow {
  display: grid;
  grid-template-columns: minmax(74px, 1fr) repeat(var(--n, 1), minmax(62px, 1fr));
  gap: 6px;
  align-items: center;
  min-width: calc(74px + var(--n, 1) * 66px);
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
}
.trow:last-child { border-bottom: 0; }

.headrow {
  background: #FAFBFE;
  padding-top: 8px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.tname {
  font-size: 14.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.headrow .tname { color: var(--ink-3); }

.tcol {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-2);
  overflow: hidden; white-space: nowrap;
}
.tcol .dot, .chip .dot { width: 8px; height: 8px; border-radius: 99px; flex: none; }

.cell {
  appearance: none; font: inherit; cursor: pointer;
  min-height: 34px;
  border: 1px dashed #D8DEEA;
  background: #F8FAFE;
  border-radius: 9px;
  padding: 5px 7px;
  font-size: 13px; color: var(--ink-3);
  text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell:active { transform: scale(.97); }
.cell.has {
  border-style: solid; border-color: transparent;
  background: var(--blue-soft);
  color: var(--ink); font-weight: 600;
}
@supports (background: color-mix(in srgb, red 10%, white)) {
  .cell.has { background: color-mix(in srgb, var(--mc, var(--blue)) 13%, var(--card)); }
}

/* 成员条 */
.members { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; color: var(--ink-2);
  background: var(--card); padding: 4px 9px; border-radius: 99px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.chip.add { border: 0; cursor: pointer; color: var(--blue); background: var(--blue-soft); box-shadow: none; }

/* 表单 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.input, select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.input:focus, select:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

.tpl-list { display: grid; gap: 8px; }
.tpl {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; cursor: pointer;
  background: var(--card); border-radius: 12px;
  border: 1.5px solid var(--line);
  font: inherit; font-size: 15px; text-align: left;
}
.tpl[data-on="1"] { border-color: var(--blue); background: var(--blue-soft); }

/* 空状态 */
.empty { text-align: center; padding: 52px 20px; color: var(--ink-2); }
.empty .big { font-size: 38px; margin-bottom: 10px; }

/* 格子编辑面板 */
.sheet {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(17, 20, 28, .32);
  opacity: 0; pointer-events: none;
  transition: opacity .16s ease;
  display: flex; align-items: flex-end;
}
.sheet[data-open="1"] { opacity: 1; pointer-events: auto; }

.sheet-box {
  width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(18px + var(--safe-b));
  transform: translateY(14px);
  transition: transform .16s ease;
  box-shadow: 0 -8px 30px rgba(17, 20, 28, .12);
}
.sheet[data-open="1"] .sheet-box { transform: none; }

.sheet-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-size: 15px; font-weight: 650;
}

.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.qbtn {
  border: 0; cursor: pointer; font: inherit;
  background: var(--bg); color: var(--ink-2);
  padding: 8px 13px; border-radius: 99px; font-size: 13px;
}
.qbtn:active { background: var(--blue-soft); color: var(--blue); }

/* 提示条 */
.hint {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-b));
  transform: translateX(-50%);
  background: rgba(27, 34, 51, .9); color: #fff;
  font-size: 13px; padding: 10px 16px; border-radius: 99px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease; z-index: 40;
  max-width: 90vw; text-align: center;
}
.hint[data-show="1"] { opacity: 1; }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8ECF5; --ink-2: #A6AFC2; --ink-3: #6B7488;
    --line: #262C3A; --bg: #11141C; --card: #1A1E28;
    --blue-soft: #1B2748;
  }
  .headrow { background: #171B24; }
  .cell { background: #151922; border-color: #2C3342; }
  .trip:active { background: #1E2330; }
  .hint { background: rgba(240, 243, 250, .95); color: #1B2233; }
}
