:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --ink: #1b1b2a;
  --muted: #6b6b82;
  --line: #e4e5f0;
  --accent: #4f46e5;
  --accent-soft: #eeecff;
  --ok: #0f9d58;
  --ok-soft: #e6f6ee;
  --warn: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 27, 42, .06), 0 8px 24px rgba(27, 27, 42, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: .01em; }
h1 { font-size: 16px; }
h2 { font-size: 13px; text-transform: none; color: var(--muted); letter-spacing: .04em; }
p { margin: 0; }
.hint { color: var(--muted); font-size: 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 8px; top: 8px; width: 14px; height: 14px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px);
  border-radius: 1px;
}
.brand p { font-size: 11px; color: var(--muted); }
.user-chip {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 600; flex: none;
}

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 14px; }
.loading-title { font-weight: 600; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error h2 { color: var(--warn); font-size: 15px; }
.error p { color: var(--muted); margin: 6px 0 12px; }

.create { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field input {
  font: inherit; color: var(--ink); padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: #fbfbfe; width: 100%;
}
.field input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.row { display: flex; gap: 10px; }
.row .field { flex: 1; }
.row .narrow { flex: 0 0 84px; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  padding: 9px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .12s ease, border-color .12s ease;
}
button:hover { background: #f7f7fd; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #443bd4; }
button.ghost { background: transparent; color: var(--muted); }
button.danger { color: var(--warn); border-color: #f2d5d2; background: #fff7f6; }
button:disabled { opacity: .55; cursor: default; }
.form-error { color: var(--warn); font-size: 12px; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.meetings { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 9px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.status-pill {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; flex: none;
  background: #f0f1f8; color: var(--muted);
}
.status-pill.registered { background: var(--accent-soft); color: var(--accent); }
.status-pill.checked_in { background: var(--ok-soft); color: var(--ok); }
.counts { display: flex; gap: 6px; }
.count {
  flex: 1; background: #fafaff; border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px;
}
.count-label { font-size: 11px; color: var(--muted); }
.count-value { font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.count-value small { font-size: 12px; color: var(--muted); font-weight: 500; }
.count.checked .count-value { color: var(--ok); }
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar { height: 6px; background: #eeeff6; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .35s ease; }
.bar.checked > span { background: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.owner-box { border-top: 1px dashed var(--line); padding-top: 9px; display: flex; flex-direction: column; gap: 7px; }
.code-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 700;
  letter-spacing: .14em; color: var(--accent); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 8px;
}
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #f4f5fb; color: var(--muted);
  border: 1px solid var(--line);
}
.person.in { background: var(--ok-soft); color: var(--ok); border-color: #cdeadb; }
.checkin-area { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.checkin-area input {
  font: inherit; width: 118px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 10px; letter-spacing: .18em; text-align: center;
}
.empty { color: var(--muted); text-align: center; padding: 18px 0; font-size: 13px; }
.foot { padding: 10px 16px 16px; color: var(--muted); font-size: 11px; text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #26263a; color: #fff; font-size: 12px; padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0,0,0,.22); max-width: 88vw;
}
.toast[data-kind="error"] { background: #8c1d18; }
@media (max-width: 380px) {
  main { padding: 10px; }
  .row { flex-wrap: wrap; }
  .row .narrow { flex: 1 0 100%; }
}

/* ---------- 视图切换 ---------- */
[hidden] { display: none !important; }
#workspace { display: flex; flex-direction: column; gap: 12px; }
.tabs {
  display: flex; gap: 6px; padding: 4px; background: #ecebf6; border-radius: 12px;
}
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 10px; border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 13px; border-radius: 9px; font-weight: 600;
}
.tab:hover { background: rgba(255, 255, 255, .65); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(27, 27, 42, .12); }
.tab-count {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: #dcdcf0; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent); }
.view { display: flex; flex-direction: column; gap: 12px; }

/* ---------- 历史记录 ---------- */
.summary { display: flex; gap: 8px; padding: 12px; }
.summary-item {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  background: #fafaff; border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px;
}
.summary-label { font-size: 11px; color: var(--muted); }
.summary-value { font-size: 19px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.filter-input {
  font: inherit; color: var(--ink); padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); width: 100%;
}
.filter-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.history-heading { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.history-title { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; margin: 0; }
.status-pill.ended { background: #f0f1f8; color: var(--muted); }
.history-stats { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.history-item .h-bar { height: 5px; }
.history-detail {
  border-top: 1px dashed var(--line); padding-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.detail-line { font-size: 12px; color: var(--ink); }
.detail-people { display: flex; flex-direction: column; gap: 4px; }
.detail-person {
  display: flex; justify-content: space-between; gap: 8px; font-size: 12px;
  padding: 4px 8px; border-radius: 8px; background: #f8f8fd;
}
.detail-person.in { background: var(--ok-soft); }
.detail-name { font-weight: 600; overflow-wrap: anywhere; }
.detail-state { color: var(--muted); flex: none; }
@media (max-width: 380px) {
  .summary { flex-wrap: wrap; }
  .summary-item { flex: 1 1 30%; }
}
