/* ==========================================================================
   站长后台 · 布局（左右分栏 + 可折叠菜单 + 多页签）
   只做布局与通用组件；颜色与主站保持同一套（slate + blue）
   ========================================================================== */
:root {
  --blue: #2563eb;
  --blue-weak: #eff6ff;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --side-w: 220px;
  --side-w-min: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: #f5f7fb;
  color: var(--slate-900);
  font-size: 14px;
}

/* ---------------- 外壳：左右两栏 ---------------- */
.vip-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}
.vip-shell.is-mini { grid-template-columns: var(--side-w-min) 1fr; }

/* ---------------- 左侧菜单 ---------------- */
.vip-side {
  background: #0b1220;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}
.side-logo {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.side-brand-text { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.side-brand-text b { color: #fff; font-size: 14px; white-space: nowrap; }
.side-brand-text i { font-style: normal; font-size: 11px; color: #7c8da6; white-space: nowrap; }

.side-menu { flex: 1 1 auto; overflow-y: auto; padding: 8px 8px 16px; }
.side-menu::-webkit-scrollbar { width: 8px; }
.side-menu::-webkit-scrollbar-thumb { background: #253046; border-radius: 8px; }

.menu-group { margin-bottom: 2px; }
.menu-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.menu-head:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.menu-head.has-active { color: #fff; }
.menu-ico { flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; opacity: .9; }
.menu-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.menu-text { flex: 1 1 auto; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-arrow { flex: 0 0 12px; font-size: 10px; color: #7c8da6; transition: transform .16s; }
.menu-group.is-open .menu-arrow { transform: rotate(90deg); }

.menu-items { list-style: none; margin: 2px 0 6px; padding: 0 0 0 6px; }
.menu-group:not(.is-open) .menu-items { display: none; }
.menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #a9b8cc;
  text-align: left;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-item:hover { background: rgba(148, 163, 184, .12); color: #fff; }
.menu-item.is-active { background: var(--blue); color: #fff; font-weight: 600; }
.menu-item .tag-mini { margin-left: 6px; font-size: 10px; opacity: .75; }

/* 折叠态：只留图标栏 */
.is-mini .side-brand { padding: 14px 0; justify-content: center; }
.is-mini .side-brand-text { display: none; }
.is-mini .menu-head { justify-content: center; padding: 10px 0; }
.is-mini .menu-text, .is-mini .menu-arrow { display: none; }
.is-mini .menu-group:not(.is-open) .menu-items { display: none; }
.is-mini .menu-items { padding-left: 0; }
.is-mini .menu-item { padding: 7px 4px; text-align: center; font-size: 11px; }
.is-mini .side-mini-text { display: none; }

.side-foot { border-top: 1px solid rgba(148, 163, 184, .16); padding: 8px; }
.side-mini {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(148, 163, 184, .1);
  color: #cbd5e1; border: 0; border-radius: 8px;
  padding: 8px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.side-mini:hover { background: rgba(148, 163, 184, .2); color: #fff; }
.is-mini .side-mini-icon { transform: rotate(180deg); }

/* ---------------- 右侧主区 ---------------- */
.vip-main { display: flex; flex-direction: column; min-width: 0; }
.vip-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  position: sticky; top: 0; z-index: 20;
}
.top-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.top-right { margin-left: auto; display: flex; gap: 8px; }
.site-name { font-weight: 700; }
.top-credit { font-size: 12.5px; color: var(--slate-500); }
.top-credit b { color: var(--blue); font-size: 14px; }
.pill {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--slate-100); color: var(--slate-700); border: 1px solid var(--slate-200);
}
.icon-btn {
  border: 1px solid var(--slate-200); background: #fff; border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px; line-height: 1;
}
.only-narrow { display: none; }

.crumb-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 0;
  font-size: 13px; color: var(--slate-500);
}
.crumb { font-weight: 600; color: var(--slate-700); }
.crumb .sep { color: var(--slate-300); margin: 0 6px; }
.grow { flex: 1 1 auto; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 多页签 */
.tabbar {
  display: flex; gap: 6px; align-items: center;
  padding: 10px 16px 0;
  overflow-x: auto;
}
.tabbar:empty { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px;
  background: #fff; border: 1px solid var(--slate-200); border-radius: 999px;
  font-size: 12.5px; color: var(--slate-700); cursor: pointer; white-space: nowrap;
}
.tab.is-active { background: var(--blue-weak); border-color: #bfdbfe; color: var(--blue); font-weight: 600; }
.tab-x { border: 0; background: transparent; color: inherit; opacity: .55; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }
.tab-x:hover { opacity: 1; }

.vip-view { padding: 14px 16px 40px; min-width: 0; }

/* ---------------- 通用组件 ---------------- */
.panel { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--slate-100); }
.panel-head h3 { margin: 0; font-size: 14.5px; }
.panel-head .muted { font-size: 12px; }
.panel-body { padding: 14px; }
.muted { color: var(--slate-500); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 14px; }
.stat .label { font-size: 12.5px; color: var(--slate-500); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat.accent .value { color: var(--blue); }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 9px; border: 1px solid var(--slate-300);
  background: #fff; color: var(--slate-700); font: inherit; font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #94a3b8; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.wait { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.badge.gray { background: var(--slate-100); color: var(--slate-500); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th, table.table td { padding: 9px 10px; border-bottom: 1px solid var(--slate-100); text-align: left; vertical-align: middle; }
table.table th { background: #f8fafc; color: var(--slate-500); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
table.table td.num, table.table th.num { text-align: right; }
table.table tbody tr:hover { background: #f8fafc; }

.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input, .select, textarea.input {
  padding: 7px 10px; border: 1px solid var(--slate-300); border-radius: 9px;
  font: inherit; font-size: 13px; background: #fff; color: var(--slate-900); min-width: 0;
}
.input:focus, .select:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }

.empty { padding: 22px 14px; text-align: center; color: var(--slate-500); font-size: 13px; }

/* 未建设 / 不支持的页面骨架 */
.skel-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; font-size: 13px; line-height: 1.7; }
.skel-note.stop { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.skel-list { margin: 12px 0 0; padding-left: 20px; color: var(--slate-700); font-size: 13px; line-height: 1.9; }
.skel-kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; margin-top: 12px; }
.skel-kv .k { color: var(--slate-500); }

/* 简易柱状图（不引第三方库） */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding: 6px 2px 0; }
.chart .col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart .bar-box { width: 100%; display: flex; align-items: flex-end; justify-content: center; height: 100%; }
.chart .bar-line { width: 70%; max-width: 26px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #60a5fa, #2563eb); min-height: 2px; }
.chart .cap { font-size: 11px; color: var(--slate-500); white-space: nowrap; }

/* 抽屉 / 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(720px, 100%); max-height: 86vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--slate-200); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--slate-200); display: flex; justify-content: flex-end; gap: 8px; }

/* 登录门 */
.login-mask { position: fixed; inset: 0; background: #0b1220; display: grid; place-items: center; z-index: 80; padding: 16px; }
/* 关键：hidden 属性必须真的隐藏（否则透明遮罩会吃掉整页点击） */
.login-mask[hidden] { display: none !important; }
.login-card { background: #fff; border-radius: 14px; padding: 22px; width: min(420px, 100%); display: grid; gap: 12px; }
.login-card h1 { margin: 0; font-size: 18px; }
.login-card .muted { margin: 0; font-size: 12.5px; }
.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--slate-700); }
.err { color: var(--bad); font-size: 12.5px; min-height: 16px; margin: 0; }

/* 轻提示 */
.toast-box { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 90; }
.toast-item { background: #0f172a; color: #f8fafc; padding: 9px 13px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); }
.toast-item.err { background: #b91c1c; }

/* ---------------- 窄屏 ---------------- */
@media (max-width: 900px) {
  .vip-shell { grid-template-columns: 1fr; }
  .vip-side {
    position: fixed; z-index: 40; left: 0; top: 0; height: 100vh; width: 240px;
    transform: translateX(-100%); transition: transform .18s ease;
  }
  .vip-shell.is-drawer .vip-side { transform: translateX(0); }
  .only-narrow { display: inline-flex; }
  .vip-view { padding: 12px 12px 32px; }
  .crumb-bar, .tabbar { padding-left: 12px; padding-right: 12px; }
  .skel-kv { grid-template-columns: 1fr; }
  .modal { width: 100%; }
}
