/* ==========================================================================
   山荷妆造馆 · 运营后台样式（对齐参考后台的 Ant Design 布局，品牌色为山荷酒红）
   ========================================================================== */
:root {
  --primary: #6e0b12;
  --primary-hover: #8a1a22;
  --primary-soft: #fdeceb;
  --primary-soft-strong: #f9dcd9;
  --text: #262626;
  --text-secondary: #595959;
  --text-muted: #8c8c8c;
  --text-faint: #bfbfbf;
  --line: #f0f0f0;
  --line-strong: #d9d9d9;
  --bg-layout: #f5f5f5;
  --bg-container: #ffffff;
  --bg-table-head: #fafafa;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1677ff;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .03);
  --sider-width: 200px;
  --header-height: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5715;
  color: var(--text);
  background: var(--bg-layout);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--info); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
img { display: block; max-width: 100%; }
::selection { background: var(--primary-soft-strong); }

/* ---------------- 登录页 ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, .10), transparent 60%),
    linear-gradient(160deg, #8d1219 0%, #6e0b12 45%, #4c070c 100%);
  padding: 24px;
}
.login-card {
  width: 400px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(30, 0, 0, .32);
  padding: 40px 40px 32px;
  text-align: center;
}
.login-brand img { width: 56px; height: 56px; border-radius: 12px; margin: 0 auto 14px; box-shadow: 0 6px 16px rgba(110, 11, 18, .22); }
.login-brand h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: 2px; color: var(--primary); }
.login-brand p { margin: 6px 0 26px; color: var(--text-muted); font-size: 13px; letter-spacing: 1px; }
.login-field { position: relative; margin-bottom: 16px; }
.login-field .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); display: flex; }
.login-field input {
  width: 100%; height: 40px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(110, 11, 18, .10); }
.login-field .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-faint); display: flex; padding: 4px; }
.login-submit {
  width: 100%; height: 40px; margin-top: 6px;
  border: 0; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  font-size: 15px; letter-spacing: 4px; font-weight: 600;
  transition: background .2s;
}
.login-submit:hover { background: var(--primary-hover); }
.login-error { min-height: 20px; margin-top: 10px; color: var(--danger); font-size: 13px; }

/* ---------------- 主框架 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sider {
  width: var(--sider-width);
  flex: 0 0 var(--sider-width);
  background: #fff;
  border-right: 1px solid var(--line);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform .2s ease;
}
.sider__logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.sider__logo img { width: 28px; height: 28px; border-radius: 6px; }
.sider__logo strong { font-size: 16px; font-weight: 700; letter-spacing: 1px; color: var(--primary); white-space: nowrap; }
.sider__menu { padding: 8px 0; overflow-y: auto; flex: 1; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  height: 44px; margin: 2px 6px; padding: 0 16px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  font-size: 14px; width: calc(100% - 12px); text-align: left;
  transition: background .18s, color .18s;
}
.menu-item svg { width: 16px; height: 16px; flex: 0 0 16px; }
.menu-item:hover { color: var(--primary); background: #fafafa; }
.menu-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

.main { flex: 1; margin-left: var(--sider-width); display: flex; flex-direction: column; min-width: 0; }
.header {
  height: var(--header-height);
  flex: 0 0 var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px 0 16px;
  position: sticky; top: 0; z-index: 15;
}
.header__collapse { border: 0; background: transparent; color: var(--text-secondary); padding: 8px; display: flex; border-radius: 6px; }
.header__collapse:hover { background: #f5f5f5; }
.header__spacer { flex: 1; }
.header__user { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); }
.header__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.header__avatar svg { width: 17px; height: 17px; }
.header__logout { border: 0; background: transparent; color: var(--text-muted); padding: 6px; border-radius: 6px; display: flex; }
.header__logout:hover { color: var(--primary); background: var(--primary-soft); }

.content { padding: 24px; flex: 1; min-width: 0; }
.page-card {
  background: var(--bg-container);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-height: calc(100vh - var(--header-height) - 48px);
}
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; color: var(--text); }
.page-head__spacer { flex: 1; }
.page-head__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-sub { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }

/* ---------------- 按钮 / 输入 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  font-size: 14px; line-height: 1; white-space: nowrap;
  transition: all .18s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn--danger { color: var(--danger); border-color: #ffccc7; }
.btn--danger:hover { background: #fff1f0; border-color: var(--danger); }
.btn--text { border-color: transparent; background: transparent; padding: 0 8px; color: var(--info); }
.btn--text:hover { color: var(--primary); background: var(--primary-soft); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.field {
  height: 34px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none; background: #fff; color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  min-width: 0;
}
.field:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(110, 11, 18, .08); }
.field::placeholder { color: var(--text-faint); }
textarea.field { height: auto; padding: 8px 11px; resize: vertical; line-height: 1.6; }
select.field { padding-right: 26px; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23bfbfbf' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
.checkline { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar .field { width: 180px; }
.toolbar .field--wide { width: 260px; }
.toolbar .date-range { display: flex; align-items: center; gap: 6px; }
.toolbar .date-range .field { width: 140px; }
.toolbar .grow { flex: 1; }

/* ---------------- 表格 ---------------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--bg-table-head);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 16px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
tbody tr:hover td { background: #fafafa; }
tbody tr:last-child td { border-bottom: 0; }
.cell-strong { font-weight: 500; color: var(--text); }
.cell-sub { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.cell-mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px; }
.cell-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.cell-actions .btn { height: 26px; padding: 0 6px; font-size: 13px; }
.table-empty { padding: 48px 0; text-align: center; color: var(--text-muted); }

.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: #f0f0f0; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: 0 0 28px; }
.user-cell { display: flex; align-items: center; gap: 8px; }
.cover-cell { width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: #f5f5f5; display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.cover-cell img { width: 100%; height: 100%; object-fit: cover; }

.tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 7px;
  border-radius: 4px; border: 1px solid transparent;
  font-size: 12px; line-height: 1; white-space: nowrap;
}
.tag--blue { color: var(--info); background: #e6f4ff; border-color: #91caff; }
.tag--green { color: #389e0d; background: #f6ffed; border-color: #b7eb8f; }
.tag--orange { color: #d46b08; background: #fff7e6; border-color: #ffd591; }
.tag--red { color: #cf1322; background: #fff1f0; border-color: #ffa39e; }
.tag--grey { color: #595959; background: #fafafa; border-color: #d9d9d9; }
.tag--purple { color: #722ed1; background: #f9f0ff; border-color: #d3adf7; }
.tag--gold { color: #d48806; background: #fffbe6; border-color: #ffe58f; }

.switch { width: 36px; height: 20px; border-radius: 10px; background: #bfbfbf; border: 0; position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.is-on { background: var(--primary); }
.switch.is-on::after { transform: translateX(16px); }
.quick-input { width: 64px; height: 28px; text-align: center; border: 1px solid var(--line-strong); border-radius: 4px; }

/* ---------------- 指标卡 / 图表 ---------------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fff; }
.metric-card__label { color: var(--text-muted); font-size: 14px; margin-bottom: 10px; }
.metric-card__value { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 500; color: var(--text); }
.metric-card__value svg { width: 17px; height: 17px; }
.metric-card__icon { display: inline-flex; }
.metric-card--blue .metric-card__value { color: var(--info); }
.metric-card--green .metric-card__value { color: var(--success); }
.metric-card--orange .metric-card__value { color: #fa8c16; }
.metric-card--red .metric-card__value { color: var(--primary); }
.metric-card__delta { font-size: 12px; color: var(--success); display: inline-flex; align-items: center; gap: 2px; }

.chart-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.card__head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card__title { font-size: 15px; font-weight: 600; }
.card__sub { color: var(--text-muted); font-size: 13px; }
.card__body { padding: 20px; }
.chart-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; margin-left: auto; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-dot--red { background: var(--primary); }
.legend-dot--orange { background: #fa8c16; }
.legend-dot--yellow { background: var(--warning); }
.legend-dot--blue { background: var(--info); }
.line-chart { width: 100%; height: 260px; }
.donut-wrap { display: flex; align-items: center; justify-content: center; height: 260px; }

/* 档期概览 */
.capacity-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.month-tabs { display: inline-flex; gap: 6px; }
.month-tab { height: 28px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--line-strong); background: #fff; color: var(--text-secondary); font-size: 13px; }
.month-tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.capacity-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 16px; }
.capacity-cell { border-radius: 6px; padding: 8px 6px; text-align: center; border: 1px solid var(--line); background: #fff; min-height: 60px; }
.capacity-cell__day { font-size: 13px; color: var(--text-secondary); }
.capacity-cell__meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.capacity-cell--full { background: #fff1f0; border-color: #ffccc7; }
.capacity-cell--full .capacity-cell__meta { color: #cf1322; }
.capacity-cell--tight { background: #fffbe6; border-color: #ffe58f; }
.capacity-cell--tight .capacity-cell__meta { color: #d48806; }
.capacity-cell--available { background: #f0f5ff; border-color: #adc6ff; }
.capacity-cell--available .capacity-cell__meta { color: var(--info); }

/* 排班日历 */
.schedule-day { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.schedule-day__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.schedule-day__date { font-weight: 600; }
.schedule-store { padding: 10px 0; border-top: 1px dashed var(--line); }
.schedule-store__head { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.schedule-slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.schedule-slot { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 132px; font-size: 12px; color: var(--text-secondary); }
.schedule-slot__head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.schedule-slot--full { border-color: #ffccc7; background: #fff1f0; }
.schedule-slot--tight { border-color: #ffe58f; background: #fffbe6; }
.schedule-slot--available { border-color: #d9d9d9; }
.schedule-booking { padding: 2px 0; color: var(--text-secondary); }
.schedule-empty { color: var(--text-faint); }

/* ---------------- 抽屉 / 弹窗 ---------------- */
.modal-layer { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 100; display: flex; justify-content: flex-end; }
.modal-layer--center { justify-content: center; align-items: flex-start; padding: 64px 24px; overflow-y: auto; }
.drawer { width: 620px; max-width: 100%; background: #fff; height: 100%; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0, 0, 0, .12); }
.drawer__head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer__title { font-size: 16px; font-weight: 600; flex: 1; }
.drawer__close { border: 0; background: transparent; color: var(--text-muted); padding: 4px; display: flex; border-radius: 4px; }
.drawer__close:hover { background: #f5f5f5; color: var(--text); }
.drawer__body { padding: 24px; overflow-y: auto; flex: 1; }
.drawer__footer { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal { width: 640px; max-width: 100%; background: #fff; border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.modal--wide { width: 820px; }
.modal__head { padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal__title { font-size: 16px; font-weight: 600; flex: 1; }
.modal__body { padding: 24px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal__footer { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.description-grid { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 16px; margin: 0 0 20px; }
.description-grid dt { color: var(--text-muted); }
.description-grid dd { margin: 0; color: var(--text); word-break: break-all; }
.section-title { font-size: 14px; font-weight: 600; margin: 22px 0 12px; padding-left: 9px; border-left: 3px solid var(--primary); line-height: 1.2; }
.finance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.finance-item { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.finance-item span { color: var(--text-muted); font-size: 12px; display: block; }
.finance-item strong { font-size: 16px; display: block; margin-top: 4px; }
.finance-item small { color: var(--text-faint); font-size: 12px; }
.timeline { border-left: 1px solid var(--line); margin-left: 6px; padding-left: 16px; }
.timeline__item { position: relative; padding-bottom: 14px; }
.timeline__item::before { content: ""; position: absolute; left: -21px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.timeline__item strong { font-size: 13px; }
.timeline__item span { color: var(--text-muted); font-size: 12px; margin-left: 8px; }
.timeline__item p { margin: 2px 0 0; color: var(--text-secondary); font-size: 13px; }

.action-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.action-group__label { color: var(--text-muted); font-size: 12px; margin-bottom: 10px; }
.action-group__buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-item--full { grid-column: 1 / -1; }
.form-label { color: var(--text); font-size: 14px; }
.form-label.required::before { content: "*"; color: #ff4d4f; margin-right: 4px; }
.form-hint { color: var(--text-muted); font-size: 12px; }
.input-group { display: flex; }
.input-group .field { flex: 1; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group__addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: #fafafa; color: var(--text-muted); font-size: 13px; }
.choice-list { display: flex; flex-wrap: wrap; gap: 10px; }
.channel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.channel-row .field { width: 220px; }
.icon-danger { border: 0; background: transparent; color: #ff7875; display: flex; padding: 4px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.upload-box { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text-muted); background: #fafafa; }
.upload-box:hover { border-color: var(--primary); color: var(--primary); }
.upload-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.media-item { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; height: 108px; background: #fafafa; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item__remove { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: flex; align-items: center; justify-content: center; }

/* ---------------- 提示 / 空态 ---------------- */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0, 0, 0, .12); border-radius: 6px; padding: 8px 14px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.toast--error svg { color: var(--danger); }
.toast--success svg { color: var(--success); }
.empty { padding: 48px 0; text-align: center; color: var(--text-muted); }
.loading { padding: 40px 0; text-align: center; color: var(--text-muted); }
.loading::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 8px; border: 2px solid var(--line-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sider { transform: translateX(-100%); }
  .sider.is-open { transform: none; }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .page-card { padding: 16px; }
  .metric-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}
