:root {
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --border: #EAE7E0;
  --primary: #1F4E46;
  --primary-soft: rgba(31, 78, 70, 0.08);
  --primary-hover: #173D37;
  --accent: #C87D55;
  --accent-soft: rgba(200, 125, 85, 0.12);
  --text: #1A1A1A;
  --text-sub: #7A7A75;
  --text-muted: #C5C2BA;
  --danger: #B8423A;
  --danger-soft: rgba(184, 66, 58, 0.1);
  --shadow: 0 6px 24px rgba(26, 26, 26, 0.04);
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-pill: 10px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button, input, select {
  font-family: inherit;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

button:active {
  transform: scale(0.98);
}

.hidden {
  display: none !important;
}

/* ==================== 顾客端 & 理发师移动端容器 ==================== */
.mobile-shell {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  position: relative;
}

.chip-btn.icon-only {
  width: 34px;
  padding: 0;
  justify-content: center;
}

.badge-dot {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 微信右上角轻引导 & PWA 存桌面轻提示 */
.wx-guide {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(31, 78, 70, 0.25);
}

.wx-guide::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 18px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  transform: rotate(45deg);
}

.wx-guide-close {
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1;
  padding: 2px;
}

.pwa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

.pwa-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-install-btn {
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.pwa-close-btn {
  color: var(--text-sub);
  font-size: 16px;
  padding: 2px 4px;
}

/* 区块标题 */
.section {
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.04em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-sub);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot.green { background: var(--primary); }
.dot.amber { background: var(--accent); }
.dot.gray { background: var(--text-muted); }

/* 第一步：服务项目 2 列网格 */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 14px 13px;
  text-align: left;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-card.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(31, 78, 70, 0.18);
}

.service-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.service-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
}

.service-card.active .service-meta {
  color: rgba(255, 255, 255, 0.82);
}

/* 第二步：7天横向胶囊条 */
.date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.date-strip::-webkit-scrollbar { display: none; }

.date-pill {
  flex: 0 0 auto;
  min-width: 66px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text);
}

.date-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.date-pill-top {
  font-size: 11px;
  opacity: 0.72;
}

.date-pill-day {
  font-size: 16px;
  font-weight: 700;
}

/* 第三步：4列时间网格 */
.slot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px;
  box-shadow: var(--shadow);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.slot-btn {
  height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.slot-btn.available {
  background: #FFFFFF;
  border-color: #DCD8CE;
}

.slot-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.slot-btn.disabled {
  background: #F4F3EF;
  border-color: transparent;
  color: var(--text-muted);
  cursor: not-allowed;
}

.slot-sub {
  font-size: 10px;
  font-weight: 400;
  margin-top: 2px;
  opacity: 0.75;
}

/* 底部浮起确认条 */
.confirm-bar {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: #1A1A1A;
  color: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  z-index: 40;
}

.confirm-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.confirm-main {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confirm-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-btn);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
  height: 46px;
  font-size: 15px;
}

.btn-outline {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-btn);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* 弹层 / 抽屉 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 21, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 80;
}

.modal-backdrop.center {
  align-items: center;
  padding: 20px;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.16);
}

.modal-backdrop.center .modal-sheet {
  border-radius: 20px;
  max-width: 360px;
  padding: 24px 20px 22px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-sub);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
}

.input:focus {
  border-color: var(--primary);
  background: #fff;
}

/* 预约记录卡片 */
.appt-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.appt-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.appt-meta {
  font-size: 12px;
  color: var(--text-sub);
}

/* Toast 轻提示 */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #1A1A1A;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}

/* ==================== 理发师后台 (/admin) ==================== */
.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #ECEAE3;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.admin-tab {
  height: 36px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.admin-tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-toolbar input[type="date"] {
  flex: 1;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.stat-lbl {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

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

.order-card.in_progress {
  border-left: 4px solid var(--primary);
}

.order-card.completed,
.order-card.cancelled,
.order-card.no_show {
  opacity: 0.62;
}

.order-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-time {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.order-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-sub);
}

.tag.stylist { background: var(--primary-soft); color: var(--primary); }
.tag.amber { background: var(--accent-soft); color: var(--accent); }
.tag.done { background: #E9ECEA; color: #5B6661; }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.tel-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}

.order-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.act-btn {
  flex: 1;
  height: 36px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
}

.act-btn.primary { background: var(--primary); color: #fff; }
.act-btn.accent { background: var(--accent); color: #fff; }
.act-btn.danger { background: var(--danger-soft); color: var(--danger); }

.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.walkin-chip {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: left;
}

.walkin-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ==================== 店面大屏 (/board) 16:9 无滚动条 ==================== */
body.board-body {
  background: #121514;
  color: #F4F2EC;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.board-wrap {
  height: 100vh;
  width: 100vw;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 20px;
  padding: 20px 24px;
  position: relative;
}

.board-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: #1F4E46;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  gap: 12px;
}

.board-banner.cancel {
  background: #9B3C35;
}

.board-left {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-height: 0;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1B201E;
  border: 1px solid #2A312E;
  border-radius: 18px;
  padding: 16px 24px;
}

.board-brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.board-shop {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.board-date {
  font-size: 18px;
  color: #A6ACA8;
}

.board-clock-group {
  display: flex;
  align-items: center;
  gap: 20px;
}

.board-clock {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #F7F6F2;
}

.board-chair-pill {
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(31, 78, 70, 0.35);
  border: 1px solid #2E7366;
  font-size: 18px;
  font-weight: 600;
  color: #D7EFE9;
}

.voice-btn {
  padding: 10px 18px;
  border-radius: 12px;
  background: #C87D55;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.voice-btn.enabled {
  background: #23302C;
  border: 1px solid #354943;
  color: #A6D6CA;
}

/* 甘特排班区 */
.gantt-panel {
  background: #1B201E;
  border: 1px solid #2A312E;
  border-radius: 18px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
  overflow: hidden;
}

.gantt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.gantt-title {
  font-size: 18px;
  font-weight: 600;
  color: #D4D8D5;
}

.gantt-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  color: #A6ACA8;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.legend-box.r { background: #2A6E62; }
.legend-box.w { background: rgba(200, 125, 85, 0.28); border: 1px dashed #E09A72; }
.legend-box.blk { background: #3B403E; }

.gantt-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-height: 0;
}

.gantt-axis {
  display: flex;
  justify-content: space-between;
  padding-left: 112px;
  font-size: 13px;
  color: #88908C;
  margin-bottom: 6px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 12px;
  height: 38%;
}

.stylist-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stylist-name {
  font-size: 20px;
  font-weight: 700;
}

.stylist-state {
  font-size: 13px;
  color: #93D3C2;
}

.stylist-state.working { color: #E8A67D; }
.stylist-state.blocked { color: #8A908D; }

.gantt-track {
  position: relative;
  height: 100%;
  background: #141817;
  border: 1px solid #262D2A;
  border-radius: 12px;
  overflow: hidden;
}

.gantt-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #E4584F;
  z-index: 20;
  box-shadow: 0 0 10px rgba(228, 88, 79, 0.7);
}

.gantt-seg {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gantt-seg.R {
  background: #256459;
  border: 1px solid #358778;
  color: #F4FAF8;
  z-index: 5;
}

.gantt-seg.W {
  background: rgba(200, 125, 85, 0.22);
  border: 1.5px dashed #DC956C;
  color: #F2C8AE;
  z-index: 3;
}

.gantt-seg.completed {
  opacity: 0.42;
}

.gantt-seg.block {
  background: repeating-linear-gradient(
    -45deg,
    #2C312F,
    #2C312F 6px,
    #232725 6px,
    #232725 12px
  );
  border: 1px solid #3E4542;
  color: #9DA3A0;
  z-index: 4;
}

/* 即将到店队列 */
.queue-panel {
  background: #1B201E;
  border: 1px solid #2A312E;
  border-radius: 18px;
  padding: 16px 22px;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.queue-card {
  background: #141817;
  border: 1px solid #282F2C;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-time {
  font-size: 24px;
  font-weight: 700;
  color: #8FD4C3;
}

.queue-who {
  font-size: 18px;
  font-weight: 600;
}

.queue-svc {
  font-size: 14px;
  color: #A6ACA8;
}

/* 右侧固定栏 (25%) */
.board-right {
  background: #1B201E;
  border: 1px solid #2A312E;
  border-radius: 18px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.next-avail-box {
  width: 100%;
  background: #141817;
  border: 1px solid #2A312E;
  border-radius: 16px;
  padding: 20px 14px;
}

.next-avail-sub {
  font-size: 15px;
  color: #A6ACA8;
  margin-bottom: 8px;
}

.next-avail-val {
  font-size: 38px;
  font-weight: 800;
  color: #8FD4C3;
  letter-spacing: 0.02em;
}

.next-avail-val.amber {
  color: #E3A076;
}

.qr-frame {
  background: #FFFFFF;
  padding: 14px;
  border-radius: 20px;
  width: min(260px, 100%);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.qr-caption {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #F4F2EC;
}

.empty-hint {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-sub);
  font-size: 13px;
}
