/* ============================================================
   预约管理后台样式（移动优先）
   ============================================================ */
:root {
  --red-900: #7a1420;
  --red-700: #a61b29;
  --red-600: #c0303d;
  --red-050: #fdf1f0;
  --gold-500: #c8a45c;
  --gold-300: #e3cfa0;
  --ink-900: #2b2320;
  --ink-700: #55483f;
  --ink-500: #8a7d72;
  --paper: #f6f2ec;
  --white: #fff;
  --border: #e8e0d5;
  --error: #c0392b;
  --ok: #1e7e4e;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(43,35,32,.10);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6;
  color: var(--ink-900); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }

.btn {
  border: 0; border-radius: 8px; padding: 10px 22px;
  font-size: 14px; font-weight: 600;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--red-700); color: #fff; }
.btn-primary:hover { background: var(--red-600); }
.btn-ghost-sm { background: #fff; color: var(--ink-700); border: 1px solid var(--border); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; color: #fff;
  font-size: 13px; text-decoration: underline; opacity: .85;
}
.btn-mini {
  border: 1px solid var(--border); background: #fff;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; color: var(--ink-700);
}
.btn-mini:hover { border-color: var(--red-600); color: var(--red-700); }
.btn-mini.danger:hover { border-color: var(--error); color: var(--error); }

/* ============ 登录 ============ */
.login-view {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 400px at 70% 0%, rgba(200,164,92,.28), transparent),
    linear-gradient(160deg, var(--red-900), var(--red-700));
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff; border-radius: 16px;
  padding: 36px 30px 26px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-mark {
  width: 56px; height: 56px; margin: 0 auto 12px;
  display: grid; place-items: center;
  background: var(--gold-500); color: var(--red-900);
  font-size: 26px; font-weight: 700; border-radius: 12px;
  font-family: serif;
}
.login-card h1 { font-size: 20px; letter-spacing: 2px; }
.login-sub { color: var(--ink-500); font-size: 13px; margin: 4px 0 22px; }
.login-field { text-align: left; margin-bottom: 14px; }
.login-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.login-field input {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; background: var(--paper);
}
.login-field input:focus { outline: 2px solid var(--gold-500); outline-offset: 1px; }
.login-error { color: var(--error); font-size: 13px; margin-bottom: 10px; }


/* ============ 主框架 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  background: var(--red-900); color: #fff;
  padding: 0 16px; height: 56px;
}
.side-toggle { background: none; border: 0; color: #fff; font-size: 20px; }
.topbar-title { font-weight: 700; letter-spacing: 1px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.user-badge {
  background: var(--gold-500); color: var(--red-900);
  font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px;
}

.app-body { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 200px; flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--border);
  padding: 14px 10px;
}
.sidebar.closed { display: none; }
.side-link {
  display: block; text-decoration: none;
  padding: 11px 14px; border-radius: 8px;
  font-size: 14px; color: var(--ink-700); margin-bottom: 4px;
}
.side-link:hover { background: var(--red-050); }
.side-link.active { background: var(--red-700); color: #fff; font-weight: 600; }

.content { flex: 1; padding: 22px 18px; min-width: 0; }
.view-title { font-size: 20px; margin-bottom: 18px; letter-spacing: 1px; }
.view-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.view-head .view-title { margin-bottom: 0; }

.panel {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.panel h3 { font-size: 15px; margin-bottom: 14px; color: var(--ink-900); }
.panel-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 0; }
.panel-grid .panel { margin-bottom: 18px; }

/* ============ 统计卡片 ============
   手机端 2 列；第二行（本月/累计）通栏
   桌面端 6 列网格：第 1-3 张各占 2 列（一行三个），第 4-5 张各占 3 列（一行两个） */
.stat-cards {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 18px;
}
.stat-card:nth-child(n+4) { grid-column: span 2; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
  border-top: 3px solid var(--red-700);
}
.stat-card strong { display: block; font-size: 26px; font-family: serif; color: var(--red-900); }
.stat-card span { font-size: 13px; color: var(--ink-500); }
.stat-card.gold { border-top-color: var(--gold-500); }

/* ============ 图表 ============ */
/* 趋势图：弹性撑满面板，纵轴自适应刻度，柱底与日期行贴面板底部 */
.trend-panel { display: flex; flex-direction: column; }
.trend-panel h3 { flex: 0 0 auto; }
#trendChart {
  flex: 1;
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: 1fr auto;
  column-gap: 8px; min-height: 230px;
}
.trend-y { position: relative; }
.trend-y span {
  position: absolute; right: 4px; transform: translateY(-50%);
  font-size: 11px; color: var(--ink-500); line-height: 1;
}
.trend-plot { position: relative; }
.trend-line {
  position: absolute; left: 0; right: 0; height: 1px;
  background: rgba(0, 0, 0, .08);
}
.trend-spacer { grid-column: 1; }
.trend-labels { grid-column: 2; display: flex; gap: 10px; margin-top: 6px; }
.trend-labels span {
  flex: 1; text-align: center; min-width: 0;
  font-size: 11px; color: var(--ink-500); white-space: nowrap;
}
.bar-chart {
  position: relative; display: flex; align-items: stretch; gap: 10px;
  height: 100%;
}
.bar-col { flex: 1; min-width: 0; }
.bar-area {
  position: relative; height: 100%; width: 100%; max-width: 42px;
  margin: 0 auto; display: flex; align-items: flex-end;
}
.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--red-600), var(--red-900));
  border-radius: 6px 6px 0 0;
  min-height: 3px; transition: height .4s ease;
}
/* 数字紧贴柱顶：bottom 由内联样式按柱高设置，随柱子高低浮动 */
.bar-val {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--ink-700); font-weight: 600;
  white-space: nowrap;
}
.bar-label { font-size: 11px; color: var(--ink-500); white-space: nowrap; }
.dist-chart { display: grid; gap: 14px; }
.dist-row { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; }
.dist-track { height: 12px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-500), var(--red-600)); }

/* 日期范围筛选 */
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range input[type="date"] { flex: 1; min-width: 0; }
.date-sep { color: var(--ink-500); font-size: 13px; }
.range-hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-500); }
.dist-num { text-align: right; color: var(--ink-700); font-weight: 600; }
.dist-title { font-size: 13px; font-weight: 700; color: var(--ink-700); margin: 6px 0 8px; }

/* ============ 筛选栏 ============ */
.filter-bar {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; align-items: start;
}
.filter-item { min-width: 0; }
.filter-item label {
  display: block; font-size: 12px; color: var(--ink-500); margin-bottom: 4px;
  line-height: 18px; height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filter-item input, .filter-item select {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--paper); font-family: inherit;
}
.filter-item button { height: 38px; }
.filter-grow { grid-column: span 2; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 840px; }
.data-table .col-time { white-space: nowrap; color: var(--ink-500); font-size: 12.5px; }
.data-table th, .data-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table th { color: var(--ink-500); font-weight: 600; font-size: 12.5px; background: var(--paper); }
.data-table tbody tr:hover { background: var(--red-050); }

.status-chip {
  display: inline-block; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.st-pending { background: #fff4e0; color: #b26a00; }
.st-confirmed { background: #e3f2fd; color: #1565c0; }
.st-visited { background: #e7f5ee; color: var(--ok); }
.st-cancelled { background: #f2f2f2; color: #999; }
.role-chip {
  display: inline-block; padding: 2px 10px; margin: 0 6px 0 4px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.role-admin { background: var(--red-050); color: var(--red-700); }
.role-staff { background: #e3f2fd; color: #1565c0; }
.role-viewer { background: #f2f2f2; color: #777; }

.op-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.pager {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 14px; font-size: 13px; color: var(--ink-500); flex-wrap: wrap; gap: 8px;
}
.pager-btns { display: flex; gap: 6px; }
.pager-btns button {
  border: 1px solid var(--border); background: #fff;
  border-radius: 6px; padding: 5px 12px; font-size: 13px;
}
.pager-btns button.current { background: var(--red-700); color: #fff; border-color: var(--red-700); }
.pager-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* ============ 弹窗 & 提示 ============ */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(20,10,10,.55); }
.modal-card {
  position: relative; width: 100%; max-width: 440px;
  background: #fff; border-radius: 14px; padding: 24px;
  box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 14px; font-size: 17px; }
.modal-card .form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-field input, .form-field select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--paper); font-family: inherit;
}
.detail-list { font-size: 14px; }
.detail-list div { display: flex; padding: 7px 0; border-bottom: 1px dashed var(--border); gap: 12px; }
.detail-list b { width: 76px; flex-shrink: 0; color: var(--ink-500); font-weight: 600; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--ink-900); color: #fff;
  padding: 10px 22px; border-radius: 999px;
  font-size: 14px; z-index: 300; box-shadow: var(--shadow);
}
.toast.err { background: var(--error); }

.empty-tip { text-align: center; color: var(--ink-500); padding: 30px 0; }

/* ============ 响应式 ============ */
@media (min-width: 768px) {
  .stat-cards { grid-template-columns: repeat(6, 1fr); }
  .stat-card:nth-child(-n+3) { grid-column: span 2; }
  .stat-card:nth-child(n+4) { grid-column: span 3; }
  .panel-grid { grid-template-columns: 3fr 2fr; }
  .filter-bar { grid-template-columns: repeat(3, 1fr); }
  .filter-grow { grid-column: span 1; }
  .side-toggle { display: none; }
  .sidebar.closed { display: block; }
}
@media (min-width: 1200px) {
  .filter-bar { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 767px) {
  .content { padding: 16px 12px; }
}
