/* 理发预约 - 共享样式（移动端优先，适配微信内置浏览器） */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2128;
  --muted: #8a919c;
  --line: #e8ebef;
  --primary: #0d9488;
  --primary-dark: #0b7c72;
  --primary-bg: #e6f7f4;
  --amber: #b45309;
  --amber-bg: #fdf3e3;
  --gray-bg: #eef0f3;
  --gray-text: #a3abb5;
  --danger: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button { font-family: inherit; touch-action: manipulation; }
input, select { font-family: inherit; font-size: 16px; }

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

/* ---------- 头部 ---------- */
.header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 18px 16px 16px;
  border-radius: 0 0 20px 20px;
}
.header h1 { margin: 0; font-size: 20px; font-weight: 700; }
.header .sub { margin: 4px 0 0; font-size: 13px; opacity: .85; }
.header.row { display: flex; align-items: center; justify-content: space-between; }
.header.row h1 { font-size: 18px; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 按钮 ---------- */
.primary-btn {
  display: block; width: 100%;
  background: var(--primary); color: #fff;
  border: none; border-radius: 12px;
  padding: 13px 16px; font-size: 16px; font-weight: 600;
  cursor: pointer;
}
.primary-btn:active { background: var(--primary-dark); }
.primary-btn:disabled { background: var(--gray-bg); color: var(--gray-text); }
.ghost-btn {
  background: rgba(255,255,255,.16); color: #fff;
  border: 1px solid rgba(255,255,255,.45); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.link-btn {
  background: none; border: none; color: var(--primary);
  font-size: 14px; cursor: pointer; padding: 8px;
}
.danger-btn {
  background: #fdecec; color: var(--danger);
  border: none; border-radius: 10px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}

/* ---------- 日期条 ---------- */
.date-strip {
  display: flex; gap: 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 14px 4px;
  scrollbar-width: none;
}
.date-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto; width: 56px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 0 7px; text-align: center; cursor: pointer;
  position: relative;
}
.day-chip .top { font-size: 12px; color: var(--muted); }
.day-chip .bottom { font-size: 15px; font-weight: 600; margin-top: 1px; }
.day-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-chip.active .top { color: rgba(255,255,255,.8); }
.day-chip .badge {
  position: absolute; top: -5px; right: -4px;
  background: #f97316; color: #fff;
  min-width: 17px; height: 17px; line-height: 17px;
  border-radius: 999px; font-size: 11px; padding: 0 4px;
}

/* ---------- 主体 ---------- */
.main { padding: 12px 14px 0; }
.day-title { font-size: 16px; font-weight: 700; margin: 6px 2px 10px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px 10px; }
.day-head span:first-child { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.empty {
  text-align: center; color: var(--muted);
  background: var(--card); border-radius: var(--radius);
  padding: 34px 16px; font-size: 14px;
}

/* ---------- 空闲块 + 时间格（顾客端） ---------- */
.block-group { margin-bottom: 16px; }
.block-head { font-size: 13px; color: var(--muted); margin: 0 2px 8px; }
.cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cell {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 2px 7px; text-align: center; cursor: pointer;
  background: var(--card);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.cell-time { font-size: 15px; font-weight: 600; }
.cell-tag { font-size: 11px; line-height: 1.2; }
.cell.free { background: var(--primary-bg); border-color: #b5e3dd; color: var(--primary-dark); }
.cell.men { background: var(--amber-bg); border-color: #f3ddb5; color: var(--amber); }
.cell.taken { background: var(--gray-bg); border-color: var(--gray-bg); color: var(--gray-text); cursor: default; }
.cell.past { background: var(--gray-bg); border-color: var(--gray-bg); color: #c8cdd4; cursor: default; }

/* ---------- 底部弹层 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .22s ease;
}
.sheet.up { transform: translateY(0); }
.sheet-handle { width: 38px; height: 4px; border-radius: 4px; background: #d9dee4; margin: 4px auto 12px; }
.sheet-title { margin: 0 0 12px; font-size: 17px; }
.sheet-tip { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: center; }

.field { margin: 14px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; background: #fafbfc; outline: none;
}
.field input:focus { border-color: var(--primary); background: #fff; }

/* 服务选项卡片 */
.opt {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
}
.opt input { display: none; }
.opt-name { font-size: 15px; font-weight: 600; }
.opt-note { font-size: 12px; color: var(--muted); }
.opt .opt-check {
  margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid #cdd3da; flex: 0 0 auto;
}
.opt.checked { border-color: var(--primary); background: var(--primary-bg); }
.opt.checked .opt-check { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 4px #fff; }
.opt.disabled { opacity: .5; cursor: not-allowed; }

/* 预约成功 */
.success-wrap { text-align: center; padding: 8px 0 4px; }
.success-icon {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--primary-bg); color: var(--primary);
  font-size: 28px; line-height: 54px; margin: 4px auto 10px;
}
.success-code {
  font-size: 30px; font-weight: 800; letter-spacing: 4px;
  color: var(--primary-dark); margin: 6px 0 2px;
}
.success-info { background: #fafbfc; border-radius: 12px; padding: 12px 16px; margin: 14px 0; text-align: left; }
.success-info .row { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }
.success-info .row span:first-child { color: var(--muted); }

/* ---------- 预约卡片 / 列表 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
}
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-time { font-size: 16px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card-code { font-size: 12px; color: var(--muted); }
.card-code b { letter-spacing: 2px; color: var(--text); }
.tag {
  display: inline-block; font-size: 12px; border-radius: 6px; padding: 2px 8px;
}
.tag.men { background: var(--amber-bg); color: var(--amber); }
.tag.women { background: #ece7fd; color: #6d28d9; }
.tag.ok { background: var(--primary-bg); color: var(--primary-dark); }
.tag.cancelled { background: var(--gray-bg); color: var(--muted); }
.card-actions { margin-top: 10px; text-align: right; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 2px 10px; }

/* ---------- 时间轴（管理端） ---------- */
.timeline { margin-bottom: 4px; }
.tl-wrap { position: relative; display: flex; background: var(--card); border-radius: var(--radius); padding: 10px 0; }
.tl-gutter { position: relative; width: 48px; flex: 0 0 auto; }
.tl-hour { position: absolute; right: 8px; font-size: 11px; color: var(--muted); }
.tl-area { position: relative; flex: 1; margin-right: 10px; background:
  repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--line) 47px, var(--line) 48px);
  border-radius: 8px; }
.tl-block {
  position: absolute; left: 4px; right: 4px;
  background: var(--primary-bg); border: 1.5px dashed #9fd8d0; border-radius: 10px;
  color: var(--primary-dark); font-size: 12px;
  padding: 4px 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.tl-block button {
  background: rgba(13,148,136,.12); color: var(--primary-dark);
  border: none; border-radius: 8px; font-size: 12px; padding: 3px 10px; cursor: pointer;
  flex: 0 0 auto;
}
.tl-booking {
  position: absolute; left: 8px; right: 8px;
  background: var(--primary); color: #fff; border-radius: 10px;
  padding: 4px 12px; font-size: 12px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: 0 3px 8px rgba(13,148,136,.35);
}
.tl-booking b { font-size: 13px; }

/* ---------- 悬浮按钮（管理端） ---------- */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(calc(100% - 28px), 492px);
  background: var(--primary); color: #fff;
  border: none; border-radius: 14px;
  padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 18px rgba(13,148,136,.4);
}
.fab:active { background: var(--primary-dark); }

/* ---------- 登录 ---------- */
.login-view { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 340px;
  background: var(--card); border-radius: 18px; padding: 30px 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,.06);
  text-align: center;
}
.login-card h1 { font-size: 19px; margin: 0 0 6px; }
.login-card p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px; outline: none; text-align: center;
}
.login-card input:focus { border-color: var(--primary); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 18vh; z-index: 99;
  background: rgba(28,33,40,.9); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  max-width: 80vw; text-align: center;
}
.hidden { display: none !important; }
