:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #eceef2;
  --primary: #4f46e5;
  --primary-soft: #f3f2ff;
  --danger: #e5484d;
  --success: #1a7f45;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 18px; padding-bottom: 18px;
}
.header-inner h1 { font-size: 22px; margin: 0; }
.header-inner nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.header-inner nav a {
  color: var(--primary); text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 11px 18px; border-radius: 999px; background: var(--primary-soft);
}
/* 顶部两个入口按钮（我的预约 / 登录注册）做大一点，手机上更好点 */
.header-inner nav .btn-ghost {
  padding: 11px 20px; font-size: 15px; font-weight: 500; border-radius: 999px;
}

/* 底部有 fixed 的「确认预约」条：正文要留出足够空白，否则最后一块（备注）被盖住点不到。
   main 同时带 class="container"（padding: 0 20px），单写 main 会被类选择器覆盖成 0，
   因此这里必须用 main.container 提高特异性。 */
main.container {
  padding-top: 24px;
  padding-bottom: calc(170px + env(safe-area-inset-bottom, 0px));
}
#remark { scroll-margin-bottom: 200px; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin-bottom: 18px;
}
.panel h2 { font-size: 16px; margin: 0 0 16px; }
.panel h2 small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
#slotHint { margin: 14px 0 0; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.service-card {
  border: 2px solid var(--line); border-radius: 12px; padding: 14px;
  background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s;
}
.service-card:hover { border-color: #c9c6f5; }
.service-card.active { border-color: var(--primary); background: var(--primary-soft); }
.service-name { font-weight: 600; font-size: 15px; }
.service-desc { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }

.cal-range { font-size: 12px; color: var(--muted); }
.cal-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.cal-bar button:disabled { opacity: .4; cursor: not-allowed; }
.cal-title { font-size: 15px; font-weight: 600; }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 4px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  min-height: 58px; border-radius: 12px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; user-select: none;
}
.cal-day.is-blank { visibility: hidden; }
.cal-num { font-size: 16px; font-weight: 600; line-height: 1.2; }
.cal-state { font-size: 11px; line-height: 1.2; }
.cal-day.is-today { box-shadow: inset 0 0 0 1px #dcd8ff; }
.cal-day.is-clickable { cursor: pointer; }
/* 已选中项不参与 hover 变色，否则白字会落在浅底上看不见 */
.cal-day.is-clickable:not(.is-selected):hover { background: var(--primary-soft); }
.state-open .cal-num { color: var(--text); }
.state-open .cal-state { color: var(--success); }
.state-full .cal-num { color: #6b7280; }
.state-full .cal-state { color: #9aa0a8; }
.state-rest .cal-num, .state-rest .cal-state,
.state-unreleased .cal-num, .state-unreleased .cal-state,
.state-ended .cal-num, .state-ended .cal-state { color: #c3c7ce; }
.cal-day.is-selected { background: var(--primary); }
.cal-day.is-selected .cal-num, .cal-day.is-selected .cal-state { color: #fff; }
.slot-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; max-width: 540px;
}
/* 上午 / 下午分组 */
.session + .session { margin-top: 16px; }
.session-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.session-name { font-size: 13px; font-weight: 600; color: var(--text); }
.session-range { font-size: 12px; color: var(--muted); }
.slot {
  border: 1.5px solid #eef0f3; border-radius: 9px; background: #fafbfc;
  min-height: 40px; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; text-align: center;
  color: #c3c7ce; cursor: default;
}
/* 可约：绿色，可点击 */
.slot.is-open {
  color: var(--success); border-color: #b7e2c6; background: #f3fbf6; cursor: pointer;
}
.slot.is-open:hover { border-color: var(--success); }
/* 选中：紫色描边 */
.slot.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.slot-time { font: inherit; }

.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fafbfc; font-size: 14px; color: var(--text); margin-bottom: 10px;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--primary); background: #fff; }
.input-half { width: calc(50% - 6px); display: inline-block; }
.input-half + .input-half { margin-left: 8px; }

.btn-primary, .btn-ghost, .btn-danger {
  border: 0; border-radius: 10px; padding: 10px 18px; font-size: 14px;
  cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { background: #c7c9d1; cursor: not-allowed; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.booking-bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--card);
  border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(31, 35, 41, .06);
  padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 10;
}
.booking-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.booking-bar-inner span { color: var(--primary); font-size: 13px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fdecec; color: var(--danger); }
.alert-success { background: #e6f6ec; color: var(--success); }
.hidden { display: none !important; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; font-size: 13px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 4px 0; }
.form-help { color: var(--muted); font-size: 12px; margin: 0 0 12px; }

.modal {
  position: fixed; inset: 0; background: rgba(31, 35, 41, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 20;
}
.modal-card {
  background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 460px;
  max-height: 84vh; overflow-y: auto;
}
.modal-card h3 { margin: 0 0 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-info { flex: 1; min-width: 0; }
.list-title { font-weight: 600; }
.list-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.tag { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: #eef0f4; color: #6b7280; }
.tag-success { background: #e6f6ec; color: var(--success); }
.tag-muted { background: #f2f3f5; color: var(--muted); }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; border: 1px solid var(--line); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.rule-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rule-name { width: 52px; font-weight: 600; }
.rule-value { flex: 1; color: var(--primary); font-size: 13px; }
.rule-cap { font-size: 12px; color: var(--muted); }

/* ---------- 被预约方页面 ---------- */
.header-inner p.header-sub { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
/* 该页没有底部预约条，不需要给固定条留白 */
main.container.provider-main { padding-bottom: 40px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 8px; text-align: center;
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-row .input-half { flex: 1 1 160px; width: auto; }
.filter-row .input-half + .input-half { margin-left: 0; }

.bk-row { align-items: flex-start; flex-wrap: wrap; }
.bk-contact { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bk-label { color: var(--muted); }
.bk-name { font-weight: 600; color: var(--text); }
.bk-phone { color: var(--primary); font-weight: 600; letter-spacing: .3px; }
.bk-call {
  color: var(--success); text-decoration: none; font-size: 12px;
  border: 1px solid #cdebd8; background: #f2fbf5; border-radius: 999px; padding: 2px 10px;
}
.bk-extra { color: var(--muted); }

@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .booking-bar-inner { flex-direction: column; align-items: stretch; }
  .booking-bar-inner span { text-align: center; }
  /* 手机上进度条变成两行，留白要跟着加，否则备注框会被压在条下面 */
  main.container { padding-bottom: calc(210px + env(safe-area-inset-bottom, 0px)); }
  .cal-day { min-height: 50px; }
  .cal-num { font-size: 15px; }
  .cal-state { font-size: 10px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
