/* 轻养美学 · 平台运营工作台
   沿用小程序端设计系统：柔雾玫瑰 #C08A7D + 暖白中性 #F6F4F2，全站零 Emoji。 */

:root {
  --rose: #C08A7D;
  --rose-dark: #A97365;
  --rose-soft: #F5EAE6;
  --rose-line: #E8D5CF;

  --bg: #F6F4F2;
  --card: #FFFFFF;
  --line: #EAE4E0;
  --line-soft: #F2EDEA;

  --ink: #33302D;
  --ink-2: #6B6360;
  --ink-3: #9C9490;

  --ok: #4F7A63;
  --ok-soft: #EAF1EC;
  --warn: #B5613F;
  --warn-soft: #FBEEE8;
  --danger: #A8483C;
  --danger-soft: #F9EAE8;
  --info: #5A7290;
  --info-soft: #EBEFF5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(60, 50, 45, .04), 0 8px 22px rgba(60, 50, 45, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rose-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.boot { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.boot-inner { color: var(--ink-3); letter-spacing: .06em; }

/* ---------------- 骨架 ---------------- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 214px;
  flex: 0 0 214px;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-title { font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.brand-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; letter-spacing: .08em; }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--rose-soft); color: var(--rose-dark); font-weight: 600; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }

.side-foot {
  border-top: 1px solid var(--line-soft);
  padding: 12px 16px 16px;
  font-size: 12px;
  color: var(--ink-3);
}
.env-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.env-dot.on { background: var(--ok); }
.env-dot.off { background: var(--warn); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px;
  flex: 0 0 60px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: .02em; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-2); }

.content { padding: 22px 24px 48px; max-width: 1480px; width: 100%; }

/* ---------------- 通用组件 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.card-title small { font-weight: 400; color: var(--ink-3); margin-left: 8px; letter-spacing: 0; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 6px; letter-spacing: .01em; }
.stat-value .unit { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.stat-foot { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--rose-line); color: var(--rose-dark); background: #FDFBFA; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-primary:hover { background: var(--rose-dark); border-color: var(--rose-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #E9CFCB; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12px; }
.btn-text { border-color: transparent; background: transparent; padding: 0 6px; height: 26px; color: var(--rose-dark); }
.btn-text:hover { background: var(--rose-soft); border-color: transparent; }

.input, .select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus, .select:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(192, 138, 125, .12); }
.input::placeholder { color: var(--ink-3); }
.input-lg { height: 40px; font-size: 14px; width: 100%; }
.textarea { height: auto; padding: 8px 10px; width: 100%; font-family: inherit; resize: vertical; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filters .spacer { flex: 1; }

.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .02em; }
.field-label .req { color: var(--danger); margin-left: 3px; }
.field-hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* 表格 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  background: #FCFAF9;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: .03em;
}
table.tb td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tb tr:last-child td { border-bottom: none; }
table.tb tbody tr:hover { background: #FDFCFB; }
table.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb .mono { font-family: var(--mono); font-size: 12px; }
table.tb .nowrap { white-space: nowrap; }
table.tb .actions { white-space: nowrap; text-align: right; }

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-info { background: var(--info-soft); color: var(--info); }
.tag-mute { background: var(--line-soft); color: var(--ink-3); }
.tag-rose { background: var(--rose-soft); color: var(--rose-dark); }

.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-out { color: var(--danger); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty svg { width: 34px; height: 34px; opacity: .35; display: block; margin: 0 auto 10px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: 128px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-all; }

.section-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 20px 0 10px; letter-spacing: .04em; }

/* 状态条 / 提示 */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.notice svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.notice-warn { background: var(--warn-soft); color: #8C4A2E; border-color: #EFD6C6; }
.notice-info { background: var(--info-soft); color: #3F5878; border-color: #D8E1EE; }
.notice-ok { background: var(--ok-soft); color: #3B6149; border-color: #D3E4D8; }

/* ---------------- 登录页 ---------------- */

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%;
  max-width: 372px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(60, 50, 45, .04), 0 18px 44px rgba(60, 50, 45, .09);
  padding: 34px 32px 28px;
}
.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--rose-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--rose-dark);
}
.login-mark svg { width: 23px; height: 23px; }
.login-title { font-size: 19px; font-weight: 600; letter-spacing: .02em; }
.login-sub { font-size: 13px; color: var(--ink-3); margin: 6px 0 24px; letter-spacing: .02em; }

/* ---------------- 弹层 ---------------- */

.modal-host { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
/* 关键：display:flex 会覆盖 [hidden] 的 UA 默认 display:none，
   不加这条，弹层关闭时仍是一层透明全屏遮罩，会挡住整个页面的点击与输入 */
.modal-host[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(45, 38, 35, .34); backdrop-filter: blur(2px); }
.modal {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(45, 38, 35, .22);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: pop .16s ease-out;
}
.modal-lg { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
}
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 7px; cursor: pointer; color: var(--ink-3);
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

/* 提示条 */
.toast-host {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #38332F;
  color: #fff;
  padding: 9px 18px;
  border-radius: 22px;
  font-size: 13px;
  box-shadow: 0 8px 26px rgba(45, 38, 35, .26);
  animation: drop .18s ease-out;
  max-width: 76vw;
}
.toast-ok { background: #3F6B53; }
.toast-err { background: #9B4438; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 代码块 */
pre.code {
  background: #2E2A27;
  color: #E8E1DD;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .input { flex: 1; font-family: var(--mono); font-size: 12px; }

/* 进度条 */
.bar { height: 6px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--rose); border-radius: 4px; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--rose-line);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }
