:root {
  --brand: #5b4bff;
  --brand-2: #8b5cf6;
  --brand-soft: #eef0ff;
  --accent: #ff7a59;
  --accent-soft: #fff1ec;
  --ok: #10b981;
  --ok-soft: #e8faf3;
  --warn: #f59e0b;
  --warn-soft: #fff7e6;
  --danger: #ef4444;
  --danger-soft: #fdecec;

  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #12141c;
  --ink-2: #4a4f60;
  --ink-3: #8b90a0;
  --line: #ececf2;
  --line-2: #e2e3ec;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 16px rgba(24, 28, 58, 0.06);
  --shadow-lg: 0 12px 32px rgba(24, 28, 58, 0.12);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans SC',
    'Microsoft YaHei', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}

a {
  color: var(--brand);
  text-decoration: none;
}

/* ---------- 布局 ---------- */

.shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(88px + var(--safe-b));
}

@media (min-width: 900px) {
  .shell {
    max-width: 1080px;
    padding-bottom: 32px;
  }
}

/* ---------- 顶部品牌区 ---------- */

.hero {
  position: relative;
  overflow: hidden;
  margin: 0 -16px 16px;
  padding: 22px 22px 26px;
  border-radius: 0 0 28px 28px;
  background: linear-gradient(135deg, #6d5bff 0%, #8b5cf6 52%, #b06bff 100%);
  color: #fff;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.hero::before {
  width: 220px;
  height: 220px;
  right: -70px;
  top: -90px;
}

.hero::after {
  width: 130px;
  height: 130px;
  right: 40px;
  bottom: -80px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.3px;
}

.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.24);
  display: grid;
  place-items: center;
  font-size: 16px;
  backdrop-filter: blur(4px);
}

.hero h1 {
  position: relative;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.hero .sub {
  position: relative;
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.86;
}

.avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.18);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.avatar-btn img,
.avatar-btn .ph {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.35);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #4a3aff;
  font-weight: 800;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .dot {
  width: 6px;
  height: 16px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.muted {
  color: var(--ink-3);
  font-size: 13px;
}

/* ---------- 日期横向滚动 ---------- */

.date-scroller {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.date-scroller::-webkit-scrollbar {
  display: none;
}

.date-chip {
  flex: 0 0 auto;
  width: 62px;
  padding: 10px 0 9px;
  border-radius: 15px;
  background: #f4f5fa;
  text-align: center;
  border: 1.5px solid transparent;
  transition: 0.18s ease;
  scroll-snap-align: start;
}

.date-chip .wk {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
}

.date-chip .dd {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
}

.date-chip .tag {
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 1px;
}

.date-chip.active {
  background: linear-gradient(160deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(91, 75, 255, 0.28);
  transform: translateY(-1px);
}

.date-chip.active .wk,
.date-chip.active .tag {
  color: rgba(255, 255, 255, 0.82);
}

.date-chip.closed {
  opacity: 0.42;
}

/* ---------- 时段卡 ---------- */

.slots {
  display: grid;
  gap: 11px;
}

@media (min-width: 620px) {
  .slots {
    grid-template-columns: 1fr 1fr;
  }
}

.slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border-radius: 16px;
  background: #fafaff;
  border: 1.5px solid var(--line);
  text-align: left;
  transition: 0.18s ease;
  width: 100%;
}

.slot:hover:not(.disabled) {
  border-color: #cfc7ff;
  background: #f6f4ff;
}

.slot.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 6px 16px rgba(91, 75, 255, 0.14);
}

.slot.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.slot .time {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}

.slot .sname {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 600;
}

.slot .cap {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-2);
}

.slot .cap b {
  color: var(--brand);
}

.slot .check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  display: grid;
  place-items: center;
  background: #fff;
}

.slot.selected .check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-size: 12px;
}

.slot.selected .check::after {
  content: '✓';
  line-height: 1;
  font-weight: 800;
}

.ring {
  --p: 0%;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-2);
  background: conic-gradient(var(--brand) var(--p), #e8e8f2 0);
}

.ring > span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: inherit;
  background: #fff;
  display: grid;
  place-items: center;
}

.slot.full .ring {
  background: conic-gradient(var(--ink-3) var(--p), #e8e8f2 0);
}

.slot.full {
  background: #f7f7fa;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  transition: 0.16s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 10px 22px rgba(91, 75, 255, 0.26);
}

.btn-primary:active {
  transform: scale(0.985);
}

.btn-primary:disabled {
  background: #d9d9e6;
  box-shadow: none;
  color: #fff;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  background: #f3f4fa;
  color: var(--ink-2);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

.btn-line {
  border: 1.5px solid var(--line-2);
  background: #fff;
}

.link-btn {
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
}

/* ---------- 预约记录 ---------- */

.bk {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.bk:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.bk-date {
  flex: 0 0 auto;
  width: 52px;
  text-align: center;
  border-radius: 12px;
  background: var(--brand-soft);
  padding: 6px 0;
}

.bk-date .d {
  font-size: 17px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.bk-date .m {
  font-size: 10px;
  color: var(--brand);
  opacity: 0.75;
  font-weight: 600;
}

.bk-main {
  flex: 1;
  min-width: 0;
}

.bk-title {
  font-weight: 700;
  font-size: 14.5px;
}

.bk-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.pill.booked {
  background: var(--ok-soft);
  color: #0b8a63;
}

.pill.done {
  background: #eef1ff;
  color: #4338ca;
}

.pill.noshow {
  background: var(--warn-soft);
  color: #a15c00;
}

.pill.canceled {
  background: #f2f3f7;
  color: var(--ink-3);
}

/* ---------- 表单 ---------- */

.field {
  margin-bottom: 13px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fff;
  outline: none;
  transition: 0.15s;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(91, 75, 255, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 66px;
}

/* ---------- 底部固定操作条 ---------- */

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
}

.action-bar .shell-inner {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (min-width: 900px) {
  .action-bar .shell-inner {
    max-width: 1080px;
  }
}

.action-bar .sum {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.35;
}

.action-bar .sum b {
  display: block;
  font-size: 15px;
  color: var(--ink);
  font-weight: 800;
}

/* ---------- 空态 / 骨架 ---------- */

.empty {
  text-align: center;
  padding: 26px 10px;
  color: var(--ink-3);
  font-size: 13px;
}

.empty .emo {
  font-size: 30px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.8;
}

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 22, 34, 0.92);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.22s ease;
}

.toast.ok {
  background: #0f9d6e;
}

.toast.err {
  background: #d93a3a;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ---------- 弹层 ---------- */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 18, 30, 0.42);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease;
}

@media (min-width: 620px) {
  .sheet-mask {
    align-items: center;
  }
}

.sheet {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + var(--safe-b));
  animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 86vh;
  overflow-y: auto;
}

@media (min-width: 620px) {
  .sheet {
    border-radius: 22px;
  }
}

.sheet h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.sheet .sheet-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 16px;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

/* ---------- 加载条 ---------- */

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  transform-origin: left;
  animation: grow 1.1s ease infinite;
  z-index: 200;
}

@keyframes grow {
  0% {
    transform: scaleX(0);
  }
  60% {
    transform: scaleX(0.85);
  }
  100% {
    transform: scaleX(1);
    opacity: 0.4;
  }
}

.hidden {
  display: none !important;
}
