:root {
  --bg: #fff;
  --fg: #111;
  --muted: #555;
  --line: #111;
  --soft: #f3f3f3;
  --danger: #111;
  --pad: 20px;
  --radius: 16px;
  --tap: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  min-height: 100%;
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
input, select, textarea {
  font-size: 16px; /* avoid WeChat/iOS zoom */
}
button { cursor: pointer; }
a { color: inherit; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Login: nothing but logo, copy, field, button */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
}
.login-box {
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.site-logo { margin-bottom: 28px; }
.login-lead {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 600;
}
.login input[type="text"],
.login input[type="password"] {
  width: 100%;
  height: var(--tap);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  margin-bottom: 16px;
  background: #fff;
}
.username-chip {
  margin: 0 0 16px;
  font-size: 18px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  width: 100%;
  padding: 0 18px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fff;
  margin-bottom: 12px;
  font-weight: 700;
}
.btn:disabled { opacity: 0.45; }
.btn-primary { background: #111; color: #fff; }
.btn-ghost { background: #fff; }
.btn-sm { min-height: 48px; width: auto; margin: 0; padding: 0 16px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; margin-bottom: 0; }
.form-error {
  color: #111;
  margin: 8px 0 0;
  font-weight: 700;
  border: 2px solid #111;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(84px + var(--safe-bottom));
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) var(--pad) 10px;
  background: #fff;
  border-bottom: 2px solid #111;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 20px;
}
.icon-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  font-weight: 800;
}

.banner {
  margin: 12px var(--pad) 0;
  padding: 14px 16px;
  border: 2px solid #111;
  border-radius: 12px;
  background: var(--soft);
  font-weight: 700;
}
.banner button {
  margin-top: 10px;
  min-height: 44px;
}

.main { padding: 16px var(--pad) 24px; }

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 2px solid #111;
  background: #fff;
  padding-bottom: var(--safe-bottom);
  z-index: 20;
}
.tab {
  border: 0;
  background: transparent;
  padding: 8px 2px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #111;
}
.tab svg { width: 26px; height: 26px; }
.tab.is-active { background: #111; color: #fff; }

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 24px; }
h1 svg, h2 svg, h3 svg, .icon-inline svg {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: -3px;
  margin-right: 6px;
  flex-shrink: 0;
}
h2 { font-size: 20px; }
.muted { color: var(--muted); font-weight: 500; }
.section { margin-bottom: 24px; }
.card {
  border: 2px solid #111;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: #fff;
}
.card h3 { margin-bottom: 8px; }
.pill {
  display: inline-block;
  border: 2px solid #111;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 14px;
  font-weight: 800;
  margin-right: 6px;
}
.pill-solid { background: #111; color: #fff; }
.list-names { margin: 8px 0 0; font-weight: 600; }

.hero {
  border: 3px solid #111;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
}
.hero .count {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1px;
  margin: 8px 0;
}

label.field {
  display: block;
  font-weight: 700;
  margin: 12px 0 6px;
}
input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  min-height: 52px;
  border: 2px solid #111;
  border-radius: 12px;
  padding: 8px 12px;
  background: #fff;
  appearance: none;
}
input[type="time"], input[type="date"] {
  min-height: 56px;
  font-size: 20px;
  font-weight: 700;
}
textarea { min-height: 88px; resize: vertical; }
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chip {
  border: 2px solid #111;
  background: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  font-weight: 700;
}
.chip.is-on { background: #111; color: #fff; }

.seats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.seat {
  border: 2px solid #111;
  border-radius: 12px;
  min-height: 84px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  font-weight: 700;
}
.seat.empty { background: var(--soft); color: var(--muted); }
.code-box {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 4px;
  text-align: center;
  padding: 12px;
  border: 2px dashed #111;
  border-radius: 12px;
  margin: 8px 0 12px;
}

.days {
  display: grid;
  gap: 12px;
}
@media (min-width: 720px) {
  .days { grid-template-columns: repeat(3, 1fr); }
}
.day-col {
  border: 2px solid #111;
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}
.day-col h3 { margin-bottom: 4px; }
.session-card {
  border: 2px solid #111;
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}
.session-card.is-full { background: #111; color: #fff; }
.session-card.is-full input,
.session-card.is-full textarea {
  color: #111;
  background: #fff;
}
.time-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}
.time-row span { text-align: center; padding-bottom: 16px; font-weight: 800; }
.warn {
  margin-top: 8px;
  font-weight: 700;
  font-size: 15px;
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.drawer-panel {
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  background: #fff;
  border-top: 2px solid #111;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 2px solid #111;
}
.drawer-head h2 { flex: 1; margin: 0; }
.drawer-head .btn { width: auto; flex: 0 0 auto; margin: 0; }
.drawer-body { overflow: auto; padding: 12px 16px calc(16px + var(--safe-bottom)); }
.note {
  border-bottom: 1px solid #111;
  padding: 12px 0;
}
.note.unread { font-weight: 800; }
.user-row, .friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
}
.icon-inline {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 6px;
}
.empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--muted);
}
