:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #f2efe9;
  --line: #e4dfd6;
  --ink: #2b2a27;
  --ink-2: #57534c;
  --muted: #8a837a;
  --accent: #5c7f6b;
  --accent-soft: #e8efe9;
  --accent-ink: #3d5b4a;
  --warn: #b4794a;
  --warn-soft: #f7ece0;
  --danger: #b0524f;
  --danger-soft: #f8e9e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 42, 39, .04), 0 8px 24px rgba(43, 42, 39, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }
.wrap-narrow { max-width: 720px; }

/* ---------- 头部 ---------- */
.hero { padding: 12px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.hero h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: .5px; font-weight: 600; }
.hero .sub { color: var(--ink-2); margin: 0 0 10px; }
.hero .intro { color: var(--muted); font-size: 14px; margin: 0; white-space: pre-wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 3px 12px; font-size: 12.5px; }

/* ---------- 卡片 / 步骤 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2 { font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.step-no { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; margin-right: 8px; vertical-align: 2px; }

/* ---------- 时长选择 ---------- */
.dur-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dur-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); text-align: left; transition: .15s; }
.dur-card:hover { border-color: var(--accent); }
.dur-card.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.dur-card .t { font-weight: 600; font-size: 15px; }
.dur-card .m { color: var(--muted); font-size: 13px; margin-top: 2px; }
.dur-card .d { color: var(--ink-2); font-size: 13px; margin-top: 6px; }
.dur-card .f { color: var(--accent-ink); font-size: 12.5px; margin-top: 6px; }

/* ---------- 日历 ---------- */
.picker { display: grid; grid-template-columns: 320px 1fr; gap: 22px; }
@media (max-width: 760px) { .picker { grid-template-columns: 1fr; } .dur-grid { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head .m { font-weight: 600; }
.nav-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 30px; height: 30px; line-height: 1; color: var(--ink-2); }
.nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.cal-cell { aspect-ratio: 1/1; border: 1px solid transparent; border-radius: 10px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-2); font-size: 14px; position: relative; }
.cal-cell.blank { visibility: hidden; }
.cal-cell.has { background: var(--surface-2); border-color: var(--line); color: var(--ink); font-weight: 500; }
.cal-cell.has:hover { border-color: var(--accent); }
.cal-cell.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-cell.today::after { content: ''; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .5; }
.cal-cell .dot { position: absolute; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal-cell.sel .dot { background: #fff; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.slot { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 4px; text-align: center; font-variant-numeric: tabular-nums; transition: .15s; }
.slot:hover { border-color: var(--accent); color: var(--accent-ink); }
.slot.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty { color: var(--muted); font-size: 14px; padding: 18px 0; text-align: center; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input[type=text], .field input[type=tel], .field input[type=email], .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; transition: .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92, 127, 107, .12); }
.field textarea { resize: vertical; min-height: 84px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
/* 未填写提示 */
.ferr { color: var(--danger); font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.ferr::before { content: '!'; display: inline-block; width: 14px; height: 14px; line-height: 14px; text-align: center; border-radius: 50%; background: var(--danger); color: #fff; font-size: 10px; margin-right: 5px; vertical-align: 1px; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); background: #fdf7f7; }
.field.invalid input:focus { box-shadow: 0 0 0 3px rgba(176, 82, 79, .12); }
.field.invalid label { color: var(--danger); }
.seg.invalid button { border-color: var(--danger); color: var(--danger); }
.btn.notready { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
.btn.notready:hover { background: #ece8e1; color: var(--ink-2); }
#submit-hint { min-height: 18px; }
#submit-hint b { color: var(--warn); font-weight: 600; }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 16px; color: var(--ink-2); }
.seg button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.mode-note { font-size: 13px; color: var(--muted); margin-top: 8px; }

.btn { display: inline-block; border: none; border-radius: 10px; padding: 11px 22px; background: var(--accent); color: #fff; font-weight: 500; transition: .15s; }
.btn:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--surface); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #e9cdcc; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.alert { border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.alert.err { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--accent-soft); color: var(--accent-ink); }
.alert.info { background: var(--surface-2); color: var(--ink-2); }

/* ---------- 结果 / 状态页 ---------- */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; }
.status-pill.pending { background: var(--warn-soft); color: var(--warn); }
.status-pill.confirmed { background: var(--accent-soft); color: var(--accent-ink); }
.status-pill.cancelled, .status-pill.rejected { background: var(--surface-2); color: var(--muted); }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 30px; }

/* ---------- 管理端 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .inner { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar .brand { font-weight: 600; }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 14px; color: var(--ink-2); }
.tab.active { background: var(--accent-soft); color: var(--accent-ink); border-color: #d5e2da; }
.pill { background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; }

.week-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); position: relative; }
.wg-head { display: contents; }
.wg-head > div { padding: 6px 4px; font-size: 12.5px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.wg-head > div.today { color: var(--accent-ink); font-weight: 600; }
.wg-body { display: contents; }
.wg-hours { grid-column: 1; position: relative; }
.wg-hour { position: absolute; left: 0; right: 0; font-size: 11px; color: var(--muted); transform: translateY(-50%); padding-right: 6px; text-align: right; }
.wg-col { position: relative; border-left: 1px solid var(--line); min-height: 720px; background: repeating-linear-gradient(to bottom, transparent, transparent 47px, #f0ede7 47px, #f0ede7 48px); }
.wg-col.weekend { background-color: #faf8f4; }
.win { position: absolute; left: 0; right: 0; background: rgba(92, 127, 107, .07); border-left: 2px solid rgba(92, 127, 107, .25); cursor: pointer; }
.win:hover { background: rgba(92, 127, 107, .15); }
.blk { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #efeae2, #efeae2 5px, #e7e1d7 5px, #e7e1d7 10px); }
.blk.open { background: rgba(92, 127, 107, .16); }
.blk.busy { background: #dde3ea; border-left: 3px solid #9aa7b4; }
.blk .blk-t { display: block; font-size: 11px; color: #5b6673; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-col { cursor: pointer; }
.wg-col:hover { outline: 2px dashed rgba(92, 127, 107, .35) inset; outline-offset: -2px; }
.blk { cursor: pointer; }
.blk:hover { filter: brightness(.96); outline: 2px solid rgba(43, 42, 39, .22); outline-offset: -2px; }
.evt { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 6px; font-size: 12px; overflow: hidden; cursor: pointer; border: 1px solid; line-height: 1.35; }
.evt.pending { background: var(--warn-soft); border-color: #e8d3bd; color: #8a5a32; }
.evt.confirmed { background: var(--accent-soft); border-color: #cfe0d5; color: var(--accent-ink); }
.evt.cancelled, .evt.rejected { background: #f1efeb; border-color: #e2ded6; color: var(--muted); text-decoration: line-through; }
.evt .n { font-weight: 600; }
.evt .t { opacity: .8; font-variant-numeric: tabular-nums; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.item .main { flex: 1; min-width: 240px; }
.item .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.item .who { color: var(--ink-2); font-size: 14px; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 4px; word-break: break-all; }
.item .ops { display: flex; gap: 8px; flex-wrap: wrap; }

.modal-mask { position: fixed; inset: 0; background: rgba(43, 42, 39, .35); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 16px; max-width: 520px; width: 100%; max-height: 86vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .close { float: right; border: none; background: transparent; font-size: 20px; color: var(--muted); line-height: 1; }

.wk-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; margin-bottom: 10px; }
.wk-row .d { font-size: 14px; color: var(--ink-2); padding-top: 8px; }
.wk-intervals { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-int { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 13px; }
.wk-int input { border: none; background: transparent; width: 52px; padding: 0; outline: none; font-variant-numeric: tabular-nums; }
.wk-int .x { border: none; background: transparent; color: var(--muted); padding: 0 2px; }
.add-int { border: 1px dashed var(--line); background: transparent; border-radius: 8px; padding: 4px 10px; font-size: 13px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.small { font-size: 12.5px; color: var(--muted); }
.hidden { display: none !important; }

/* ---------- 手机适配 ---------- */
@media (max-width: 760px) {
  .wrap { padding: 18px 14px 64px; }
  .hero { padding: 8px 0 20px; margin-bottom: 18px; }
  .hero h1 { font-size: 22px; }
  .hero .intro { font-size: 13.5px; }
  .card { padding: 16px; border-radius: 12px; margin-bottom: 14px; }
  input, select, textarea { font-size: 16px; }           /* 防止 iOS 聚焦时自动放大 */
  .nav-btn { width: 36px; height: 36px; font-size: 18px; }
  .btn { padding: 13px 20px; width: 100%; }
  .btn.sm { width: auto; padding: 8px 14px; }
  .actions .btn { width: auto; flex: 1 1 auto; }
  .dur-card { padding: 12px; }
  .cal-cell { font-size: 15px; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
  .slot { padding: 12px 4px; font-size: 15px; }
  .kv { grid-template-columns: 76px 1fr; font-size: 13.5px; }
  .item { padding: 12px; }
  .item .ops { width: 100%; }
  .item .ops .btn { width: 100%; }
  .modal { padding: 18px; border-radius: 14px; max-height: 90vh; }
  .modal-mask { padding: 12px; align-items: flex-end; }
  .topbar .inner { padding: 8px 14px; gap: 10px; }
  .tabs { width: 100%; order: 3; }
  .topbar .spacer { display: none; }
  .wk-row { grid-template-columns: 52px 1fr; }
  .week-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .week-grid { min-width: 640px; }
  .linkbox { flex-wrap: wrap; }
  #custom-wrap { margin-top: 12px; }
}
@media (max-width: 400px) {
  .hero h1 { font-size: 20px; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}
.mt { margin-top: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }

/* ---------- 新增：品牌预览 / 弹窗栅格 ---------- */
.brand-preview { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.brand-preview h4 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.brand-preview .sub { color: var(--ink-2); margin: 0 0 8px; font-size: 14px; }
.brand-preview .intro { color: var(--muted); font-size: 13px; white-space: pre-wrap; margin: 0 0 8px; }
.brand-preview .meta { font-size: 12.5px; color: var(--ink-2); }
.bm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 680px) { .bm-grid { grid-template-columns: 1fr; } }

/* ---------- 新增：月历概览 ---------- */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.mv-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.mc { aspect-ratio: 1/1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.mc.blank { visibility: hidden; }
.mc:hover { border-color: var(--accent); }
.mc.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.mc .mc-n { font-size: 14px; }
.mc .mc-c { position: absolute; top: 3px; right: 6px; font-size: 11px; color: var(--accent-ink); font-weight: 600; }

/* ---------- 新增：搜索 / 提示条 ---------- */
#bk-search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; }
#bk-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92, 127, 107, .12); }
#refresh-banner { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

