/* ===== 门店预约管理工作台 - 设计系统（主色 Indigo #6366f1） ===== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #eef2ff;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页 ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
  padding: 20px;
}
.login-card {
  width: 380px; max-width: 100%; background: #fff; border-radius: 16px;
  padding: 36px 32px; box-shadow: 0 20px 50px rgba(30, 27, 75, .35); text-align: center;
}
.login-logo { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  object-fit: cover; display: block;
  box-shadow: 0 8px 20px rgba(99, 102, 241, .4); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.login-card input {
  width: 100%; padding: 11px 14px; margin-bottom: 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; transition: border .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-tip { color: var(--text-2); font-size: 12px; margin-top: 14px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40; transition: transform .25s ease;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; }
.logo-badge { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; display: block; }
.logo-name { color: #fff; font-weight: 600; font-size: 15px; }
.logo-sub { font-size: 11px; opacity: .7; }
.nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin-bottom: 2px;
  border-radius: 10px; color: var(--sidebar-text); font-size: 14px; cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left; transition: background .15s;
}
.nav-item:hover { background: rgba(99, 102, 241, .18); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, .45); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); }
.open-hours-label { font-size: 11px; opacity: .65; }
.open-hours { font-size: 13px; color: #fff; margin-top: 2px; }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 14px; position: sticky; top: 0; z-index: 30;
}
.topbar h2 { font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.link-btn { border: none; background: none; color: var(--text-2); font-size: 13px; text-decoration: underline; }
.link-btn:hover { color: var(--primary); }
.icon-btn { border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 34px; height: 34px;
  font-size: 16px; color: var(--text); }
.menu-btn { display: none; }
.page { padding: 22px; }

/* ---------- 通用按钮/卡片 ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 13px; transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.ic-indigo { background: var(--primary-light); color: var(--primary); }
.ic-green { background: #d1fae5; color: #059669; }
.ic-amber { background: #fef3c7; color: #d97706; }
.ic-blue { background: #dbeafe; color: #2563eb; }

/* ---------- 布局栅格 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3-1 { display: grid; grid-template-columns: 2.2fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } .grid-2, .grid-3-1 { grid-template-columns: 1fr; } }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid #f1f5f9; }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .time { font-weight: 600; width: 52px; }
.list-row .sub { font-size: 12px; color: var(--text-2); }
.chip-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-confirmed { background: #dbeafe; color: #1d4ed8; }
.badge-serving { background: #ede9fe; color: #6d28d9; }
.badge-completed { background: #d1fae5; color: #047857; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; text-decoration: line-through; }
.badge-no_show { background: #e2e8f0; color: #475569; }
.badge-void { background: #fecaca; color: #991b1b; }
.badge-dormant { background: #f1f5f9; color: #64748b; }
.badge-deleted { background: #fee2e2; color: #b91c1c; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px; margin-right: 4px; }
.tag-vip { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.tag-老客 { background: #dbeafe; color: #1d4ed8; }
.tag-ok { background: #d1fae5; color: #047857; }
.tag-product { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.unit { font-size: 12px; font-weight: 400; color: var(--text-2); margin-left: 2px; }

/* ---------- 工具栏/搜索 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.input, .select, .textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px;
  outline: none; background: #fff; transition: border .15s, box-shadow .15s; font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.textarea { resize: vertical; min-height: 64px; }
.search-box { position: relative; }
.search-box input { padding-left: 32px; width: 220px; }
.search-box::before { content: "🔍"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: .6; }

/* ---------- 筛选 chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff;
  font-size: 12px; color: var(--text-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 卡片网格 ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.item-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; transition: transform .12s, box-shadow .12s; }
.item-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15, 23, 42, .1); }
.item-card .price { font-size: 20px; font-weight: 700; color: #dc2626; display: flex; align-items: baseline; gap: 6px; }
.item-card .price .price-orig { font-size: 13px; font-weight: 400; color: var(--text-2); text-decoration: line-through; }
.item-card .name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.item-card .meta { font-size: 12px; color: var(--text-2); margin: 4px 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }

/* ---------- 时间轴 ---------- */
.timeline-wrap { overflow-x: auto; }
.timeline { position: relative; margin-top: 6px; background: repeating-linear-gradient(
  to bottom, #fff 0px, #fff 59px, #f8fafc 59px, #f8fafc 60px); border-radius: 10px; border: 1px solid var(--border); }
.timeline-ruler { position: absolute; left: 0; top: 0; bottom: 0; width: 46px; border-right: 1px solid var(--border); z-index: 2; }
.timeline-label { position: absolute; right: 6px; font-size: 10px; color: var(--text-2); transform: translateY(-50%); }
.timeline-lane { position: absolute; top: 0; bottom: 0; }
.timeline-block { position: absolute; border-radius: 8px; padding: 4px 8px; overflow: hidden; cursor: pointer;
  font-size: 12px; color: #fff; transition: filter .12s; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.timeline-block:hover { filter: brightness(1.08); }
.tl-pending { background: #f59e0b; }
.tl-confirmed { background: #3b82f6; }
.tl-serving { background: #8b5cf6; }
.tl-completed { background: #10b981; }
.tl-cancelled { background: #ef4444; text-decoration: line-through; opacity: .75; }
.tl-no_show { background: #94a3b8; }
.tl-void { background: #b91c1c; opacity: .85; }
.timeline-click { position: absolute; background: transparent; }
.tl-product { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; background: rgba(255,255,255,.28);
  font-size: 10px; line-height: 14px; vertical-align: 1px; }

/* ---------- 柱状图 ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 70%; max-width: 42px; background: linear-gradient(180deg, #818cf8, var(--primary)); border-radius: 6px 6px 0 0; min-height: 3px; position: relative; cursor: default; transition: opacity .15s; }
.bar:hover { opacity: .85; }
.bar-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.bar:hover .bar-tip { opacity: 1; }
.bar-label { font-size: 11px; color: var(--text-2); }

/* ---------- 进度条排行 ---------- */
.rank-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.rank-name { width: 80px; font-size: 13px; flex: none; }
.rank-bar-wrap { flex: 1; background: #eef2ff; border-radius: 999px; height: 10px; overflow: hidden; }
.rank-bar { height: 100%; background: linear-gradient(90deg, #818cf8, var(--primary)); border-radius: 999px; transition: width .4s; }
.rank-val { width: 92px; text-align: right; font-size: 12px; color: var(--text-2); flex: none; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s; }
.modal { background: #fff; border-radius: 14px; width: 520px; max-width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); animation: popIn .18s; }
.modal-lg { width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-2); line-height: 1; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.95); } }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.field .input, .field .select, .field .textarea { width: 100%; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check-item { display: inline-flex; align-items: center; gap: 5px; font-size: 13px;
  border: 1px solid var(--border); padding: 5px 10px; border-radius: 8px; cursor: pointer; user-select: none; }
.check-item.checked { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.hint { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .3); animation: slideIn .2s; max-width: 320px; }
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty .empty-icon { font-size: 40px; margin-bottom: 10px; }
.empty p { margin-bottom: 14px; }

/* ---------- 详情 ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.detail-item { background: #f8fafc; border-radius: 8px; padding: 10px 12px; }
.detail-item .k { font-size: 11px; color: var(--text-2); }
.detail-item .v { font-size: 14px; margin-top: 2px; }

/* ---------- 设置表单 ---------- */
.settings-block { margin-bottom: 26px; }
.settings-block h4 { font-size: 14px; margin-bottom: 12px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- 移动端 ---------- */
.sidebar-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 35; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .page { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .search-box input { width: 150px; }
}
