/* 布局：宴会厅平面图 —— 左侧是签到簿（待安排宾客），中间是面向舞台的圆桌，右侧是桌卡详情 */
:root {
  --bg: #F6F3F3;
  --surface: #FFFFFF;
  --surface-2: #FAF6F6;
  --ink: #251A1C;
  --muted: #7A6A6D;
  --line: #E9DFE0;
  --line-strong: #D2C4C6;
  --hong: #B3202D;          /* 喜红：主色 */
  --hong-text: #B3202D;
  --on-hong: #FFFFFF;
  --hong-soft: #F8E5E7;
  --jin: #A57F35;           /* 金：主桌、印章 */
  --jin-soft: #F3EBDA;
  --groom: #3E5C8F;         /* 黛蓝：男方 */
  --bride: #C04673;         /* 胭脂：女方 */
  --both: #4A7F66;          /* 竹青：共同 */
  --groom-soft: #E7EDF7;
  --bride-soft: #F9E6EE;
  --both-soft: #E4F0EA;
  --warn: #B45309;
  --warn-soft: #FCEFDF;
  --ok: #2E7650;
  --ok-soft: #E1F1E8;
  --cloth: #FFFDFD;
  --scrim: rgba(37, 26, 28, .38);
  --shadow: 0 1px 2px rgba(70, 25, 30, .06), 0 6px 18px rgba(70, 25, 30, .07);
  --shadow-lg: 0 12px 40px rgba(50, 15, 20, .2);
  --f-display: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --f-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --pool-w: 292px;
  --drawer-w: 384px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161112; --surface: #201A1B; --surface-2: #282022; --ink: #F2EAEB; --muted: #AA9A9D;
    --line: #382E30; --line-strong: #4D4043;
    --hong: #C2343F; --hong-text: #F07B83; --on-hong: #FFFFFF; --hong-soft: #3B1F23;
    --jin: #D3AF68; --jin-soft: #3A3123;
    --groom: #8FA9DB; --bride: #E68CAD; --both: #80BB9C;
    --groom-soft: #232C3D; --bride-soft: #3B2431; --both-soft: #1F332A;
    --warn: #F0A257; --warn-soft: #3B2B19; --ok: #72CF9A; --ok-soft: #1C3327;
    --cloth: #261F21; --scrim: rgba(0, 0, 0, .55);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161112; --surface: #201A1B; --surface-2: #282022; --ink: #F2EAEB; --muted: #AA9A9D;
  --line: #382E30; --line-strong: #4D4043;
  --hong: #C2343F; --hong-text: #F07B83; --on-hong: #FFFFFF; --hong-soft: #3B1F23;
  --jin: #D3AF68; --jin-soft: #3A3123;
  --groom: #8FA9DB; --bride: #E68CAD; --both: #80BB9C;
  --groom-soft: #232C3D; --bride-soft: #3B2431; --both-soft: #1F332A;
  --warn: #F0A257; --warn-soft: #3B2B19; --ok: #72CF9A; --ok-soft: #1C3327;
  --cloth: #261F21; --scrim: rgba(0, 0, 0, .55);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- 基础 ---------- */
/* 带 hidden 属性的元素一律隐藏。Claude 页面外壳自带这条，独立部署时没有：
   少了它，.drawer / .selbar / .view 这些设了 display 的元素会无视 hidden 显示出来，
   手机上空的桌位详情面板铺满全屏，看起来就是白屏 */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 60; background: var(--surface);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--hong-text); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
.gutter {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--hong); border-color: var(--hong); color: var(--on-hong); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.danger { color: var(--hong-text); border-color: color-mix(in srgb, var(--hong-text) 40%, var(--line)); }
.btn.danger:hover { background: var(--hong-soft); }
.btn.danger.solid { background: var(--hong); border-color: var(--hong); color: var(--on-hong); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn svg { width: 16px; height: 16px; }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="password"], input:not([type]), select, textarea {
  min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--hong-text); box-shadow: 0 0 0 3px var(--hong-soft); }

.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  min-height: 30px; padding: 0 12px; border-radius: 4px; font-size: 13px; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg.sm button { min-height: 26px; padding: 0 9px; font-size: 12.5px; }
.seg .s-groom.on { color: var(--groom); }
.seg .s-bride.on { color: var(--bride); }
.seg .s-both.on { color: var(--both); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > .lbl { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.stepper { display: flex; align-items: stretch; }
.stepper button {
  width: 32px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font-size: 16px;
}
.stepper button:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; }
.stepper button:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.stepper input { border-radius: 0; text-align: center; width: 52px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line-strong); }
.dot.groom { background: var(--groom); }
.dot.bride { background: var(--bride); }
.dot.both { background: var(--both); }
.dot.empty { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; height: 20px;
  border-radius: 10px; font-size: 12px; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.tag.groom { background: var(--groom-soft); color: var(--groom); }
.tag.bride { background: var(--bride-soft); color: var(--bride); }
.tag.both { background: var(--both-soft); color: var(--both); }
.tag.demo, .tag.main { background: var(--jin-soft); color: var(--jin); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- 应用框架 ---------- */
.app { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding-block: 10px 0;
}
.top-row { display: flex; align-items: center; gap: 16px; min-width: 0; }
.top-row.second { margin-top: 8px; justify-content: space-between; flex-wrap: wrap; row-gap: 4px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.seal {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 7px; background: var(--hong); color: var(--on-hong);
  font-family: var(--f-display); font-weight: 700; font-size: 24px; line-height: 1;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--on-hong) 22%, transparent), inset 0 0 0 4px var(--hong);
}
.brand-text { min-width: 0; }
.brand h1 { font-family: var(--f-display); font-size: 20px; font-weight: 700; letter-spacing: .04em; line-height: 1.25; overflow-wrap: anywhere; }
.brand .sub { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }

.search-wrap { position: relative; width: min(300px, 34vw); flex: none; }
.search-wrap input { padding-left: 32px; background: var(--surface-2); }
.search-wrap .s-ico { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 4px; max-height: 360px; overflow: auto;
}
.sr-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; text-align: left;
}
.sr-item:hover, .sr-item.active { background: var(--surface-2); }
.sr-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item .where { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sr-item .where b { color: var(--hong-text); font-weight: 600; }
.sr-none { padding: 10px; color: var(--muted); font-size: 13px; }

.sync {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); font-size: 12.5px; white-space: nowrap;
}
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.sync.ok i { background: var(--ok); }
.sync.busy i { background: var(--jin); animation: pulse 1s infinite alternate; }
.sync.err { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.sync.err i { background: var(--warn); }
.sync.local i { background: var(--jin); }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }

.tabs { display: flex; gap: 4px; }
.tabs button {
  position: relative; border: 0; background: transparent; color: var(--muted);
  padding: 8px 12px 10px; font-size: 14.5px; font-weight: 500;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.tabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 2px 2px 0 0; background: var(--hong);
}
.stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding-bottom: 6px; }
.stats b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.stats .warn b, .stats .warn { color: var(--warn); }
.stats .meter { display: inline-flex; align-items: center; gap: 8px; }
.stats .bar { width: 90px; height: 6px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.stats .bar i { display: block; height: 100%; background: var(--hong); border-radius: 3px; }

.banner { background: var(--jin-soft); border-bottom: 1px solid color-mix(in srgb, var(--jin) 30%, var(--line)); padding-block: 8px; font-size: 13.5px; }
.banner .in { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.banner.info { background: var(--surface-2); border-bottom-color: var(--line); }
.banner.ro { background: var(--warn-soft); }

main { flex: 1; min-height: 0; overflow: auto; }
.view { min-height: 0; }

/* ---------- 排座视图 ---------- */
.seating {
  height: 100%; display: grid; grid-template-columns: var(--pool-w) minmax(0, 1fr); gap: 16px; padding-block: 14px;
}
.seating.has-drawer { grid-template-columns: var(--pool-w) minmax(0, 1fr) var(--drawer-w); }

.pool {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.pool.drop-target { border-color: var(--hong-text); box-shadow: 0 0 0 3px var(--hong-soft); }
.pool-head { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.pool-title { display: flex; align-items: center; gap: 8px; }
.pool-title h2 { font-family: var(--f-display); font-size: 16px; font-weight: 700; letter-spacing: .06em; }
.pool-title .count { color: var(--muted); font-size: 12.5px; flex: 1; }
.pool-peek { display: none; }
.pool-list { flex: 1; min-height: 0; overflow: auto; padding: 6px 8px 16px; }
.pool-drop-hint { display: none; margin: 8px; padding: 14px; border: 1.5px dashed var(--hong-text); border-radius: var(--r-md); color: var(--hong-text); text-align: center; font-size: 13px; }
body.dragging-seated .pool-drop-hint { display: block; }

.pg { margin-top: 6px; }
.pg-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 2px; }
.pg-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 2px 4px; border-radius: 4px;
  text-align: left; font-size: 12.5px; color: var(--muted);
}
.pg-toggle:hover { color: var(--ink); }
.pg-toggle .caret { width: 10px; transition: transform .15s; flex: none; }
.pg.collapsed .pg-toggle .caret { transform: rotate(-90deg); }
.pg-toggle .gname { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-toggle .gcount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pg-all { border: 0; background: transparent; color: var(--hong-text); font-size: 12px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.pg-all:hover { background: var(--hong-soft); }
.pg-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 6px; }
.pg.collapsed .pg-chips { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  min-height: 30px; padding: 0 10px 0 9px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface); font-size: 13.5px; user-select: none; -webkit-user-select: none;
}
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip .nt { width: 6px; height: 6px; border-radius: 50%; background: var(--jin); flex: none; }
.chip.sel { border-color: var(--hong-text); background: var(--hong-soft); box-shadow: 0 0 0 1px var(--hong-text) inset; }
.chip[draggable="true"] { cursor: grab; }
.chip.dragging { opacity: .4; }
.pool-empty { padding: 28px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pool-empty strong { color: var(--ink); font-family: var(--f-display); font-size: 15px; }
.pool-empty .acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.hall { min-width: 0; min-height: 0; overflow: auto; padding: 0 2px 24px; }
.hall-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hall-bar .spacer { flex: 1; }
.legend { display: inline-flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.stage {
  display: grid; place-items: center; height: 34px; margin: 0 auto 16px; width: min(560px, 80%);
  border-radius: 0 0 40px 40px; background: linear-gradient(180deg, var(--hong-soft), transparent);
  border: 1px solid color-mix(in srgb, var(--hong-text) 25%, var(--line)); border-top: 0;
  color: var(--hong-text); font-family: var(--f-display); font-weight: 600; letter-spacing: .5em; font-size: 13px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.grid.list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.grid-empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); }

.tcard {
  position: relative; display: block; width: 100%; padding: 4px 2px 2px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: border-color .15s, box-shadow .15s, opacity .15s, background .15s;
}
.tcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.tcard.main { border-color: color-mix(in srgb, var(--jin) 55%, var(--line)); background: linear-gradient(180deg, var(--jin-soft), var(--surface) 48%); }
.main-row {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  padding-bottom: 14px; margin-bottom: 2px; border-bottom: 1px dashed var(--line-strong);
}
.main-row .tcard { width: min(260px, calc(50% - 6px)); }
.tcard svg { display: block; width: 100%; height: auto; overflow: visible; }
.tcard .occ { position: absolute; top: 8px; left: 10px; display: flex; gap: 4px; align-items: center; pointer-events: none; }
.tcard.is-open { border-color: var(--hong-text); box-shadow: 0 0 0 2px var(--hong-soft); }
.selecting .tcard.fit { border-style: dashed; border-color: var(--hong-text); }
.selecting .tcard.fit:hover { background: var(--hong-soft); }
.selecting .tcard.nofit { opacity: .42; }
.tcard.drag-over { background: var(--hong-soft); border-color: var(--hong-text); border-style: solid; }
.tcard.drag-no { opacity: .42; }
.tcard.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--hong-text) 45%, transparent); border-color: var(--hong-text); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* 平面图：照酒店排位表摆桌（坐标在 js/hall.js），桌子按百分比定位，整张图随宽度缩放；
   底图里的字号、线宽都是图上单位，跟着一起缩放 */
.grid.plan-mode { display: block; }
.plan-wrap { overflow-x: auto; overflow-y: hidden; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.plan { position: relative; margin: 0 auto; }
.plan-bg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.pl-floor { fill: color-mix(in srgb, var(--surface) 50%, var(--bg)); stroke: var(--muted); stroke-width: 3; stroke-linejoin: round; }
.pl-room { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.5; }
.pl-room-t { font-size: 14px; fill: var(--muted); text-anchor: middle; dominant-baseline: central; }
.pl-stair { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.2; }
.pl-stair-l { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.pl-runway {
  fill: color-mix(in srgb, var(--hong-soft) 65%, var(--surface)); stroke: color-mix(in srgb, var(--hong-text) 45%, transparent);
  stroke-width: 1.5; stroke-dasharray: 7 5;
}
.pl-runway-t { font-family: var(--f-display); font-weight: 700; font-size: 34px; fill: var(--hong-text); opacity: .7; text-anchor: middle; dominant-baseline: central; }
.pl-stage { fill: var(--hong-soft); stroke: color-mix(in srgb, var(--hong-text) 50%, transparent); stroke-width: 2; }
.pl-stage-t { font-family: var(--f-display); font-weight: 700; font-size: 26px; fill: var(--hong-text); text-anchor: middle; dominant-baseline: central; }
.pl-pillar { fill: var(--line-strong); }
.pl-door { stroke: color-mix(in srgb, var(--surface) 50%, var(--bg)); stroke-width: 5; }
.pl-jamb { stroke: var(--muted); stroke-width: 3; }
.pl-door-t { font-size: 16px; font-weight: 600; fill: var(--ink); text-anchor: end; dominant-baseline: central; }

.ptab {
  position: absolute; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit;
  transition: transform .15s, opacity .15s, box-shadow .15s;
}
.ptab svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* 只在有鼠标悬停的设备上放大：触屏点过之后 :hover 会一直留着，桌子就卡在放大状态 */
@media (hover: hover) { .ptab:hover { transform: scale(1.1); z-index: 2; } }
/* 桌面比地面亮一档、描边加深，空桌在深浅两种配色下都看得清 */
.ptab .t-cloth { fill: var(--surface); stroke: color-mix(in srgb, var(--muted) 55%, transparent); stroke-width: 1.4; }
.ptab .seat.empty { fill: var(--surface); stroke: color-mix(in srgb, var(--muted) 60%, transparent); }
.ptab.main .t-cloth { fill: var(--jin-soft); stroke: var(--jin); }
.pt-code { font-family: var(--f-display); font-weight: 700; fill: var(--ink); }
.ptab.main .pt-code { fill: var(--hong-text); }
.pt-occ { fill: var(--muted); font-variant-numeric: tabular-nums; }
.ptab.is-over .t-cloth { fill: var(--warn-soft); stroke: var(--warn); }
.ptab.is-open { box-shadow: 0 0 0 3px var(--hong-text); }
.ptab.dim { opacity: .25; }
.selecting .ptab.fit { box-shadow: 0 0 0 2px var(--hong-text); }
.selecting .ptab.fit .t-cloth { fill: var(--hong-soft); }
.selecting .ptab.nofit { opacity: .3; }
.ptab.drag-over { box-shadow: 0 0 0 3px var(--hong-text); }
.ptab.drag-over .t-cloth { fill: var(--hong-soft); stroke: var(--hong-text); }
.ptab.drag-no { opacity: .3; }
.ptab.flash { animation: flash 1.6s ease-out; }

/* 调整桌位：桌子可以按住拖动，悬停不再放大，免得拖的时候跳 */
.layout-bar {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin: -4px 0 12px; padding: 8px 12px;
  border: 1px dashed color-mix(in srgb, var(--hong-text) 45%, var(--line)); border-radius: var(--r-lg);
  background: var(--hong-soft); font-size: 13px;
}
.layout-bar .lb-text { flex: 1 1 260px; }
.layout-bar .lb-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.plan.layout .ptab { cursor: grab; touch-action: none; }
.plan.layout .ptab:hover { transform: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--hong-text) 55%, transparent); }
.plan.layout .ptab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--hong-text); }
.plan.layout .ptab.moving { cursor: grabbing; z-index: 5; box-shadow: 0 0 0 3px var(--hong-text); }

/* 圆桌 SVG */
.t-cloth { fill: var(--cloth); stroke: var(--line-strong); stroke-width: 1; }
.t-ring { fill: none; stroke: var(--jin); stroke-width: 1.4; }
.t-ring2 { fill: none; stroke: var(--jin); stroke-width: .6; opacity: .7; }
.t-no { font-family: var(--f-display); font-weight: 700; font-size: 25px; fill: var(--ink); }
.t-main .t-no { fill: var(--hong-text); }
.t-name { font-size: 10.5px; fill: var(--muted); }
.seat { stroke-width: 1.4; }
.seat.empty { fill: var(--surface); stroke: var(--line-strong); }
.seat.groom { fill: var(--groom); stroke: var(--groom); }
.seat.bride { fill: var(--bride); stroke: var(--bride); }
.seat.both { fill: var(--both); stroke: var(--both); }
.seat.over { fill: var(--warn); stroke: var(--warn); }
.party { fill: none; stroke-width: 5; stroke-linecap: round; opacity: .28; }
.party.groom { stroke: var(--groom); }
.party.bride { stroke: var(--bride); }
.party.both { stroke: var(--both); }
.lbl { font-size: 12px; fill: var(--ink); }
.lbl.over { fill: var(--warn); }
.big .lbl { font-size: 11.5px; }

/* 列表模式的桌 */
.trow {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%;
  padding: 10px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color .15s, opacity .15s, background .15s;
}
.trow:hover { border-color: var(--line-strong); }
.trow .no { font-family: var(--f-display); font-weight: 700; font-size: 22px; text-align: center; line-height: 1; }
.trow.main .no { color: var(--hong-text); }
.trow .info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trow .tt { font-weight: 600; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.trow .tt span { color: var(--muted); font-weight: 400; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .names { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.trow .names .gn { color: var(--ink); }
.trow .occ { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.seatbar { display: flex; gap: 2px; }
.seatbar i { width: 6px; height: 10px; border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seatbar i.groom { background: var(--groom); box-shadow: none; }
.seatbar i.bride { background: var(--bride); box-shadow: none; }
.seatbar i.both { background: var(--both); box-shadow: none; }
.seatbar i.over { background: var(--warn); box-shadow: none; }
.selecting .trow.fit { border-style: dashed; border-color: var(--hong-text); }
.selecting .trow.nofit { opacity: .42; }
.trow.drag-over { background: var(--hong-soft); border-color: var(--hong-text); }
.trow.is-open { border-color: var(--hong-text); }
.trow.flash { animation: flash 1.6s ease-out; }

/* ---------- 桌位详情抽屉 ---------- */
.drawer {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.dr-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.dr-head .ttl { flex: 1; min-width: 0; }
.dr-head h2 { font-family: var(--f-display); font-size: 22px; font-weight: 700; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dr-head h2 .tag { font-family: var(--f-body); font-weight: 500; }
.dr-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.dr-row { display: flex; gap: 10px; align-items: flex-end; }
.dr-row .field.grow { flex: 1; }
.dr-visual { margin: 0 auto; width: 100%; max-width: 330px; }
.dr-visual svg { display: block; width: 100%; height: auto; }
.dr-sec-title { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); letter-spacing: .04em; }
.seat-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sl-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 6px 6px 6px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.sl-item[draggable="true"] { cursor: grab; }
.sl-item.drop-before { box-shadow: 0 -3px 0 0 var(--hong-text); }
.sl-item.flash { animation: flash 1.6s ease-out; }
.sl-item .pos { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.sl-item .who { min-width: 0; display: flex; flex-direction: column; }
.sl-item .who .l1 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sl-item .who .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 3em; }
.sl-item .who .ct { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sl-item .who .l2 { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-item .acts { display: flex; align-items: center; gap: 2px; }
.sl-item select { min-height: 30px; padding: 2px 6px; font-size: 12.5px; width: auto; max-width: 96px; }
/* 添加宾客：能坐进本桌的待安排宾客直接列出来，点一下入座 */
.dr-add { display: flex; flex-direction: column; gap: 8px; }
.add-list { display: flex; flex-direction: column; gap: 4px; }
.add-item {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left;
  transition: border-color .15s, background .15s;
}
.add-item:hover, .add-item:active { border-color: var(--hong-text); background: var(--hong-soft); }
.add-item .nm { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-item .ct { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.add-item .where { flex: 0 1 auto; max-width: 34%; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-item .plus { flex: none; width: 22px; text-align: center; font-size: 18px; line-height: 1; color: var(--hong-text); }
.add-more { align-self: flex-start; }
.add-note { font-size: 12px; color: var(--muted); padding: 0 2px; }
.dr-empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); text-align: center; color: var(--muted); font-size: 13px; }
.dr-foot { display: flex; gap: 8px; flex-wrap: wrap; }
.dr-scrim { display: none; }
.plan-zoom { display: none; }

/* ---------- 选择操作条 ---------- */
.selbar {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  padding: 8px 8px 8px 16px; border-radius: 24px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13.5px;
}
.selbar b { font-variant-numeric: tabular-nums; }
.selbar > span { white-space: nowrap; }
.selbar .hint { opacity: .75; }
.selbar .btn { min-height: 30px; border-radius: 16px; background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }

/* ---------- 宾客名单视图 ---------- */
.guests { padding-block: 16px 40px; display: flex; flex-direction: column; gap: 14px; max-width: 1280px; margin: 0 auto; }
.addform {
  display: grid; grid-template-columns: minmax(150px, 1.4fr) auto auto minmax(110px, 1fr) minmax(110px, .9fr) minmax(120px, 1.2fr) auto;
  gap: 10px; align-items: end; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.addform .ttl { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; }
.addform .ttl h2 { font-family: var(--f-display); font-size: 16px; letter-spacing: .06em; }
.addform .ttl span { font-size: 12.5px; color: var(--muted); }
.list-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-bar input[type="search"] { width: 220px; flex: 0 1 220px; }
.list-bar select { width: auto; }
.list-bar .spacer { flex: 1; }
.batchbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px;
  background: var(--hong-soft); border: 1px solid color-mix(in srgb, var(--hong-text) 30%, var(--line)); border-radius: var(--r-md); font-size: 13.5px;
}
.batchbar .grp { display: flex; gap: 6px; align-items: center; }
.batchbar input { width: 130px; min-height: 30px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.glist { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.glist th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: .03em;
}
.glist td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.glist tr:last-child td { border-bottom: 0; }
.glist tbody tr:hover td { background: var(--surface-2); }
.glist tr.checked td { background: var(--hong-soft); }
.glist .c-chk { width: 36px; }
.glist .c-idx { width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; }
.glist .c-name .nm { font-weight: 600; }
.glist .c-name .meta { display: none; font-size: 12px; color: var(--muted); }
.glist .c-count { width: 60px; font-variant-numeric: tabular-nums; }
.glist .c-table { width: 150px; }
.glist .c-table select { min-height: 32px; padding: 3px 8px; font-size: 13px; }
.glist .c-note { color: var(--muted); max-width: 240px; overflow-wrap: anywhere; }
.glist .c-act { width: 120px; text-align: right; white-space: nowrap; }
.glist input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--hong); }
.list-empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ---------- 设置视图 ---------- */
.setup { padding-block: 16px 40px; max-width: 1100px; margin: 0 auto; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-family: var(--f-display); font-size: 16px; letter-spacing: .06em; }
.panel form { display: flex; flex-direction: column; gap: 12px; }
.panel .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.hint.warn { color: var(--warn); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); }

/* ---------- 对话框 ---------- */
dialog {
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.wide { width: min(860px, calc(100% - 32px)); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: var(--scrim); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { flex: 1; font-family: var(--f-display); font-size: 17px; letter-spacing: .04em; }
.dlg-body { padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.dlg-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-foot .left { margin-right: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.imp-opts { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.imp-opts .field { flex: 1 1 140px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--hong); }
.file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.file-row input[type="file"] { display: none; }
.preview-wrap { overflow: auto; max-height: 260px; border: 1px solid var(--line); border-radius: var(--r-md); }
.preview { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview th, .preview td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.preview th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; }
.preview tr.skip td { color: var(--muted); text-decoration: line-through; }
.imp-sum { font-size: 13.5px; }
.imp-sum b { font-variant-numeric: tabular-nums; }
.auto-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.auto-result { font-size: 13.5px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.ex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ex-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.ex-head { display: flex; align-items: center; gap: 8px; }
.ex-head h3 { font-family: var(--f-display); font-size: 15px; letter-spacing: .04em; }
.ex-card > p:not(.hint) { font-size: 13px; color: var(--muted); line-height: 1.6; }
.ex-opts { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.ex-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.ex-status { font-size: 13px; min-height: 20px; }
.ex-status.err { color: var(--warn); }

/* ---------- 提示 ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px);
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px; border-radius: 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toastIn .18s ease-out;
  transition: opacity .2s ease, transform .2s ease;
}
/* 到时间或点 × 关掉时先渐隐，js 等渐隐完再移除 */
.toast.out { opacity: 0; transform: translateY(6px); pointer-events: none; }
.toast.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.toast.warn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.toast .btn { min-height: 28px; }
.toast-x {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin-left: -6px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
}
.toast-x:hover { background: var(--surface-2); color: var(--ink); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .seating.has-drawer { grid-template-columns: var(--pool-w) minmax(0, 1fr); }
  .drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 55; width: min(var(--drawer-w), 100%);
    border-radius: 0; border-width: 0 0 0 1px; box-shadow: var(--shadow-lg);
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
}
@media (max-width: 1080px) {
  .addform { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .addform .field.name { grid-column: span 2; }
  .addform .field.note { grid-column: span 2; }
}
@media (max-width: 900px) {
  :root { --pool-w: 100%; }
  html, body { height: auto; }
  .app { height: auto; min-height: 100%; }
  main { overflow: visible; }
  .top { position: static; }
  .search-wrap { width: auto; flex: 1 1 100%; order: 3; }
  .top-row:first-child { flex-wrap: wrap; row-gap: 10px; }
  .seating, .seating.has-drawer { display: block; height: auto; padding-bottom: 96px; }
  .hall { overflow: visible; padding: 0; }
  .pool {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 44; border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    box-shadow: var(--shadow-lg); max-height: 72%;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
  .pool:not(.open) .pool-head > :not(.pool-peek), .pool:not(.open) .pool-list { display: none; }
  .pool:not(.open) .pool-head { border-bottom: 0; padding: 6px 12px; }
  .pool-peek { display: flex; align-items: center; gap: 8px; }
  .pool-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1; min-width: 0; min-height: 40px;
    border: 0; background: transparent; font-weight: 600; padding: 0 4px;
  }
  .peek-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pool.has-sel .peek-text { color: var(--hong-text); }
  #poolToggleHint { white-space: nowrap; font-weight: 500; font-size: 13px; }
  .pool-toggle .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); }
  .selbar { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .selbar .hint { display: none; }
  body.pool-open .selbar { display: none; }
  .toasts { bottom: calc(124px + env(safe-area-inset-bottom, 0px)); }
  /* 桌位详情从底部弹出，上方留一截能看到平面图，点那里关闭 */
  .drawer {
    top: auto; left: 0; width: 100%; max-height: 86%; max-height: 86dvh;
    border-width: 1px 0 0; border-radius: 16px 16px 0 0; padding-top: 0;
  }
  .drawer::before { content: ""; flex: none; align-self: center; width: 36px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--line-strong); }
  .dr-scrim { display: block; position: fixed; inset: 0; z-index: 54; background: var(--scrim); }
  .dr-visual { max-width: 240px; }
  .glist .c-group, .glist .c-side, .glist .c-note, .glist .c-idx { display: none; }
  .glist .c-name .meta { display: block; }
  .glist .c-act { width: auto; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid.list { grid-template-columns: 1fr; }
  .stats .meter .bar { display: none; }
  .addform { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .addform .field.name, .addform .field.note, .addform .field.side { grid-column: 1 / -1; }
  .addform .btn.primary { grid-column: 1 / -1; }
  .list-bar input[type="search"] { flex: 1 1 100%; width: 100%; }
  .list-bar .spacer { display: none; }
  .grid2, .panel .row2, .ex-grid { grid-template-columns: 1fr; }
  .sl-item { grid-template-columns: 26px minmax(0, 1fr); row-gap: 4px; }
  .sl-item .acts { grid-column: 2; }
  .sl-item select { max-width: none; }
  .brand h1 { font-size: 18px; }
  .hall-bar .legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 家庭密码锁屏 ---------- */
.lock {
  position: fixed; inset: 0; z-index: 200;
  display: grid;
  /* 必须显式给列：隐式列会按内容 max-content 撑开（百分比宽度在本征尺寸计算时不算数），
     窄屏下列宽超过视口，密码卡片会被推出屏幕外，看起来就是整页白屏 */
  grid-template-columns: minmax(0, 1fr);
  padding: 24px 20px max(24px, env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  overflow-y: auto;
}
/* display:grid 会盖掉 UA 的 [hidden]，必须显式写回来 */
.lock[hidden] { display: none; }
.lock-card {
  /* place-items:center 会把比视口还高的卡片裁到滚动不到的顶部；
     auto 外边距在小屏/横屏下退化为 0，卡片从顶部开始、可以正常滚到底 */
  margin: auto;
  width: min(380px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 34px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.lock-seal { width: 56px; height: 56px; font-size: 32px; border-radius: 10px; }
.lock-title {
  font-family: var(--f-display); font-size: 22px; font-weight: 700;
  letter-spacing: .06em; line-height: 1.3;
}
.lock-hint { font-size: 13px; color: var(--muted); line-height: 1.75; }
.lock-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.lock-input { text-align: center; letter-spacing: .1em; }
.lock-input:disabled, .lock-btn:disabled { opacity: .55; }
.lock-btn { width: 100%; min-height: 42px; margin-top: 4px; }
.lock-error { font-size: 12.5px; color: var(--hong-text); line-height: 1.65; }

.panel-sub {
  font-size: 13px; font-weight: 600; color: var(--muted);
  letter-spacing: .04em; margin: 2px 0 6px;
}

/* ---------- 手机端操作适配 ---------- */
@media (max-width: 900px) {
  /* 关掉双击缩放延迟，点按更跟手（保留捏合缩放） */
  body { touch-action: manipulation; }

  /* 底部抽屉别盖死桌位图；正在选人时再压矮一点，
     让"点宾客 → 点桌子"一步完成，不用来回开关抽屉 */
  .pool { max-height: 46%; }
  #view-seating.selecting .pool.open { max-height: 36%; }

  /* 选中提示条悬浮在抽屉上方，选人过程中始终看得见 */
  body.pool-open .selbar {
    display: flex;
    bottom: calc(var(--pool-h, 46vh) + 10px + env(safe-area-inset-bottom, 0px));
  }

  /* 触屏目标加大到 40px 左右 */
  .chip { min-height: 40px; border-radius: 20px; font-size: 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .toast-x { width: 38px; height: 38px; }
  .btn.sm { min-height: 38px; }
  .tabs button { padding: 12px 14px; font-size: 15px; }
  .seg button { min-height: 38px; }
  .pool-toggle { min-height: 48px; }
  .stepper button { width: 44px; }
  .stepper input { width: 60px; min-height: 40px; }
  .sl-item { padding: 10px 8px 10px 10px; }
  .sl-item select { min-height: 40px; font-size: 14px; max-width: 112px; }
  .glist td { padding-block: 10px; }
  .search-wrap input, .list-bar input[type="search"] { min-height: 40px; }
}

@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .top { padding-block: 8px 0; }
  .top-row { gap: 10px; }
  .brand { gap: 10px; }
  .seal { width: 34px; height: 34px; font-size: 20px; border-radius: 6px; }
  .brand h1 { font-size: 17px; }
  .sync { min-height: 34px; }
  .grid { gap: 10px; }
  .selbar { font-size: 13px; gap: 8px; padding: 8px 8px 8px 14px; max-width: calc(100% - 20px); }
}

/* ---------- 手机端排座工作区（js/app.js 在手机宽度的排座页给 <html> 加 seat-ws） ----------
   整页不滚动：顶栏压紧，平面图在中间的框里占满剩下的高度，可以上下左右拖、两指捏合缩放；
   待安排抽屉收起时只露底部一条把手（--peek-h 是这条的高度） */
@media (max-width: 900px) {
  :root { --peek-h: 62px; }
  html.seat-ws, html.seat-ws body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  html.seat-ws .app { height: 100%; height: 100dvh; min-height: 0; }
  html.seat-ws main { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  html.seat-ws .top { padding-block: 8px 0; }
  html.seat-ws .brand .sub { display: none; }
  html.seat-ws .top-row:first-child { row-gap: 8px; }
  html.seat-ws .search-wrap input { min-height: 36px; }
  html.seat-ws .top-row.second { margin-top: 4px; }
  html.seat-ws .tabs button { padding: 8px 12px 10px; }
  html.seat-ws #view-seating {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    padding-top: 10px; padding-bottom: calc(var(--peek-h) + 8px + env(safe-area-inset-bottom, 0px));
  }
  html.seat-ws .hall { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  html.seat-ws .hall-bar { flex: none; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 8px; scrollbar-width: none; }
  html.seat-ws .hall-bar::-webkit-scrollbar { display: none; }
  html.seat-ws .hall-bar > * { flex: none; }
  html.seat-ws .hall-bar .spacer { display: none; }
  html.seat-ws .layout-bar, html.seat-ws .stage { flex: none; }
  html.seat-ws .layout-bar { margin: 0 0 8px; }
  html.seat-ws #grid { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; align-content: start; }
  html.seat-ws #grid.plan-mode {
    position: relative; display: flex; overflow: hidden;
    border: 1px solid var(--line); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 40%, var(--bg));
  }
  html.seat-ws .plan-wrap {
    flex: 1; min-width: 0; display: flex; padding: 8px; overflow: auto; overscroll-behavior: contain;
    touch-action: pan-x pan-y; scrollbar-width: none;
  }
  /* 缩放按钮单独占框的右边一条（竖排）或底下一条（横排），js/app.js 的 planSize 挑平面图更大的那种：
     全图时平面图不伸到按钮底下；放大以后这一条也能拖过去，边上的桌子挪得出来 */
  html.seat-ws #grid.zoom-col .plan-wrap { padding-right: 60px; }
  html.seat-ws #grid.zoom-row .plan-wrap { padding-bottom: 60px; }
  html.seat-ws .plan-wrap::-webkit-scrollbar { display: none; }
  html.seat-ws .plan { flex: none; margin: auto; }
  html.seat-ws .plan-zoom {
    display: flex; align-items: center; position: absolute; right: 8px; bottom: 8px; z-index: 6; gap: 2px; padding: 3px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
  }
  /* 竖排时「+」在上、「−」在下 */
  html.seat-ws #grid.zoom-col .plan-zoom { flex-direction: column-reverse; }
  .plan-zoom button {
    min-width: 40px; height: 40px; padding: 0; border: 0; border-radius: 20px; background: transparent;
    color: var(--ink); font-size: 22px; line-height: 1;
  }
  .plan-zoom .pz-fit { padding: 0 4px; font-size: 12px; color: var(--muted); }
  .plan-zoom button:disabled { opacity: .35; cursor: default; }
  .plan-zoom button:not(:disabled):active { background: var(--surface-2); }

  /* 选人状态改在底部把手里显示，不再用浮动条挡住平面图 */
  html.seat-ws .selbar { display: none !important; }
  html.seat-ws .pool { max-height: 56%; }
  html.seat-ws #view-seating.selecting .pool.open { max-height: 46%; }
  html.seat-ws .pool-title h2 { display: none; }
  /* 提示条放在待安排把手上方；缩放按钮竖排在右边时，往左让开那一条 */
  html.seat-ws .toasts { bottom: calc(var(--peek-h) + 74px + env(safe-area-inset-bottom, 0px)); }
  html.seat-ws:has(#grid.zoom-col) .toasts { left: 16px; right: 72px; transform: none; width: auto; max-width: none; }
}
/* 横着拿手机时高度太小：顶栏再收一点，把高度让给平面图 */
@media (max-width: 900px) and (max-height: 520px) {
  html.seat-ws .search-wrap, html.seat-ws .stats { display: none; }
}

/* ---------- 拆开坐：一户人数比一桌的空位多时，分到几桌（js/app.js 的 openSplit） ---------- */
/* 哪一桌都坐不下的大户：待安排里人数标橙色；桌位详情里另列一组，右边写「拆开坐」 */
.chip.big .ct { color: var(--warn); font-weight: 600; }
.add-sub { margin-top: 6px; font-size: 12px; color: var(--muted); padding: 0 2px; }
.add-item.split .ct { color: var(--warn); font-weight: 600; }
.add-item.split .plus {
  width: auto; padding: 2px 8px; border-radius: 10px; font-size: 12px; line-height: 1.5;
  background: var(--hong-soft); white-space: nowrap;
}
/* 弹窗里每份一行：坐哪一桌、几人、去掉 */
.split-rows { display: flex; flex-direction: column; gap: 8px; }
.split-row { display: flex; align-items: center; gap: 8px; }
.split-row select { flex: 1 1 auto; width: auto; min-width: 0; }
.sp-count { flex: none; display: flex; align-items: center; gap: 6px; }
.sp-unit { font-size: 13px; color: var(--muted); }
.split-row .icon-btn { flex: none; }
.split-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.split-sum { font-size: 13.5px; padding: 10px 12px; border-radius: var(--r-md); background: var(--ok-soft); }
.split-sum.warn { color: var(--warn); background: var(--warn-soft); }
/* 手机上每份占两行：上面选桌占满整行（桌号、空位都写得下，字号调大也不截断），下面加减人数，「去掉」在右边 */
@media (max-width: 640px) {
  .split-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
    padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
  }
  .split-row select { grid-column: 1; grid-row: 1; width: 100%; min-height: 40px; }
  .sp-count { grid-column: 1; grid-row: 2; }
  .split-row .icon-btn { grid-column: 2; grid-row: 1 / span 2; }
}
