/* 运营后台 · 手机优先（375px 基准），桌面自动放宽 */
:root {
  --bg: #f5f5f5;
  --card: #ffffff;
  --ink: #2c2c2c;
  --ink-2: #6b6b6b;
  --ink-3: #9e9e9e;
  --line: #ececec;
  --accent: #e8734a;
  --accent-weak: #fdefe9;
  --ok: #3f9d6a;
  --warn: #c9862a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05);
  --tap: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------------- 外壳 ---------------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 14px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.appbar .title { font-size: 16px; font-weight: 700; }
.appbar .sub { font-size: 11px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.appbar .right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: var(--tap); height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--ink-2); border-radius: 12px; font-size: 12px;
}

.navchips {
  display: flex; gap: 8px; padding: 10px 14px 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--bg);
}
.navchips::-webkit-scrollbar { display: none; }
.navchips a {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  height: 32px; padding: 0 12px; border-radius: 16px;
  background: #fff; color: var(--ink-2); font-size: 13px;
  border: 1px solid var(--line);
}
.navchips a.on { background: var(--accent-weak); color: var(--accent); border-color: transparent; font-weight: 600; }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 14px calc(84px + env(safe-area-inset-bottom));
}
.page-head { margin: 6px 2px 14px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* ---------------- 统计卡 ---------------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--ink-3); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.stat.wide { grid-column: 1 / -1; }

/* ---------------- 卡片与列表 ---------------- */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px;
}
.card + .card, .list + .card, .card + .list, .list + .list { margin-top: 12px; }

.list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 10px;
}
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-top .name { font-size: 15px; font-weight: 600; }
.row-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.row-kv {
  display: grid; grid-template-columns: auto 1fr auto 1fr;
  gap: 4px 8px; align-items: baseline;
  margin-top: 10px; font-size: 13px;
}
.row-kv span { color: var(--ink-3); font-size: 12px; }
.row-kv b { font-weight: 600; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row-actions .btn { flex: 1 1 calc(33% - 8px); min-width: 88px; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; background: #f3f3f3; color: var(--ink-2);
}
.tag-accent { background: var(--accent-weak); color: var(--accent); }
.tag-ok { background: #eaf5ef; color: var(--ok); }
.tag-mute { background: #f0f0f0; color: var(--ink-3); }
.tag-warn { background: #fdf3e3; color: var(--warn); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 14px; border-radius: 12px; border: 1px solid transparent;
  background: #f2f2f2; color: var(--ink); font-size: 14px; cursor: pointer;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-outline { background: #fff; border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fff; border-color: #e2b6a6; color: #b4552f; }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; font-size: 15px; color: var(--ink); background: #fff; outline: none;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters .field { flex: 1 1 46%; margin-bottom: 0; }

/* ---------------- 底部弹层 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,20,20,.38);
  display: none; z-index: 60;
}
.modal-mask.show { display: block; }
.modal {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 720px; margin: 0 auto;
  max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 32px rgba(0,0,0,.14);
  animation: sheet .18s ease-out;
}
@keyframes sheet { from { transform: translateY(12px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.close-x {
  position: absolute; top: 10px; right: 10px; width: var(--tap); height: var(--tap);
  border: 0; background: none; font-size: 20px; color: var(--ink-3); border-radius: 50%;
}

/* ---------------- 底部操作条 / 导航 ---------------- */
.has-sticky .tabbar { display: none; }
.has-sticky .main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.sticky-bar .grow { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.sticky-bar .btn { min-width: 132px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}
.tabbar a, .tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 56px; font-size: 11px; color: var(--ink-3);
  background: none; border: 0;
}
.tabbar .on { color: var(--accent); }
.tabbar svg { width: 20px; height: 20px; }

/* ---------------- 其它 ---------------- */
.flash { border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; background: #eaf5ef; color: var(--ok); }
.flash.error { background: var(--accent-weak); color: var(--accent); }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(8px);
  background: rgba(30,30,30,.92); color: #fff; font-size: 13px; padding: 10px 16px;
  border-radius: 10px; opacity: 0; transition: all .2s; z-index: 90; max-width: 84vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.muted { color: var(--ink-2); font-size: 13px; }
.muted-2 { color: var(--ink-3); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.center { text-align: center; }
.summary { background: #fafafa; border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.summary .kv { display: flex; justify-content: space-between; padding: 3px 0; }
.thumb { width: 100%; max-height: 190px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.section-title { font-size: 14px; font-weight: 600; margin: 18px 2px 8px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }

/* 桌面：放宽栅格，仍保持移动优先结构 */
@media (min-width: 820px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
  .stat.wide { grid-column: auto; }
  .navchips { justify-content: center; }
  .main { max-width: 960px; padding-bottom: 32px; }
  .row-actions .btn { flex: 0 0 auto; min-width: 96px; }
  .modal { border-radius: 18px; bottom: auto; top: 50%; transform: translateY(-50%); max-width: 520px; }
  .sticky-bar { position: static; border-top: 0; padding: 12px 0 0; background: none; backdrop-filter: none; }
  .tabbar { display: none; }
  .main { padding-bottom: 24px; }
}
