:root {
  --c-green: #2eaa5c;
  --c-yellow: #f2b705;
  --c-red: #e0413a;
  --c-gray: #b0b6c0;
  --c-primary: #1f3a5f;
  --c-accent: #3b7ddd;
  --c-purple: #8b5cf6;
  --c-text: #1d2330;
  --c-sub: #6b7280;
  --c-line: #e6e9ef;
  --c-bg: #f4f6f9;
  color-scheme: light;
}

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

html,
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Segoe UI', sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: calc(46px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
}
.nav-back {
  position: absolute;
  left: 4px;
  bottom: 0;
  height: 46px;
  width: 46px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
#nav-title {
  max-width: 70%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#app {
  max-width: 520px;
  margin: 0 auto;
}

.container {
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

/* ---------- 通用 ---------- */
.card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(31, 58, 95, 0.06);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sub {
  color: var(--c-sub);
  font-size: 12px;
}
.muted {
  color: #9ca3af;
}
.gap {
  height: 10px;
}
.center {
  text-align: center;
  margin-top: 6px;
}
.empty {
  text-align: center;
  color: #9ca3af;
  padding: 16px 0;
  font-size: 13px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
}
.tag.green { background: var(--c-green); }
.tag.yellow { background: var(--c-yellow); }
.tag.red { background: var(--c-red); }
.tag.blue { background: var(--c-accent); }
.tag.gray { background: var(--c-gray); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 500;
  background: var(--c-primary);
  color: #fff;
  border: 0;
  padding: 0 12px;
  cursor: pointer;
}
.btn:active { opacity: 0.85; }
.btn.plain {
  background: #fff;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn.danger {
  background: #fff;
  color: var(--c-red);
  border: 1px solid var(--c-red);
}
.btn.small {
  display: inline-flex;
  width: auto;
  height: 30px;
  font-size: 13px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.field {
  padding: 11px 0;
  border-bottom: 1px solid var(--c-line);
}
.field:last-child { border-bottom: none; }
.field-label {
  font-size: 13px;
  color: var(--c-sub);
  margin-bottom: 6px;
}
.req {
  color: var(--c-red);
  margin-left: 2px;
}
.input,
.select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  background: var(--c-bg);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus,
.select:focus {
  border-color: var(--c-accent);
}
.select {
  background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.textarea {
  width: 100%;
  min-height: 60px;
  padding: 9px 10px;
  background: var(--c-bg);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  outline: none;
}
.textarea:focus {
  border-color: var(--c-accent);
}

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chip {
  text-align: center;
  border-radius: 7px;
  padding: 8px 0;
  background: var(--c-bg);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}
.chip.active {
  background: rgba(59, 125, 221, 0.1);
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.chip-main {
  font-size: 14px;
  font-weight: 500;
}
.chip-date {
  font-size: 11px;
  color: var(--c-sub);
}
.chip.active .chip-date {
  color: var(--c-accent);
}

.link {
  color: var(--c-sub);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.link.danger {
  color: var(--c-red);
}

/* ---------- 首页 ---------- */
.hero {
  padding: 8px 4px 14px;
}
.hero-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.35;
  margin: 0;
}
.hero-title.accent {
  color: var(--c-accent);
}
.hero-sub {
  color: var(--c-sub);
  margin-top: 6px;
  font-size: 13px;
}
.legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding: 9px 10px;
  background: #fff;
  border-radius: 7px;
  font-size: 12px;
  color: var(--c-sub);
}
.legend-item {
  display: flex;
  align-items: center;
}
.legend-name {
  color: var(--c-text);
  font-weight: 600;
  margin-right: 6px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  flex-shrink: 0;
}
.dot.green { background: var(--c-green); }
.dot.yellow { background: var(--c-yellow); }
.dot.red { background: var(--c-red); }
.dot.gray { background: var(--c-gray); }

.module {
  display: block;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 3px 10px rgba(31, 58, 95, 0.08);
  padding: 10px;
  cursor: pointer;
}
.module:active { opacity: 0.85; }
.module.closed { cursor: default; }
.module.closed:active { opacity: 1; }
.module.closed .module-title { color: #9ca3af; }

.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  border: 5px solid #ccc;
  overflow: hidden;
  background: #fff;
}
.cover.green { border-color: var(--c-green); }
.cover.yellow { border-color: var(--c-yellow); }
.cover.red { border-color: var(--c-red); }
.cover.gray { border-color: var(--c-gray); }
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gray-img {
  filter: grayscale(0.85);
  opacity: 0.75;
}
.cover-placeholder {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(45deg, #f1f3f6, #f1f3f6 10px, #e9ecf1 10px, #e9ecf1 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #b7bec9;
}
.ph-title { font-size: 24px; font-weight: 700; }
.ph-sub { font-size: 12px; margin-top: 4px; }
.cover-tag {
  position: absolute;
  top: 8px;
  left: 8px;
}
.cover-tag2 {
  position: absolute;
  top: 8px;
  right: 8px;
}
.module-body {
  padding: 10px 4px 2px;
}
.module-title {
  font-size: 18px;
  font-weight: 600;
}
.module-meta {
  display: flex;
  align-items: flex-end;
  margin-top: 6px;
  gap: 8px;
}
.meta {
  display: flex;
  align-items: baseline;
}
.meta.next {
  flex: 1;
  justify-content: flex-end;
  text-align: right;
}
.meta-label {
  color: var(--c-sub);
  font-size: 12px;
  margin-right: 5px;
  white-space: nowrap;
}
.meta-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-primary);
}
.meta-unit {
  font-size: 12px;
  margin-left: 2px;
  color: var(--c-sub);
}
.meta-next {
  font-size: 13px;
  color: var(--c-sub);
}
.meta-next.on {
  color: var(--c-red);
  font-weight: 600;
}

/* ---------- 活动页：头部 ---------- */
.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 4px 14px;
}
.head-title {
  font-size: 22px;
  font-weight: 700;
}
.head-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 10px;
}
.head-total {
  margin-top: 5px;
  font-size: 12px;
  color: var(--c-sub);
}
.head-total .num {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-primary);
}

/* 群二维码 */
.qr-card {
  display: flex;
  align-items: flex-start;
}
.qr-box {
  width: 110px;
  flex-shrink: 0;
  margin-right: 12px;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.qr-img {
  width: 100%;
  display: block;
}
.qr-placeholder {
  width: 100%;
  height: 110px;
  border: 2px dashed #c3c9d3;
  border-radius: 7px;
  background: repeating-linear-gradient(45deg, #f6f7f9, #f6f7f9 8px, #eef0f3 8px, #eef0f3 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #a3abb8;
  font-size: 13px;
}
.qr-text {
  flex: 1;
  min-width: 0;
}
.qr-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.qr-time {
  margin-top: 4px;
}
.qr-btn {
  margin-top: 8px;
}
.qr-tip {
  font-size: 11px;
  margin-top: 4px;
}
.file-input {
  display: none;
}

/* 组织者 */
.org-card {
  border-left: 5px solid var(--c-purple);
}
.org-row {
  display: flex;
  align-items: center;
}
.avatar {
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.org-avatar {
  width: 40px;
  height: 40px;
  font-size: 16px;
  margin-right: 10px;
  background: var(--c-purple);
}
.org-main {
  flex: 1;
  min-width: 0;
}
.org-name {
  font-size: 16px;
  font-weight: 600;
}
.tag.org-tag {
  background: var(--c-purple);
  font-size: 10px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.org-actions {
  flex-shrink: 0;
  margin-left: 8px;
}
.org-empty-title {
  font-size: 15px;
  font-weight: 600;
}
.org-btn {
  margin-top: 10px;
  background: var(--c-purple);
}

/* 已确定 */
.confirmed {
  border-left: 5px solid var(--c-red);
}
.confirmed-main {
  font-size: 17px;
  font-weight: 600;
  color: var(--c-red);
  margin-bottom: 4px;
}
.attend-row {
  display: flex;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--c-line);
}
.attend-item {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--c-sub);
  display: flex;
  flex-direction: column;
}
.attend-item .num {
  font-size: 20px;
  font-weight: 700;
}
.num.green { color: var(--c-green); }
.num.dark { color: #111827; }
.num.gray { color: #9ca3af; }
.join {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--c-line);
}
.join-status {
  font-size: 13px;
  color: var(--c-sub);
  margin-bottom: 8px;
}
.join-status.yes {
  color: var(--c-green);
  font-weight: 600;
}
.join-status.pending {
  color: #111827;
  font-weight: 600;
}
.join-btn {
  margin-bottom: 7px;
}
.join-primary {
  background: var(--c-red);
}
.join-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.join-row .input {
  flex: 1;
}
.join-row .select {
  width: 90px;
}

/* 投票 */
.poll {
  border-left: 5px solid var(--c-accent);
}
.poll-meta {
  margin: -4px 0 10px;
}
.opt {
  position: relative;
  border: 1px solid var(--c-line);
  border-radius: 7px;
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.opt.readonly {
  cursor: default;
}
.opt.checked {
  border-color: var(--c-accent);
}
.opt-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(59, 125, 221, 0.08);
  transition: width 0.3s;
}
.opt-bar.leading {
  background: rgba(59, 125, 221, 0.16);
}
.opt-content {
  position: relative;
  display: flex;
  align-items: center;
  padding: 11px 10px;
}
.checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #c3c9d3;
  margin-right: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  background: #fff;
}
.checkbox.on {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.opt-text {
  flex: 1;
  font-size: 14px;
}
.opt-voters {
  font-size: 11px;
  color: var(--c-sub);
  margin-top: 2px;
}
.opt-count {
  font-weight: 600;
  color: var(--c-accent);
  margin-left: 8px;
  flex-shrink: 0;
}
.opt-foot {
  position: relative;
  padding: 0 10px 7px;
}
.opt-toggle {
  font-size: 11px;
  color: var(--c-accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.opt-admin {
  position: relative;
  padding: 0 10px 9px;
}
.suggest-label {
  margin-top: 6px;
}
.suggestions,
.not-voted {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--c-line);
}
.suggest {
  font-size: 13px;
  padding: 5px 0;
}
.suggest-name {
  font-weight: 600;
}
.nv-names {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nv-name {
  font-size: 12px;
  color: #9ca3af;
  background: #f1f2f4;
  padding: 3px 8px;
  border-radius: 999px;
}

/* 名单面板（日期 / 投票选项展开） */
.people {
  margin: -2px 0 9px;
  padding: 8px 10px;
  background: #fafbfc;
  border: 1px solid var(--c-line);
  border-radius: 6px;
}
.people-head {
  font-size: 12px;
  color: var(--c-sub);
  margin-bottom: 4px;
}
.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--c-line);
}
.person:last-child {
  border-bottom: none;
}
.person-name {
  font-size: 14px;
}
.person-count {
  font-size: 12px;
  margin-left: 3px;
}
.person-state {
  font-size: 12px;
  flex-shrink: 0;
}
.person.free .person-name {
  color: #111827;
  font-weight: 700;
}
.person.free .person-state {
  color: var(--c-green);
  font-weight: 600;
}
.person.busy .person-name,
.person.busy .person-state,
.person.busy .person-count {
  color: #b8bec8;
}
.person.none .person-name,
.person.none .person-state {
  color: #d0d4db;
}
.me-tag {
  font-size: 10px;
  background: var(--c-accent);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}

/* 日期统计 */
.slot-hint {
  margin: -4px 0 8px;
}
.slot {
  display: flex;
  align-items: center;
  padding: 4px 0;
  border-radius: 5px;
  margin-bottom: 5px;
  cursor: pointer;
  user-select: none;
}
.slot:hover,
.slot.open {
  background: rgba(59, 125, 221, 0.06);
}
.slot-label {
  width: 85px;
  font-size: 13px;
  flex-shrink: 0;
}
.slot-date {
  font-size: 11px;
  color: var(--c-sub);
}
.slot-track {
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: var(--c-bg);
  overflow: hidden;
}
.slot-fill {
  height: 100%;
  background: var(--c-green);
  border-radius: 999px;
}
.slot-fill.hot {
  background: var(--c-yellow);
}
.slot-count {
  width: 45px;
  text-align: right;
  font-size: 13px;
  color: var(--c-sub);
}
.slot-count.hot {
  color: #d69e00;
  font-weight: 700;
}
.slot-arrow {
  width: 18px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

.cancel-link {
  display: block;
  margin: 10px auto 0;
}

/* 已报名名单 */
.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  margin: -3px 0 5px;
}
.lg.yes { color: #111827; font-weight: 700; }
.lg.pending { color: #111827; }
.lg.no { color: #b8bec8; }
.ck-green { color: var(--c-green); }
.ck-gray { color: #c3c9d3; }
.reg {
  display: flex;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--c-line);
}
.reg:last-child {
  border-bottom: none;
}
.reg.is-org {
  background: rgba(139, 92, 246, 0.06);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
}
.reg.expired {
  opacity: 0.5;
}
.reg-avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
  margin-right: 10px;
}
.reg-avatar.org {
  background: var(--c-purple);
}
.reg-main {
  flex: 1;
  min-width: 0;
}
.reg-name {
  font-size: 15px;
  font-weight: 500;
}
.reg-count {
  font-size: 12px;
  color: var(--c-accent);
  margin-left: 4px;
}
.reg-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 8px;
}
.reg-time {
  font-size: 11px;
}
.round-check {
  font-size: 18px;
  font-weight: 700;
  width: 24px;
  text-align: center;
}
.round-check.yes { color: var(--c-green); }
.round-check.pending { color: #c3c9d3; }
.reg.round-yes .reg-name,
.reg.round-pending .reg-name {
  color: #111827;
  font-weight: 700;
}
.reg.round-no .reg-name,
.reg.round-no .round-text,
.reg.round-no .reg-count {
  color: #b8bec8;
  font-weight: 400;
}
.reg.round-no .reg-avatar {
  background: #d5d9e0;
}

/* 组织者设置 */
.admin {
  border: 1px dashed #c3c9d3;
  box-shadow: none;
}
.admin-hint {
  text-align: center;
  margin: 5px 0 10px;
}
.confirm-form {
  margin-top: 8px;
  padding: 4px 10px 10px;
  background: #fafbfc;
  border-radius: 7px;
}

/* 发起投票页 */
.option {
  padding: 10px;
  background: #fafbfc;
  border-radius: 7px;
  margin-bottom: 10px;
}
.option-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}
.option-no {
  font-weight: 600;
}
.option-row {
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
}
.option-row .input:first-child {
  flex: 3;
}
.option-row .input:last-child {
  flex: 2;
}
.option .input {
  background: #fff;
  border-color: var(--c-line);
}
.add {
  display: block;
  width: 100%;
  text-align: center;
  padding: 11px;
  border: 1px dashed var(--c-accent);
  border-radius: 7px;
  color: var(--c-accent);
  background: none;
  cursor: pointer;
}
.note {
  margin-top: 8px;
}

/* ---------- 弹窗 / 提示 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.mask.light {
  background: rgba(0, 0, 0, 0.15);
}
.mask.dark {
  background: rgba(0, 0, 0, 0.9);
  flex-direction: column;
}
.modal {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
}
.modal-title {
  font-size: 17px;
  font-weight: 600;
  padding: 20px 20px 6px;
}
.modal-content {
  font-size: 14px;
  color: var(--c-sub);
  padding: 0 20px 20px;
  white-space: pre-wrap;
}
.modal-actions {
  display: flex;
  border-top: 1px solid var(--c-line);
}
.modal-btn {
  flex: 1;
  height: 48px;
  border: 0;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
}
.modal-btn + .modal-btn {
  border-left: 1px solid var(--c-line);
}
.modal-btn.primary {
  color: var(--c-green);
  font-weight: 600;
}
.modal-btn.primary.danger {
  color: var(--c-red);
}
.loading-box {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 10px;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.preview img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}
.preview-tip {
  color: #ccc;
  font-size: 13px;
  margin-top: 12px;
}
.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  z-index: 200;
  max-width: 80%;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  text-align: center;
  pointer-events: none;
}
.toast.success {
  padding: 16px 22px;
}
.toast-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
}
.demo-bar {
  margin-top: 4px;
}
