/* ============ 基础 ============ */
:root {
  --primary: #3056d3;
  --primary-dark: #264fbe;
  --primary-soft: #eef2fd;
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e7eaf1;
  --line-strong: #d8dde8;
  --text: #20242c;
  --muted: #8a93a5;
  --ok: #178b4e;         --ok-bg: #e6f6ec;
  --warn: #c77700;       --warn-bg: #fdf3e2;
  --bad: #d23c3c;        --bad-bg: #fdeaea;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(23, 36, 66, .04), 0 4px 16px rgba(23, 36, 66, .05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 2px solid rgba(48, 86, 211, .55); outline-offset: 2px; border-radius: 6px; }

/* ============ 布局 ============ */
.page { max-width: 640px; margin: 0 auto; padding: 18px 16px 72px; }
.staff-page { max-width: 1020px; margin: 0 auto; padding: 18px 16px 72px; }
.admin-page { max-width: 1200px; margin: 0 auto; padding: 18px 16px 72px; }
@media (min-width: 768px) {
  .page { max-width: 760px; padding: 28px 24px 80px; }
  .staff-page { padding: 24px 28px 80px; }
  .admin-page { padding: 24px 28px 80px; }
}

/* ============ 顶栏 ============ */
.topbar {
  background: linear-gradient(135deg, #2c51c4 0%, #3f6ce0 62%, #5b85ec 100%);
  color: #fff; padding: 22px 20px 20px; border-radius: 0 0 22px 22px;
  margin-bottom: 18px; box-shadow: var(--shadow);
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 600; letter-spacing: .5px; }
.topbar .sub { font-size: 12.5px; opacity: .88; margin-top: 5px; }
@media (min-width: 768px) {
  .topbar { padding: 28px 32px 26px; border-radius: 0 0 28px 28px; }
  .topbar h1 { font-size: 22px; }
}

/* ============ 卡片 ============ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; margin: 0 0 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
@media (min-width: 768px) { .card { padding: 22px 24px; } }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.muted { color: var(--muted); }
.mt { margin-top: 12px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }

/* 步骤徽标 */
.card h2 .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700;
}

/* ============ 表单 ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field label .req { color: var(--bad); margin-left: 2px; }
input[type=text], input[type=password], input[type=tel], select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; background: #fbfcfe; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(48, 86, 211, .13);
}
input::placeholder { color: #aab3c4; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a93a5' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span2 { grid-column: 1 / -1; }
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 22px; border: none; border-radius: var(--radius-sm); font-size: 15px;
  font-family: inherit; font-weight: 500;
  background: var(--primary); color: #fff; cursor: pointer; user-select: none;
  transition: transform .12s, box-shadow .15s, background .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
.btn.ghost:hover { background: #e2e9fb; }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.danger:hover { background: #fbdddc; }
.btn.ok { background: var(--ok-bg); color: var(--ok); }
.btn.ok:hover { background: #d8f0e2; }
.btn:disabled { background: #e6e9f0; color: #a5adc0; cursor: not-allowed; transform: none; box-shadow: none; }

/* ============ 日期卡 ============ */
.date-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.date-card {
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 13px 12px; cursor: pointer;
  background: #fff; text-align: center; transition: border-color .15s, background .15s, box-shadow .15s;
}
.date-card:hover { border-color: #b9c6ea; }
.date-card.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(48,86,211,.12); }
.date-card.full { opacity: .55; cursor: not-allowed; }
.date-card .d1 { font-size: 15px; font-weight: 600; }
.date-card .d2 { font-size: 12px; color: var(--muted); margin-top: 1px; }
.date-card .d3 { font-size: 12.5px; margin-top: 7px; font-weight: 600; }
.date-card .d3.ok { color: var(--ok); }
.date-card .d3.bad { color: var(--bad); }

/* ============ 时段卡（上午/下午） ============ */
.slot-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .slot-grid { grid-template-columns: 1fr 1fr; } }
.slot-cell {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 14px 16px;
  cursor: pointer; background: #fff; transition: border-color .15s, background .15s, box-shadow .15s;
}
.slot-cell:hover { border-color: #b9c6ea; }
.slot-cell.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(48,86,211,.12); }
.slot-cell.off { opacity: .55; cursor: not-allowed; }
.slot-cell .icon {
  width: 42px; height: 42px; border-radius: 50%; flex: none; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  background: var(--warn-bg);
}
.slot-cell.pm .icon { background: var(--primary-soft); }
.slot-cell .body { flex: 1; min-width: 0; }
.slot-cell .t { font-size: 15.5px; font-weight: 600; }
.slot-cell .r { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.slot-cell .r.full { color: var(--bad); font-weight: 600; }
.slot-cell .bar { height: 5px; border-radius: 99px; background: #edf0f6; margin-top: 8px; overflow: hidden; }
.slot-cell .bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .3s; }
.slot-cell .bar i.low { background: var(--warn); }
.slot-cell .bar i.zero { background: var(--bad); }

/* ============ 状态徽章 ============ */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.chip.booked { background: var(--primary-soft); color: var(--primary); }
.chip.checked_in { background: var(--warn-bg); color: var(--warn); }
.chip.finished { background: var(--ok-bg); color: var(--ok); }
.chip.no_show { background: var(--bad-bg); color: var(--bad); }
.chip.cancelled { background: #eef0f4; color: #6b7484; }

/* ============ 提示条 ============ */
.banner { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; margin-bottom: 14px; display: none; border: 1px solid transparent; }
.banner.show { display: block; }
.banner.err { background: var(--bad-bg); color: #8f2323; border-color: #f5caca; }
.banner.ok { background: var(--ok-bg); color: #14653b; border-color: #c5e8d3; }
.banner.warn { background: var(--warn-bg); color: #8a5600; border-color: #f3ddad; }

/* ============ 凭证 ============ */
.ticket-hero {
  background: linear-gradient(160deg, var(--primary-soft), #f6f8ff);
  border: 1px solid #dfe6f8; border-radius: var(--radius-sm);
  padding: 18px 16px 20px; text-align: center;
}
.ticket-no { font-size: 34px; font-weight: 700; letter-spacing: 3px; color: var(--primary); margin: 4px 0 2px; }
.ticket-hero .cap { font-size: 12px; color: var(--muted); letter-spacing: 4px; }
.ticket-cut { border-top: 2px dashed var(--line-strong); margin: 16px -16px 0; position: relative; }
.ticket-cut::before, .ticket-cut::after {
  content: ""; position: absolute; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg);
}
.ticket-cut::before { left: -9px; } .ticket-cut::after { right: -9px; }
.ticket-qr { display: flex; justify-content: center; padding: 18px 0 4px; }
.ticket-qr svg { border-radius: 10px; background: #fff; padding: 6px; border: 1px solid var(--line); }
.ticket-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 13.5px; }
.ticket-meta .k { color: var(--muted); font-size: 12px; }

/* ============ 工作台 ============ */
.staff-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.staff-head h1 { font-size: 19px; margin: 0; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.stat-box .n { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-box .l { font-size: 12px; color: var(--muted); margin-top: 1px; }
.call-banner {
  background: linear-gradient(135deg, #14683c, #1b8a52); color: #fff; border-radius: var(--radius);
  padding: 20px 22px; display: flex; align-items: center; gap: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.call-banner .no { font-size: clamp(38px, 8vw, 56px); font-weight: 800; letter-spacing: 2px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.call-banner .info { font-size: 13px; opacity: .95; line-height: 1.7; }
.slot-group { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.slot-group .gh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.slot-group .gh .t { font-weight: 700; font-size: 15px; }
.bk-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.bk-row:first-of-type { border-top: none; }
.bk-row .no { font-weight: 700; min-width: 100px; color: var(--primary); font-variant-numeric: tabular-nums; }
.bk-row .nm { flex: 1; min-width: 120px; }
.bk-row .nm .sub { font-size: 12px; color: var(--muted); }
.bk-row .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.bk-row.current-row { background: #f0fbf4; border-radius: 10px; padding-left: 10px; padding-right: 10px; }

/* ============ 管理后台 ============ */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text);
  font-size: 13.5px; font-family: inherit; cursor: pointer; transition: all .15s;
}
.tabs button:hover { border-color: #b9c6ea; }
.tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-sm); overflow: hidden; font-size: 13px; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.grid th { background: #f7f9fc; font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .3px; }
table.grid tbody tr:hover { background: #fafbfd; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); box-shadow: var(--shadow); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; font-size: 13.5px; align-items: center; }
.kv .k { color: var(--muted); }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 4px; } }

/* ============ 弹窗 / Toast ============ */
.dialog-mask { position: fixed; inset: 0; background: rgba(15, 25, 50, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.dialog { background: #fff; border-radius: var(--radius); padding: 22px; max-width: 420px; width: 100%; box-shadow: 0 20px 60px rgba(15, 25, 50, .25); }
.dialog h3 { margin: 0 0 10px; font-size: 16px; }
.dialog p { font-size: 14px; color: var(--text); margin: 0 0 4px; }
.toast {
  position: fixed; left: 50%; top: 12%; transform: translateX(-50%); z-index: 99;
  background: rgba(23, 30, 46, .92); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px;
  max-width: 86vw; text-align: center; box-shadow: 0 8px 24px rgba(15, 25, 50, .25);
}

/* ============ 大屏 ============ */
.screen-body { background: radial-gradient(ellipse at top, #14315e, #0b1d3a 70%); color: #fff; min-height: 100vh; display: flex; flex-direction: column; padding: 28px 36px; }
.screen-now { font-size: 120px; font-weight: 800; text-align: center; margin: auto; letter-spacing: 6px; }
.screen-head { display: flex; justify-content: space-between; font-size: 20px; opacity: .9; }
