:root {
  --paper: #fff;
  --bg: #f3f6fb;
  --ink: #12151c;
  --muted: #5b6472;
  --line: #d7dee8;
  --accent: #2563eb;
  --ok: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  font-family: Outfit, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.pole { height: 3px; background: linear-gradient(90deg, var(--danger) 0 33%, #fff 33% 66%, var(--accent) 66% 100%); flex-shrink: 0; }
button, input, select {
  font: inherit; font-size: 16px; width: 100%;
  border-radius: 12px; border: 1px solid var(--line);
  padding: 12px 14px; background: #fff;
}
button {
  background: var(--accent); color: #fff; border-color: var(--accent);
  font-weight: 600; cursor: pointer; min-height: 48px;
}
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button.danger, .ghost.danger { color: var(--danger); border-color: #fecaca; background: #fff; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.msg { min-height: 1.2em; color: var(--danger); flex-shrink: 0; }
.muted, .hint { color: var(--muted); }
.legal-gate a { color: var(--accent); font-weight: 600; }
.lead { color: var(--muted); }
.shop-lock {
  margin: 0 0 4px;
  padding: 12px 14px;
  background: #f3f6fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 2px;
}
.shop-lock strong { font-size: 16px; }
.shop-lock small { color: var(--muted); font-weight: 600; }

.gate, .app { max-width: 480px; width: 100%; margin: 0 auto; padding: 20px 18px 96px; }
.gate { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.app {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden; padding: 12px 18px 0;
}
.brand, .top { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.brand img, .top img { border-radius: 12px; object-fit: cover; }
.brand span, .top span, .hello { display: block; color: var(--muted); font-size: 13px; }
.gate form { display: grid; gap: 12px; }
.top { position: relative; background: #fff; padding: 8px 0 12px; z-index: 5; flex-shrink: 0; }
.top .ghost { width: auto; min-width: 88px; padding: 8px 10px; min-height: 40px; font-size: 13px; }
.top .ghost.on { background: #e8f6ee; color: var(--ok); border-color: #b7e0c4; }

.view { display: none; }
.view.on {
  display: grid; gap: 12px; flex: 1; min-height: 0;
  align-content: start;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}
.view[data-view="chat"].on,
.view[data-view="book"].on {
  display: flex; flex-direction: column; flex: 1;
  min-height: 0; overflow: hidden;
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
  gap: 8px;
}
.top-logo {
  background: none; border: 0; padding: 0; width: auto; min-width: 40px;
  min-height: 0; display: flex; flex-shrink: 0;
}
.top-logo img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  width: auto; min-height: 36px; padding: 6px 12px; font-size: 16px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  touch-action: manipulation;
}
.choice-grid, .mine-list { display: grid; gap: 8px; }
.choice-card {
  text-align: left; background: #fff; color: inherit; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; min-height: 56px; width: auto;
  font-size: 16px; touch-action: manipulation;
}
.choice-card strong { display: block; }
.choice-card span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.choice-card.on { border-color: var(--accent); }
.day-row { display: flex; gap: 8px; overflow-x: auto; }
.day-chip, .slot-chip {
  flex: 0 0 auto; width: auto; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; min-height: 40px;
  padding: 8px 12px; white-space: nowrap; font-size: 16px;
  touch-action: manipulation;
}
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.agenda-item span { display: block; color: var(--muted); font-size: 12px; }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
}
.card strong { display: block; }
.card small { color: var(--muted); }
.banner { background: #eef4ff; border: 1px solid #c7d7fe; border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.actions { display: grid; gap: 8px; }
.btn {
  display: grid; place-items: center; text-decoration: none; color: #fff;
  background: var(--accent); border-radius: 12px; font-weight: 600;
  min-height: 44px; height: 44px; padding: 0 16px; align-self: start;
}
#bookLink {
  width: 100%;
  min-height: 44px;
  height: 44px;
  max-height: 44px;
}
.hist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hist li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
.dot.on { background: var(--ok); }
.dot.off { background: #9ca3af; }

.people { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.people button { width: auto; white-space: nowrap; background: #fff; color: var(--ink); border: 1px solid var(--line); min-height: 40px; }
.people button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.thread {
  flex: 1; min-height: 0;
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid; align-content: start; gap: 8px; padding: 4px 0 8px;
}
.bubble { background: var(--bg); border-radius: 14px; padding: 8px 12px; max-width: 86%; }
.bubble.mine { background: #e8f0ff; justify-self: end; }
.bubble.cards { max-width: 100%; width: 100%; background: transparent; padding: 0; }
.composer { display: flex; gap: 8px; flex-shrink: 0; padding-bottom: 4px; }
.composer input { flex: 1; }
.composer button { width: auto; min-width: 88px; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto;
}
.dock button { background: transparent; color: var(--muted); border: 0; min-height: 44px; font-size: 13px; }
.dock button.on { color: var(--accent); }

.sheet {
  position: fixed; inset: 0; background: rgba(18, 21, 28, 0.4);
  display: grid; align-items: end; z-index: 30;
}
.sheet-box { background: #fff; border-radius: 18px 18px 0 0; padding: 18px; display: grid; gap: 10px; }
