/* 天亮请开会 —— 设计系统（飞书日程清爽风） */
:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --text-1: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --border: #dee0e3;
  --divider: #e5e6eb;
  --primary: #3370ff;
  --primary-hover: #2860e1;
  --primary-soft: #e8f3ff;
  --green: #2ea121;
  --green-soft: #e8f9e5;
  --orange: #ff8800;
  --orange-soft: #fff3e0;
  --danger: #f54a45;
  --danger-soft: #feecec;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 4px rgba(31, 35, 41, 0.06);
  --shadow-sheet: 0 -8px 24px rgba(31, 35, 41, 0.1);
  --tap: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5715;
  -webkit-tap-highlight-color: transparent;
}
input, button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px 16px calc(88px + env(safe-area-inset-bottom));
}
.app--flush { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4e83fd, #3370ff);
  color: #fff;
  font-size: 18px;
  display: grid;
  place-items: center;
}
.brand__name { font-size: 17px; font-weight: 600; letter-spacing: 0.5px; }
.brand__slogan { font-size: 12px; color: var(--text-3); }

.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.me-chip b { font-weight: 500; font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  margin-bottom: 12px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card__hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  user-select: none;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:active { background: var(--primary-hover); }
.btn--secondary { background: var(--surface); color: var(--text-1); border: 1px solid var(--border); }
.btn--secondary:active { background: var(--bg); }
.btn--text { color: var(--primary); padding: 0 8px; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--lg { height: var(--tap); font-size: 15px; border-radius: 10px; }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- 列表行 ---------- */
.cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  width: 100%;
  text-align: left;
}
.cell:last-child { border-bottom: none; }
.cell__main { flex: 1; min-width: 0; }
.cell__label { color: var(--text-2); }
.cell__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cell__value { color: var(--text-2); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell__arrow { color: var(--text-3); flex: none; }
.cell--tappable:active { background: var(--bg); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.input {
  width: 100%;
  height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

/* 分段/芯片选择 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  position: relative;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip--selected { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 500; }
.chip__x { color: var(--text-3); font-size: 15px; line-height: 1; padding: 2px; }
.chip__badge {
  position: absolute;
  top: -8px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  box-sizing: border-box;
}

/* 选人页：已选人员 + 板块筛选吸顶 */
.picker-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  padding-top: 6px;
  border-bottom: 1px solid var(--divider);
}

/* 会议页：三步状态条 */
.steps { display: flex; align-items: center; margin: 12px 2px 2px; }
.step { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); position: relative; }
.step__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin: 0 auto 5px;
  background: var(--divider);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.step--done .step__dot { background: var(--primary); color: #fff; }
.step--now .step__dot { background: #fff; border: 2px solid var(--primary); color: var(--primary); font-weight: 700; }
.step--now { color: var(--primary); font-weight: 600; }
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 11px;
  left: calc(50% + 13px);
  width: calc(100% - 26px);
  height: 2px;
  background: var(--divider);
}
.step--done:not(:last-child)::after { background: var(--primary); }

/* 会议页：每人时间安排（热力网格，仅发起人） */
.hgrid { border-collapse: separate; border-spacing: 3px; width: 100%; }
.hgrid th { font-size: 10px; color: var(--text-3); font-weight: 500; padding-bottom: 2px; }
.hgrid .who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-1);
  white-space: nowrap;
  padding-right: 6px;
}
.hgrid .who .avatar { width: 22px; height: 22px; font-size: 11px; }
.hcell { height: 26px; border-radius: 5px; background: var(--bg); }
.hcell.on { background: var(--green-soft); border: 1px solid rgba(46, 161, 33, .35); }
.hcount {
  height: 24px;
  border-radius: 5px;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg);
  line-height: 24px;
}
.hcount.c1 { background: #f0f7ef; color: var(--green); }
.hcount.c2 { background: var(--green-soft); color: var(--green); font-weight: 600; }
.hcount.c3 { background: var(--green); color: #fff; font-weight: 600; }
.best-band { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* 选人页：加载进度 + 骨架屏 */
.loading { padding: 8px 16px 16px; }
.loading__row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.loading__title { font-size: 13px; color: var(--text-2); }
.loading__pct { font-size: 22px; font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.loadbar { height: 6px; border-radius: 999px; background: var(--divider); overflow: hidden; }
.loadbar__fill { height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width .18s ease-out; }
.skeleton { margin-top: 18px; display: grid; gap: 14px; }
.skeleton__row { display: flex; align-items: center; gap: 12px; }
.skeleton__avatar { width: 36px; height: 36px; border-radius: 50%; }
.skeleton__bar { height: 12px; border-radius: 6px; flex: 1; }
.skeleton__avatar, .skeleton__bar {
  background: linear-gradient(90deg, var(--divider) 25%, var(--bg) 50%, var(--divider) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 已选人员：头像 + 名字，自动换行，点头像移除 */
.selected-people { display: flex; flex-wrap: wrap; gap: 10px 6px; padding: 4px 16px 10px; }
.selected-person {
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
}
.selected-person__avatar { position: relative; }
.selected-person .avatar, .selected-person .avatar-ph { width: 32px; height: 32px; font-size: 13px; }
.selected-person__name {
  font-size: 11px;
  color: var(--text-2);
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
}
.badge--primary { background: var(--primary-soft); color: var(--primary); }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--orange { background: var(--orange-soft); color: var(--orange); }
.badge--gray { background: var(--bg); color: var(--text-2); }
.badge--red { background: #ffece8; color: #d83931; }

/* 匹配失败：全员已提交但无重合空闲 */
.mismatch-card { text-align: center; padding: 20px 20px 24px; }
.mismatch-card__icon {
  width: 64px;
  height: 64px;
  margin: 16px auto 0;
  border-radius: 50%;
  background: #fff3e8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.mismatch-card__title { margin-top: 12px; font-size: 18px; font-weight: 600; }
.mismatch-card__text { margin-top: 6px; font-size: 13px; color: var(--text-2); line-height: 1.7; }

/* 头像 */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--divider);
}
.avatar-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 500;
  flex: none;
}

/* ---------- 提示横幅 ---------- */
.banner {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}
.banner--info { background: var(--primary-soft); color: var(--primary); }
.banner--warning { background: var(--orange-soft); color: var(--orange); }
.banner--gray { background: var(--bg); color: var(--text-2); }

/* ---------- Tab 分段 ---------- */
.tabbar {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 12px;
}
.tabbar__item {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tabbar__item--active { background: var(--surface); color: var(--text-1); font-weight: 600; box-shadow: var(--shadow-card); }

/* ---------- 底部固定栏 ---------- */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
}
.bottom-bar__inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bottom-bar__info { flex: 1; min-width: 0; }
.bottom-bar__count { font-size: 13px; color: var(--text-2); }
.bottom-bar__count b { color: var(--text-1); font-size: 15px; }

/* ---------- 弹层（底部抽屉 / 全屏页） ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 35, 41, 0.45);
  z-index: 40;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-sheet);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.2s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--divider);
}
.sheet__title { font-size: 16px; font-weight: 600; }
.sheet__body { flex: 1; overflow-y: auto; padding: 12px 16px; -webkit-overflow-scrolling: touch; }
.sheet__footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--divider); }
.sheet--center {
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  width: min(88vw, 420px);
  transform: translate(-50%, -50%);
  border-radius: 16px;
  animation: fade-in 0.15s ease-out;
}

.fullpage {
  position: fixed;
  inset: 0;
  z-index: 41;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.15s ease-out;
}
.fullpage__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}
.fullpage__title { font-size: 16px; font-weight: 600; flex: 1; text-align: center; }
.fullpage__sub { padding: 8px 16px; font-size: 12px; color: var(--text-3); background: var(--surface); border-bottom: 1px solid var(--divider); }
.fullpage__body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fullpage__footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--divider); }

/* ---------- 日历 ---------- */
.cal-quick { display: flex; gap: 8px; margin-bottom: 12px; }
.cal-quick .chip { flex: 1; justify-content: center; }
.cal-month__title { font-size: 14px; font-weight: 600; margin: 14px 0 8px; position: sticky; top: 0; background: var(--surface); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week { text-align: center; font-size: 12px; color: var(--text-3); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  position: relative;
}
.cal-day--out { color: var(--text-3); opacity: 0.35; pointer-events: none; }
.cal-day--past { color: var(--text-3); opacity: 0.55; pointer-events: none; }
.cal-day--inrange { background: var(--primary-soft); border-radius: 0; }
.cal-day--range-start { background: linear-gradient(to right, transparent 50%, var(--primary-soft) 50%); border-radius: 8px 0 0 8px; }
.cal-day--range-end { background: linear-gradient(to left, transparent 50%, var(--primary-soft) 50%); border-radius: 0 8px 8px 0; }
.cal-day--selected { background: var(--primary) !important; color: #fff; font-weight: 600; border-radius: 8px; z-index: 1; }
.cal-day__dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; margin-top: 2px; opacity: 0.6; }

/* ---------- 会议页 ---------- */
.daystrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; margin-bottom: 12px; }
.daystrip::-webkit-scrollbar { display: none; }
.daystrip__item {
  flex: none;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  position: relative;
}
.daystrip__item--active { background: var(--primary); border-color: var(--primary); color: #fff; }
.daystrip__date { font-size: 13px; font-weight: 500; }
.daystrip__week { font-size: 11px; color: var(--text-3); }
.daystrip__item--active .daystrip__week { color: rgba(255, 255, 255, 0.8); }
.daystrip__count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.hour-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  width: 100%;
  text-align: left;
}
.hour-row:last-child { border-bottom: none; }
.hour-list { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.hour-row--allfree { background: var(--orange-soft); }
.hour-row--selected.hour-row--allfree { background: var(--green-soft); }
.hour-row__time { font-weight: 500; font-variant-numeric: tabular-nums; }
.hour-row__state { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.hour-row--selected { background: var(--green-soft); }
.hour-row--selected .hour-row__state { color: var(--green); font-weight: 500; }
.hour-row--readonly { opacity: 0.75; pointer-events: none; }

.window-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.window-card--final { border-color: var(--orange); background: var(--orange-soft); }
.window-card__time { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.window-card__meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.progress { height: 6px; border-radius: 3px; background: var(--divider); overflow: hidden; margin: 8px 0 4px; }
.progress__bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.2s; }

/* ---------- 空状态 / 错误 ---------- */
.empty { text-align: center; padding: 32px 16px; color: var(--text-3); }
.empty__icon { font-size: 34px; margin-bottom: 8px; }
.empty__title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty__text { font-size: 13px; margin-bottom: 14px; line-height: 1.7; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(31, 35, 41, 0.85);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 60;
  animation: toast-in 0.18s ease-out;
  max-width: 80vw;
  text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 桌面端 ---------- */
@media (min-width: 720px) {
  body { background: #eef0f2; }
  .app {
    background: var(--bg);
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(31, 35, 41, 0.08);
    min-height: calc(100vh - 40px);
  }
  .sheet {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(560px, calc(100vw - 48px));
    transform: translateX(-50%);
    border-radius: 16px;
    animation: fade-in 0.15s ease-out;
  }
  .sheet--center {
    top: 50%;
    bottom: auto;
    width: min(420px, calc(100vw - 48px));
    transform: translate(-50%, -50%);
  }
  .fullpage {
    left: 50%;
    right: auto;
    top: 24px;
    bottom: 24px;
    width: min(560px, calc(100vw - 48px));
    transform: translateX(-50%);
    border-radius: 16px;
    animation: fade-in 0.15s ease-out;
  }
  .bottom-bar__inner { max-width: 648px; }
}
