/* ============================================================
   风起鸿艳 · 经营管理后台 — 样式
   设计 Token 与概念稿一致
   ============================================================ */
:root {
  --ink: #173b34;
  --ink-2: #285349;
  --paper: #f5f2eb;
  --cream: #fffdf9;
  --line: #dedbd2;
  --coral: #d86f4d;
  --coral-soft: #f6dfd5;
  --sage: #8aa396;
  --sage-soft: #dfe9e3;
  --text: #202924;
  --muted: #738078;
  --warn: #d49437;
  --danger: #c7564f;
  --white: #fff;
  --bg: #f4f5f2;
  --border: #e5e8e3;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ---------- 顶部栏 ---------- */
.admin-top {
  height: 62px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-brand strong { color: var(--ink); letter-spacing: .08em; font-weight: 500; font-size: 16px; }
.admin-brand span { margin-left: 9px; color: var(--muted); font-size: 12px; }
.admin-user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.admin-user .avatar-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sage), var(--coral));
  color: #fff; display: grid; place-items: center; font-size: 13px;
}

/* ---------- 布局 ---------- */
.admin-layout { display: grid; grid-template-columns: 200px 1fr; min-height: calc(100vh - 62px); }

.admin-side { background: var(--ink); color: #d7e1dc; padding: 16px 10px; }
.admin-side p { margin: 18px 10px 7px; font-size: 10px; letter-spacing: .16em; color: #7fa096; text-transform: uppercase; }
.admin-side a {
  display: flex; gap: 9px; align-items: center;
  width: 100%; border: 0; background: transparent; color: #d7e1dc;
  padding: 10px 12px; border-radius: 10px; text-align: left;
  font-size: 13px; text-decoration: none; cursor: pointer;
}
.admin-side a:hover { background: rgba(255,255,255,.06); }
.admin-side a.active { background: rgba(255,255,255,.12); color: #fff; }
.admin-side .ico { width: 16px; text-align: center; }

.admin-main { padding: 24px; min-width: 0; }

/* ---------- 面板 ---------- */
.panel { display: none; }
.panel.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-heading h2 { margin: 0; color: var(--ink); font-size: 22px; font-weight: 500; }
.admin-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.admin-primary {
  border: 0; border-radius: 10px; background: var(--ink); color: #fff;
  padding: 10px 16px; font-size: 13px;
}
.btn-ghost { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 10px; padding: 9px 14px; font-size: 13px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--white); border-radius: 16px; padding: 16px; border: 1px solid var(--border); }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin: 8px 0 4px; font-size: 26px; color: var(--ink); font-weight: 500; }
.kpi small { color: var(--sage); font-size: 11px; }
.kpi small.up { color: #3b8f5f; }
.kpi small.down { color: var(--danger); }

/* ---------- 网格与区块 ---------- */
.admin-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; margin-top: 12px; }
.admin-grid.equal { grid-template-columns: 1fr 1fr; }
.admin-section { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.admin-section h3 { margin: 0 0 14px; color: var(--ink); font-size: 14px; font-weight: 500; }

/* ---------- 房态 ---------- */
.room-board { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.room-cell { border-radius: 12px; padding: 12px; background: #f4f6f3; }
.room-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-cell strong { color: var(--ink); font-size: 12px; font-weight: 500; }
.room-cell p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }

/* ---------- 状态标签 ---------- */
.state { display: inline-block; font-size: 11px; padding: 4px 10px; border-radius: 999px; }
.state.free { color: #31644f; background: #dceadf; }
.state.busy { color: #963d38; background: #f4dddb; }
.state.clean { color: #8c641f; background: #f8eaca; }
.state.online { color: #31644f; background: #dceadf; }
.state.offline { color: #963d38; background: #f4dddb; }

/* ---------- 任务列表 ---------- */
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eceeeb; }
.task-row:last-child { border-bottom: 0; }
.task-dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--coral-soft); color: var(--coral); font-size: 14px; }
.task-row strong { display: block; font-size: 12px; font-weight: 500; color: var(--text); }
.task-row span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.task-row a { border: 0; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; text-decoration: none; }
.task-row .val { font-size: 13px; font-weight: 500; color: var(--ink); }

/* ---------- 图表 ---------- */
.chart { height: 130px; display: flex; align-items: flex-end; gap: 10px; padding-top: 14px; }
.bar { flex: 1; background: var(--sage-soft); border-radius: 5px 5px 0 0; min-width: 10px; position: relative; }
.bar.active { background: var(--coral); }
.bar span { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); font-size: 11px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { color: var(--muted); font-weight: 500; text-align: left; padding: 10px; border-bottom: 1px solid #e3e6e1; white-space: nowrap; }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid #eceeeb; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .prod-name { display: flex; align-items: center; gap: 10px; }
.admin-table .prod-thumb {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, #dbe8df, #f1dcd0); font-size: 16px; flex-shrink: 0;
}
.tbl-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tbl-actions button { border: 1px solid #dfe4df; color: var(--ink); background: #fff; padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 11px; }
.tbl-actions button.danger { color: var(--danger); border-color: #f0cdca; }

/* ---------- 筛选栏 ---------- */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar input, .filter-bar select {
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; font-size: 12px; color: var(--text); background: #fff;
}
.filter-bar .spacer { flex: 1; }
.tabs-inline { display: flex; gap: 4px; }
.tabs-inline button { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 999px; font-size: 12px; }
.tabs-inline button.active { background: var(--ink); color: #fff; }

/* ---------- 配置框 ---------- */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.config-box { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.config-box h3 { margin: 0 0 6px; color: var(--ink); font-size: 14px; font-weight: 500; }
.config-box .hint { color: var(--muted); font-size: 11px; margin: 0 0 14px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid #eceeeb; font-size: 12px; }
.field-row:last-child { border-bottom: 0; }
.field-row .f-label { color: var(--text); }
.field-row .f-val { color: var(--ink); font-weight: 500; }
.field-row input, .field-row select {
  width: 100px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; text-align: right; color: var(--text); font-size: 12px;
}
.field-row input.wide { width: 140px; text-align: left; }

/* ---------- 开关 ---------- */
.switch { width: 40px; height: 22px; border: 0; border-radius: 999px; background: var(--sage); position: relative; cursor: pointer; flex-shrink: 0; }
.switch::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: #fff; position: absolute; top: 3px; right: 3px; transition: all .18s; }
.switch.on { background: var(--ink); }
.switch.on::after { right: 21px; }

/* ---------- 关系链树 ---------- */
.tree { padding: 4px 0; }
.tree-node { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #f4f6f3; margin-bottom: 6px; }
.tree-node .level-tag { font-size: 10px; color: var(--muted); background: var(--sage-soft); padding: 2px 8px; border-radius: 999px; }
.tree-node .l1 { background: var(--coral-soft); color: #843b28; }
.tree-children { margin-left: 22px; border-left: 2px solid var(--line); padding-left: 14px; }

/* ---------- 卡片列表 ---------- */
.coupon-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.coupon-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: #fff; position: relative; }
.coupon-card .amt { font-size: 24px; color: var(--coral); font-weight: 500; }
.coupon-card .amt small { font-size: 13px; }
.coupon-card .rule { color: var(--muted); font-size: 11px; margin-top: 4px; }
.coupon-card .meta { display: flex; justify-content: space-between; margin-top: 12px; font-size: 10px; color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { display: flex; gap: 5px; overflow-x: auto; padding: 8px; }
  .admin-side p { display: none; }
  .admin-side a { width: auto; white-space: nowrap; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid, .config-grid { grid-template-columns: 1fr; }
  .coupon-list { grid-template-columns: 1fr; }
  .admin-main { padding: 14px; }
}

/* ===== 商品编辑弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(23, 59, 52, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-box {
  width: 440px; max-width: 92vw; max-height: 86vh; overflow: auto;
  background: #fffdf9; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid #dedbd2;
}
.modal-head h3 { margin: 0; color: #173b34; font-size: 17px; }
.modal-close {
  border: 0; background: transparent; color: #738078; font-size: 18px;
  cursor: pointer; padding: 4px 8px;
}
.modal-body { padding: 20px 22px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid #dedbd2;
}
.modal-body .field-row { margin-bottom: 14px; }
.modal-body .field-row:last-child { margin-bottom: 0; }
.modal-body .wide { width: 100%; box-sizing: border-box; }
.modal-body input, .modal-body select, .modal-body textarea {
  padding: 9px 12px; border: 1px solid #dedbd2; border-radius: 8px;
  font-size: 14px; color: #202924; background: #fff;
}
.modal-body textarea { resize: vertical; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: #202924; font-size: 14px; cursor: pointer; }
.f-label { width: 82px; flex-shrink: 0; color: #738078; font-size: 13px; }
