/* 统计后台样式 —— 参考百度统计的浅色简洁布局 */
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Arial, sans-serif; background: #f5f6f8; color: #333; font-size: 14px; }
a { text-decoration: none; color: inherit; }

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

/* 侧边栏 */
.sidebar { width: 200px; background: #2b3a4b; color: #cdd6e0; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; }
.brand { padding: 18px 16px; font-size: 18px; font-weight: 700; color: #fff; line-height: 1.2; }
.brand small { display: block; font-size: 12px; font-weight: 400; color: #8aa0b6; margin-top: 2px; }
.sidebar nav { flex: 1; padding: 8px 0; }
.nav-item { display: block; padding: 12px 20px; color: #cdd6e0; border-left: 3px solid transparent; cursor: pointer; }
.nav-item:hover { background: #34465a; color: #fff; }
.nav-item.active { background: #34465a; color: #fff; border-left-color: #4a9bff; }
.side-foot { padding: 12px 16px; }
.ghost-btn { display: inline-block; padding: 6px 10px; background: #3a4d62; color: #cdd6e0; border-radius: 4px; font-size: 12px; margin-right: 6px; }
.ghost-btn:hover { background: #465a72; color: #fff; }

/* 主区 */
.main { margin-left: 200px; flex: 1; padding: 0 20px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; position: sticky; top: 0; background: #f5f6f8; z-index: 5; }
.topbar-title { font-size: 16px; font-weight: 600; }
.range label { margin-right: 12px; font-size: 13px; color: #666; }
.range input { padding: 5px 8px; border: 1px solid #d9dde3; border-radius: 4px; }

.content { margin-top: 8px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 卡片 */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.card { background: #fff; border: 1px solid #eaeef2; border-radius: 8px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card h3 { margin: 0 0 12px; font-size: 14px; color: #555; }
.card h4 { margin: 0 0 10px; font-size: 13px; color: #666; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 数字卡片 */
.stat { background: #fff; border: 1px solid #eaeef2; border-radius: 8px; padding: 16px; }
.stat .label { color: #888; font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; color: #2b3a4b; }
.stat .sub { font-size: 12px; color: #aaa; margin-top: 4px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #f0f2f5; }
th { color: #888; font-weight: 600; background: #fafbfc; }
tr:hover td { background: #f7f9fb; }
.url-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2a6fb0; cursor: pointer; }
.bar { display: inline-block; height: 8px; background: #4a9bff; border-radius: 4px; vertical-align: middle; margin-right: 6px; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-btn { padding: 6px 14px; border: 1px solid #d9dde3; background: #fff; border-radius: 4px; cursor: pointer; }
.tab-btn.active { background: #4a9bff; color: #fff; border-color: #4a9bff; }

/* 实时筛选 */
.filters { display: flex; align-items: center; gap: 8px; }
.filters select { padding: 4px 8px; border: 1px solid #d9dde3; border-radius: 4px; }
.hint { font-size: 12px; color: #aaa; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.alert-error { background: #fdecea; color: #c0392b; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #2b3a4b; }
.login-box { background: #fff; padding: 36px 40px; border-radius: 10px; width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.login-box h1 { margin: 0 0 4px; font-size: 22px; }
.login-sub { margin: 0 0 20px; color: #888; font-size: 13px; }
.login-box label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; }
.login-box input { width: 100%; padding: 10px; border: 1px solid #d9dde3; border-radius: 6px; margin-bottom: 16px; }
.login-box button { width: 100%; padding: 10px; background: #4a9bff; color: #fff; border: 0; border-radius: 6px; cursor: pointer; font-size: 15px; }
.login-box button:hover { background: #3a8bef; }

/* 图表降级表格容器 */
.fallback { font-size: 13px; color: #666; }
.fallback div { padding: 4px 0; }

/* 站点管理：新增表单 */
.site-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-add input { padding: 6px 10px; border: 1px solid #d9dde3; border-radius: 4px; min-width: 220px; }
.primary-btn { padding: 7px 16px; background: #4a9bff; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-size: 13px; }
.primary-btn:hover { background: #3a8bef; }

/* 站点管理：部署代码块 */
.code-block { background: #f7f8fa; border: 1px solid #e5e9ee; border-radius: 6px; padding: 12px 14px;
  font-family: Consolas, Monaco, "Courier New", monospace; font-size: 12.5px; line-height: 1.7;
  color: #2b3a4b; white-space: pre-wrap; word-break: break-all; margin: 0; overflow-x: auto; }

/* 行内操作按钮 */
.link-btn { background: none; border: 0; color: #4a9bff; cursor: pointer; font-size: 12px; padding: 0 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #c0392b; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag.on { background: #e8f6ef; color: #2fa36b; }
.tag.off { background: #f2f3f5; color: #999; }

@media (max-width: 860px) {
  .cards, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 140px; }
  .main { margin-left: 140px; }
}
