/* =====================================================================
 *  styles.css
 * ===================================================================== */

:root {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --line: #E6E9EF;
  --line-soft: #EFF1F5;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98A2B3;
  --ink-4: #C4CBD6;

  --brand: #16324F;
  --accent: #2563EB;
  --accent-soft: #EBF1FE;
  --ok: #0E9F6E;
  --warn: #D97706;
  --warn-soft: #FEF6E7;
  --danger: #DC2626;
  --danger-soft: #FDEDED;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --sh-sm: 0 1px 2px rgba(16,24,40,.05);
  --sh-md: 0 4px 12px rgba(16,24,40,.07), 0 1px 3px rgba(16,24,40,.04);
  --sh-lg: 0 16px 48px rgba(16,24,40,.14), 0 2px 8px rgba(16,24,40,.06);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 190px; }

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, #1E4A72, #16324F);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(22,50,79,.25);
}
.brand-mark svg { width: 19px; height: 19px; }

.brand-text h1 { font-size: 15px; font-weight: 650; letter-spacing: -.1px; }
.brand-text p { font-size: 11.5px; color: var(--ink-3); letter-spacing: .2px; }

.weeknav { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

.ghost-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
  white-space: nowrap;
}
.ghost-btn:hover { border-color: var(--ink-4); color: var(--ink); background: var(--surface-2); }
.ghost-btn.active { background: var(--accent-soft); border-color: #BFD4FB; color: var(--accent); font-weight: 550; }

.date-input {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  outline: none;
  width: 132px;
}
.date-input:focus { border-color: var(--accent); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* 只读模式的小标签：让人一眼知道「这里不能改」 */
.ro-chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--line-soft); color: var(--ink-2);
  font-size: 12px; font-weight: 600; letter-spacing: .3px; white-space: nowrap;
}

.viewtabs {
  display: flex;
  background: var(--line-soft);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.viewtabs button {
  height: 27px;
  padding: 0 13px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
  transition: all .15s;
}
.viewtabs button.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-sm);
}

.primary-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 1px 3px rgba(22,50,79,.28);
  transition: all .15s;
}
.primary-btn svg { width: 15px; height: 15px; }
.primary-btn:hover { background: #1E4A72; box-shadow: 0 3px 10px rgba(22,50,79,.28); }
.primary-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* ---------------- 统计条 ---------------- */
.statbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 22px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.stat { display: flex; align-items: baseline; gap: 7px; }
.stat .num { font-size: 19px; font-weight: 680; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.stat .lab { font-size: 12px; color: var(--ink-3); }
.stat.is-alert .num { color: var(--danger); }

.stat-sep { width: 1px; height: 22px; background: var(--line); }

.store-mix { display: flex; align-items: center; gap: 14px; }
.mix-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.mix-dot { width: 8px; height: 8px; border-radius: 2px; }
.mix-item b { font-variant-numeric: tabular-nums; font-weight: 620; }

/* ---------------- 过滤条 ---------------- */
.filterbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.chips { display: flex; gap: 7px; flex-wrap: wrap; }

.chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.chip:hover { border-color: var(--ink-4); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 550; }
.chip .swatch { width: 7px; height: 7px; border-radius: 50%; }
.chip.active .swatch { box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }

.filter-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  outline: none;
  cursor: pointer;
}
.select:focus { border-color: var(--accent); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.danger { background: var(--danger); }
.dot.warn { background: var(--warn); }

/* ---------------- 画布 ---------------- */
.canvas {
  flex: 1;
  overflow: auto;
  padding: 0 22px 40px;
  min-height: 0;
}
.view { min-width: 0; }

/* ---------------- 周历 ---------------- */
.cal {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.cal-head {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  z-index: 12;
}

.cal-head-gutter { border-right: 1px solid var(--line-soft); }

.cal-head-day {
  padding: 9px 8px 8px;
  text-align: center;
  border-right: 1px solid var(--line-soft);
  position: relative;
}
.cal-head-day:last-child { border-right: none; }
.cal-head-day .wd { font-size: 11.5px; color: var(--ink-3); letter-spacing: .3px; }
.cal-head-day .dt { font-size: 16px; font-weight: 660; color: var(--ink); letter-spacing: -.3px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.cal-head-day.is-today .wd { color: var(--accent); font-weight: 600; }
.cal-head-day.is-today .dt { color: var(--accent); }
.cal-head-day.is-today::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 22px; height: 2px; border-radius: 1px; background: var(--accent);
}
.cal-head-day .cnt {
  font-size: 10.5px; color: var(--ink-3); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.cal-head-day.is-weekend { background: var(--surface-2); }

.cal-body {
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: clip;
}

.cal-hours {
  position: relative;
  border-right: 1px solid var(--line-soft);
}
.hour-lab.is-first { transform: none; }
.hour-lab.is-last { transform: translateY(-100%); }

.hour-lab {
  position: absolute;
  right: 8px;
  font-size: 10.5px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
  letter-spacing: .2px;
}

.cal-col {
  position: relative;
  border-right: 1px solid var(--line-soft);
}
.cal-col:last-child { border-right: none; }
.cal-col.is-weekend { background: #FCFCFD; }

.hline {
  position: absolute; left: 0; right: 0;
  height: 1px; background: var(--line-soft);
}
.hline.half { background: #F7F8FA; }

.nowline {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--danger); z-index: 8; opacity: .55;
  border-radius: 1px;
}
.nowline::before {
  content: ''; position: absolute; left: -3px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}

/* 预约卡片 */
.bk {
  position: absolute;
  border-radius: 6px;
  padding: 4px 6px 4px 7px;
  font-size: 11.5px;
  line-height: 1.28;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 3px;
  transition: box-shadow .14s, transform .14s, z-index 0s;
  z-index: 2;
}
.bk:hover { box-shadow: var(--sh-md); z-index: 20; transform: translateY(-1px); }

.bk .bk-time {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.1px;
  display: flex; align-items: center; gap: 4px;
}
.bk .bk-dur { font-weight: 450; color: var(--ink-3); font-size: 10.5px; }
.bk .bk-main { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk .bk-main b { font-weight: 600; color: var(--ink); }
.bk .bk-store {
  font-size: 10px;
  margin-top: 1px;
  opacity: .85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.bk.tight { padding-top: 2px; padding-bottom: 2px; }
.bk.tight .bk-main, .bk.tight .bk-store { display: none; }

.bk.is-conflict {
  border-color: var(--danger);
  background: var(--danger-soft);
  box-shadow: 0 0 0 1.5px rgba(220,38,38,.14);
}
.bk.is-warn {
  border-color: var(--warn);
  background: var(--warn-soft);
}
.bk.is-cancelled { opacity: .45; text-decoration: line-through; }

.bk-badge {
  position: absolute; top: 2px; right: 3px;
  font-size: 9px; font-weight: 700;
  color: #fff; background: var(--danger);
  width: 13px; height: 13px; border-radius: 50%;
  display: grid; place-items: center;
  line-height: 1;
}

/* ---------------- 矩阵（理疗师 / 门店） ---------------- */
.matrix-wrap {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

table.matrix { width: 100%; border-collapse: separate; border-spacing: 0; }

table.matrix thead th {
  position: sticky; top: 0; z-index: 6;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  text-align: left;
  white-space: nowrap;
}
table.matrix thead th .dt { display: block; font-size: 15px; font-weight: 660; color: var(--ink); letter-spacing: -.3px; margin-top: 1px; font-variant-numeric: tabular-nums; }
table.matrix thead th.is-today { color: var(--accent); }
table.matrix thead th.is-today .dt { color: var(--accent); }

table.matrix thead th:first-child {
  left: 0; z-index: 8;
  border-right: 1px solid var(--line);
  min-width: 132px;
  background: var(--surface);
}

table.matrix tbody td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  padding: 7px 8px;
  vertical-align: top;
  min-width: 132px;
}
table.matrix tbody td:last-child { border-right: none; }
table.matrix tbody tr:last-child td { border-bottom: none; }

table.matrix tbody td.who {
  position: sticky; left: 0; z-index: 5;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-width: 132px;
}
table.matrix tbody tr:hover td.who { background: var(--surface-2); }
table.matrix tbody tr:hover td { background: #FCFDFE; }

.who-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.who-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 5px; flex-wrap: wrap; }
.who-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }

.cell-empty { color: var(--ink-4); font-size: 11px; padding: 2px 0; }

.slot {
  display: block;
  border-radius: 5px;
  padding: 3px 6px;
  margin-bottom: 3px;
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-left: 2.5px solid var(--ink-4);
  cursor: pointer;
  transition: all .13s;
}
.slot:hover { background: #fff; box-shadow: var(--sh-sm); }
.slot:last-child { margin-bottom: 0; }
.slot .sl-top { display: flex; align-items: center; gap: 5px; }
.slot .sl-time { font-weight: 650; font-variant-numeric: tabular-nums; }
.slot .sl-dur { color: var(--ink-3); font-size: 10px; }
.slot .sl-body { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .sl-store { font-size: 10px; color: var(--ink-3); }
.slot.is-conflict { background: var(--danger-soft); border-color: #F5C2C2; border-left-color: var(--danger); }
.slot.is-warn { background: var(--warn-soft); border-color: #F3DDB0; border-left-color: var(--warn); }
.slot.is-cancelled { opacity: .45; text-decoration: line-through; }

.row-sum { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }

/* ---------------- 抽屉 ---------------- */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 468px;
  background: var(--surface);
  box-shadow: var(--sh-lg);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform .26s cubic-bezier(.22,.68,.32,1);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.drawer-head p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

.raw-input {
  width: 100%;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.72;
  resize: vertical;
  outline: none;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.raw-input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.08); }
.raw-input::placeholder { color: var(--ink-4); }

.hint-row { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 14px; gap: 10px; }
.hint { font-size: 11px; color: var(--ink-3); line-height: 1.5; }

.link-btn { font-size: 12px; color: var(--accent); font-weight: 500; padding: 2px 0; white-space: nowrap; }
.link-btn:hover { text-decoration: underline; }

.parse-summary {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 12px;
}
.parse-summary .ok { color: var(--ok); font-weight: 600; }
.parse-summary .bad { color: var(--danger); font-weight: 600; }
.parse-summary .warn { color: var(--warn); font-weight: 600; }

.parsed-list { display: flex; flex-direction: column; gap: 10px; }

.pcard {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.pcard:hover { box-shadow: var(--sh-sm); }
.pcard.bad { border-color: #F0C2C2; background: #FFFCFC; }
.pcard.warn { border-color: #F0DDB4; background: #FFFDF8; }

.pcard-raw {
  padding: 7px 11px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pcard-raw b { color: var(--ink-2); font-weight: 500; }

.pcard-body { padding: 10px 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 9px; }
.pcard-body .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 10.5px; color: var(--ink-3); letter-spacing: .2px; }
.field select, .field input {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 7px;
  font-size: 12.5px;
  background: var(--surface);
  outline: none;
  width: 100%;
  min-width: 0;
}
.field select:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.09); }
.field.miss select, .field.miss input { border-color: #E9A8A8; background: #FFF8F8; }

.pnote { margin-top: 7px; display: flex; align-items: center; gap: 6px; font-size: 11px; }
.pnote.err { color: var(--danger); }
.pnote.warn { color: var(--warn); }
.pnote.ok { color: var(--ok); }

.pcard-act { padding: 0 11px 10px; display: flex; justify-content: flex-end; }
.mini-btn { font-size: 11px; color: var(--ink-3); }
.mini-btn:hover { color: var(--danger); }

.drawer-foot {
  display: flex; gap: 10px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.grow { flex: 1; justify-content: center; }

.scrim {
  position: fixed; inset: 0;
  background: rgba(16,24,40,.32);
  z-index: 55;
  backdrop-filter: blur(1px);
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(16,24,40,.4);
  z-index: 70;
  display: grid; place-items: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  display: flex; flex-direction: column;
  animation: pop .22s cubic-bezier(.2,.9,.3,1);
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px) } to { opacity: 1; transform: none } }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 16px; font-weight: 650; }
.modal-head p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.modal-body { padding: 16px 20px 22px; overflow-y: auto; }

.cfg-section { margin-bottom: 22px; }
.cfg-section:last-child { margin-bottom: 0; }
.cfg-section h3 {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  letter-spacing: .3px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 7px;
}
.cfg-section h3 small { font-weight: 400; color: var(--ink-4); font-size: 11px; }

.cfg-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }

.cfg-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.cfg-row input[type=text] {
  height: 27px; border: 1px solid transparent; border-radius: 4px;
  padding: 0 6px; font-size: 12.5px; background: transparent; outline: none;
  flex: 1; min-width: 0;
}
.cfg-row input[type=text]:hover { background: #fff; border-color: var(--line); }
.cfg-row input[type=text]:focus { background: #fff; border-color: var(--accent); }
.cfg-row input[type=color] {
  width: 26px; height: 26px; padding: 0; border: none; border-radius: 5px;
  background: none; cursor: pointer; flex-shrink: 0;
}
.cfg-row input[type=number] {
  width: 56px; height: 27px; border: 1px solid var(--line); border-radius: 4px;
  padding: 0 6px; font-size: 12px; text-align: center; outline: none;
  background: #fff; flex-shrink: 0;
}
.cfg-stores-check { display: flex; gap: 4px; flex-wrap: wrap; }
.cfg-stores-check label {
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  border: 1px solid var(--line); cursor: pointer;
  color: var(--ink-3); background: #fff; user-select: none;
  transition: all .13s;
}
.cfg-stores-check input { display: none; }
.cfg-stores-check input:checked + span { color: #fff; }
.cfg-stores-check label:has(input:checked) { border-color: transparent; font-weight: 550; }

.cfg-del { color: var(--ink-4); font-size: 15px; line-height: 1; padding: 2px 4px; flex-shrink: 0; }
.cfg-del:hover { color: var(--danger); }

.cfg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-text { color: var(--danger); border-color: #F3D0D0; }
.danger-text:hover { background: var(--danger-soft); border-color: #E9A8A8; color: var(--danger); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: var(--sh-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .24s cubic-bezier(.2,.9,.3,1);
  z-index: 90;
  display: flex; align-items: center; gap: 8px;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
.toast.ok { background: #0B7A57; }

/* ---------------- 群播报卡片 ---------------- */
.broadcast {
  position: fixed; inset: 0;
  background: rgba(16,24,40,.4);
  z-index: 70;
  display: grid; place-items: center;
  padding: 24px;
}
.bc-card {
  background: #fff; border-radius: 14px; width: 100%; max-width: 430px;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: var(--sh-lg);
}
.bc-body {
  padding: 18px 20px; overflow-y: auto;
  font-size: 13.5px; line-height: 1.85; white-space: pre-wrap;
  font-family: var(--font);
  color: var(--ink);
}
.bc-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D8DDE5; border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #C0C7D2; }
.drawer-body::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { border-color: #fff; }

@media (max-width: 1180px) {
  .statbar { gap: 18px; padding: 0 16px; }
  .store-mix { display: none; }
  .topbar { gap: 14px; }
}
@media (max-width: 900px) {
  .drawer { width: 100%; }
  .cal-head, .cal-body { grid-template-columns: 46px repeat(7, minmax(78px, 1fr)); }
  .canvas { padding: 0 0 24px; }
  .cal, .matrix-wrap { margin-top: 0; border-radius: 0; border-left: none; border-right: none; }
}

/* ---------------- 预约详情气泡 ---------------- */
.detail-pop {
  position: fixed;
  z-index: 80;
  width: 268px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: pop .16s cubic-bezier(.2,.9,.3,1);
}

.dp-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.dp-time { font-size: 15px; font-weight: 680; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.dp-date { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.dp-rows { padding: 8px 12px; }
.dp-rows > div {
  display: flex; gap: 10px;
  font-size: 12.5px;
  padding: 3px 0;
}
.dp-rows > div > span { color: var(--ink-3); width: 44px; flex-shrink: 0; }
.dp-rows > div > b { font-weight: 550; color: var(--ink); word-break: break-all; }
.dp-raw > b { color: var(--ink-3); font-weight: 400; font-size: 11.5px; }

.dp-alert {
  margin: 2px 12px 10px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.55;
}
.dp-alert.err { background: var(--danger-soft); color: #9B1C1C; }
.dp-alert.warn { background: var(--warn-soft); color: #92400E; }
.dp-alert b { font-weight: 650; }

.dp-foot {
  display: flex; justify-content: flex-end; gap: 14px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line-soft);
}
.mini-link { font-size: 11.5px; color: var(--ink-3); }
.mini-link:hover { color: var(--ink); }
.mini-link.danger-text:hover { color: var(--danger); }

/* ---------------- 导出菜单 ---------------- */
.mini-menu {
  position: fixed;
  z-index: 85;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--sh-lg);
  padding: 4px;
  min-width: 168px;
  animation: pop .14s cubic-bezier(.2,.9,.3,1);
}
.mini-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 11px; border-radius: 6px;
  font-size: 12.5px; color: var(--ink-2);
}
.mini-menu button:hover { background: var(--line-soft); color: var(--ink); }

/* 同步状态徽标 */
.sync-badge {
  font-size: 11px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px 9px;
  white-space: nowrap;
}
.sync-badge.on { color: #0B7A57; border-color: #BFE6D6; background: #F1FAF6; }

/* 录入台：时长与多人标记 */
.multi-tag {
  font-style: normal; font-size: 9.5px; font-weight: 600;
  color: #7A4B12; background: #FBEED8; border-radius: 4px;
  padding: 1px 5px; margin-left: 5px;
}
.pkg {
  font-size: 10.5px; color: var(--ink-3);
  background: var(--line-soft); border-radius: 4px;
  padding: 1px 5px; margin-left: 5px;
}

/* =====================================================================
 * 搜索框
 * ===================================================================== */
.search-input {
  height: 32px;
  width: 186px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 10px 0 27px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398A2B3' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") no-repeat 9px center;
  background-size: 13px 13px;
  transition: border-color .15s, width .16s;
  -webkit-appearance: none;
  appearance: none;
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-input::placeholder { color: var(--ink-4); }
.search-input:focus { border-color: var(--accent); width: 220px; }

/* 按钮文字永不拆行（中间宽度下曾被挤成竖排） */
.viewtabs button, .primary-btn, .ghost-btn, .chip, .icon-btn { white-space: nowrap; }

/* =====================================================================
 * 中等宽度（≤1024px）：顶栏拆两行，别把标签挤成竖排
 * ===================================================================== */
@media (max-width: 1024px) {
  .topbar {
    flex-wrap: wrap;
    height: auto;
    gap: 9px 12px;
    padding: 10px 16px;
  }
  .brand { order: 1; }
  .topbar-right { order: 2; margin-left: auto; gap: 8px; }
  .weeknav { order: 3; flex: 1 1 100%; }
  .weeknav .date-input { flex: 1; width: auto; min-width: 120px; }

  .filterbar { flex-wrap: wrap; gap: 8px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
}

/* =====================================================================
 * 手机端：按天列表
 * ===================================================================== */
.mweek { padding: 0 0 28px; }

.mstrip {
  display: flex;
  gap: 4px;
  padding: 9px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 20;
}
.mstrip::-webkit-scrollbar { display: none; }

.mday {
  flex: 1 0 auto;
  min-width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 3px 4px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.mday-wd { font-size: 10.5px; color: var(--ink-3); line-height: 1.35; }
.mday-dt {
  font-size: 16px; font-weight: 680; line-height: 1.2;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.3px;
}
.mday-n { font-size: 9.5px; line-height: 12px; height: 12px; color: var(--ink-4); }
.mday.is-today .mday-wd { color: var(--accent); font-weight: 600; }
.mday.active { background: var(--ink); }
.mday.active .mday-wd,
.mday.active .mday-dt { color: #fff; }
.mday.active .mday-n { color: rgba(255,255,255,.7); }

.msum { padding: 12px 16px 8px; font-size: 12.5px; color: var(--ink-3); }
.msum b { color: var(--ink); font-weight: 650; }

.mlist { padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }

.mrow {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 11px 13px 11px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mrow::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--sc, var(--ink-4));
}
.mrow:active { background: var(--surface-2); }
.mrow.is-cancelled { opacity: .48; }

.mtime {
  width: 48px; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mtime b { font-size: 15px; font-weight: 680; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.mtime span { font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }

.mmain { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.mwho {
  font-size: 14.5px; font-weight: 640; line-height: 1.3;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.msvc { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.msub {
  font-size: 12px; color: var(--ink-3); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mflag {
  font-size: 10.5px; font-weight: 600; color: #fff;
  background: var(--danger); border-radius: 4px; padding: 1px 5px;
  line-height: 1.5;
}
.mflag.warn { background: var(--warn); }

/* 状态标签：已过 / 进行中 / 待做（手机端卡片与桌面端表格共用） */
.st-tag {
  font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px;
  white-space: nowrap; line-height: 1.6;
}
.st-tag.past  { color: var(--ink-3); background: var(--surface-2); }
.st-tag.doing { color: var(--ok); background: #E8F7F1; }
.st-tag.todo  { color: var(--accent); background: var(--accent-soft); }

.mempty { text-align: center; padding: 64px 24px; }
.mempty-t { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.mempty-s { font-size: 12px; color: var(--ink-3); margin-top: 7px; line-height: 1.65; }

.mhint { font-size: 11.5px; color: var(--ink-3); padding: 9px 16px 7px; }

/* =====================================================================
 * 桌面端：明细表格（view=list）
 * ===================================================================== */
.dtable-wrap { padding: 4px 16px 8px; }

.dtable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.dtable thead th {
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.dtable tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.dtable tbody tr:last-child td { border-bottom: none; }

.dtable tbody tr.drow { cursor: pointer; transition: background .12s; }
.dtable tbody tr.drow:hover { background: var(--surface-2); }

.st-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

.c-time b {
  font-size: 14px; font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}
.c-time span { font-size: 11px; color: var(--ink-3); margin-left: 6px; }

/* 列宽 */
.dtable .c-time  { width: 96px; white-space: nowrap; }
.dtable .c-store { width: 110px; white-space: nowrap; }
.dtable .c-who   { width: 90px; white-space: nowrap; }
.dtable .c-state { width: 86px; text-align: right; }
.dtable .c-note  { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 已过时间的行：整体淡一点，但完整可见、绝不隐藏 */
.dtable tbody tr.st-past td { color: var(--ink-3); }
.dtable tbody tr.st-past .c-time b { color: var(--ink-2); }
.dtable tbody tr.st-past .c-who,
.dtable tbody tr.st-past .c-svc { color: var(--ink-3); }
.dtable tbody tr.st-past .c-patient,
.dtable tbody tr.st-past .c-note { color: var(--ink-4); }

/* 进行中的行：轻微高亮，方便一眼看到正在做的那单 */
.dtable tbody tr.st-doing { background: #F3FBF7; }

/* 取消的预约 */
.dtable tbody tr.is-cancelled { opacity: .48; }

/* 手机端详情做成底部卡片 */
.detail-pop.is-sheet {
  left: 10px; right: 10px; bottom: 10px; top: auto;
  width: auto;
  max-height: 78vh;
  overflow-y: auto;
  border-radius: var(--r-lg);
  box-shadow: 0 -8px 40px rgba(16,24,40,.20), 0 2px 8px rgba(16,24,40,.08);
  animation: sheetUp .2s cubic-bezier(.2,.9,.3,1);
}
@keyframes sheetUp {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* =====================================================================
 * 窄屏（≤760px）：顶栏两行、统计条横滑、周历换按天列表
 * ===================================================================== */
@media (max-width: 760px) {
  html, body { height: auto; }
  /* 手机端整页纵向滚动：桌面端的 body{overflow:hidden} 会传播到 viewport，
     把整页滚动锁死，导致手机上拉不动。这里脱离 flex 锁死布局，恢复文档流。 */
  body {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 10px 14px;
    height: auto;
  }
  .brand { order: 1; gap: 8px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-mark svg { width: 16px; height: 16px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text p { font-size: 11px; margin-top: 1px; }
  .topbar-right { order: 2; margin-left: auto; gap: 6px; }
  .weeknav { order: 3; width: 100%; gap: 6px; }
  .weeknav .date-input { flex: 1; width: auto; min-width: 0; height: 31px; }
  .viewtabs { padding: 2px; }
  .viewtabs button { height: 26px; padding: 0 9px; font-size: 12px; }
  .primary-btn { height: 31px; padding: 0 11px; font-size: 12.5px; }
  .icon-btn { width: 31px; height: 31px; }

  /* 统计条：横向滚动，绝不让文字逐字竖排 */
  .statbar {
    height: auto;
    gap: 15px;
    padding: 9px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .statbar::-webkit-scrollbar { display: none; }
  .stat { flex: 0 0 auto; white-space: nowrap; gap: 5px; }
  .stat .num { font-size: 16px; }
  .stat .lab { font-size: 11.5px; }
  .stat-sep { flex: 0 0 auto; height: 15px; }
  .store-mix { display: none; }

  /* 筛选：chips 横滑，右侧控件换行 */
  .filterbar { flex-wrap: wrap; gap: 8px; padding: 9px 14px; }
  .chips {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  .filter-right {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-right::-webkit-scrollbar { display: none; }
  .filter-right > * { flex: 0 0 auto; }
  .search-input { width: 178px; }
  .search-input:focus { width: 200px; }

  .canvas {
    flex: none;
    overflow: visible;
    padding: 0 0 28px;
  }
  .cal, .matrix-wrap {
    margin-top: 0; border-radius: 0;
    border-left: none; border-right: none;
  }
  .matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .matrix { min-width: 640px; }

  .drawer { width: 100%; }
}
