/* ==========================================
   QQ官机框架统计平台 - 全局样式（浅色主题）
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #1f2937; background: #f5f6fa; line-height: 1.6; min-height: 100vh;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 12.5px; }
.dim { color: #9ca3af; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ========== 登录页 ========== */
.auth-body { background: #f5f6fa; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: #fff; border-radius: 12px; padding: 36px; width: 100%; max-width: 380px; box-shadow: 0 2px 16px rgba(0,0,0,.06); }
.auth-title { font-size: 22px; font-weight: 700; text-align: center; color: #111827; margin-bottom: 4px; }
.auth-sub { text-align: center; color: #6b7280; font-size: 13px; margin-bottom: 24px; }
.auth-link { text-align: center; margin-top: 16px; font-size: 12px; color: #9ca3af; }

/* ========== 顶栏 ========== */
.topbar { display: flex; align-items: center; justify-content: space-between; background: #1e293b; color: #fff; padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 200; }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-toggle { display: none; background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; padding: 6px; line-height: 1; }
.topbar-brand { font-size: 16px; font-weight: 700; color: #fff; text-decoration: none; }
.topbar-badge { font-size: 11px; color: #93c5fd; border: 1px solid #334155; border-radius: 999px; padding: 1px 8px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: #cbd5e1; }
.topbar-link { color: #f87171; font-size: 13px; }

/* ========== 布局 ========== */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 210px; background: #16213e; color: #d1d5db; padding: 20px 0; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; flex-shrink: 0; transition: transform .25s ease; }
.sidebar-title { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 1px; padding: 0 20px 8px; font-weight: 700; }
.sidebar-menu { list-style: none; }
.sidebar-item a { display: block; padding: 10px 20px; color: #cbd5e1; font-size: 14px; border-left: 3px solid transparent; }
.sidebar-item a:hover { background: #1f2a4a; color: #fff; text-decoration: none; }
.sidebar-item a.active { background: #1e293b; color: #60a5fa; border-left-color: #60a5fa; font-weight: 600; }
.sidebar-footer { padding: 16px 20px; font-size: 12px; color: #64748b; border-top: 1px solid #2a3a5e; }
.main { flex: 1; padding: 24px 28px; min-width: 0; }
.sidebar-backdrop { display: none; }

@media (max-width: 820px) {
    .topbar-toggle { display: inline-block; }
    .sidebar { position: fixed; top: 56px; left: 0; z-index: 150; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.45); z-index: 140; }
    .sidebar-backdrop.show { display: block; }
    .main { padding: 18px 14px; }
}

/* ========== 标题 ========== */
.page-title { font-size: 22px; font-weight: 700; color: #111827; }
.page-subtitle { color: #6b7280; font-size: 13px; margin: 4px 0 20px; }

/* ========== 卡片 ========== */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 8px rgba(0,0,0,.05); margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; color: #111827; }
.card-desc { font-size: 13px; color: #6b7280; margin: 2px 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

/* ========== 统计卡 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.04); text-align: center; border-left: 4px solid #2563eb; }
.stat-card-ok { border-left-color: #16a34a; }
.stat-card-purple { border-left-color: #7c3aed; }
.stat-card-amber { border-left-color: #d97706; }
.stat-card-green { border-left-color: #16a34a; }
.stat-num { font-size: 28px; font-weight: 800; color: #111827; line-height: 1.2; }
.stat-label { font-size: 13px; color: #6b7280; margin-top: 2px; }
.stat-sub { color: #2563eb; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: #f9fafb; font-weight: 600; color: #6b7280; text-align: left; padding: 9px 10px; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
.data-table th small { font-weight: 500; color: #9ca3af; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table th a { color: inherit; text-decoration: none; }
.data-table th a:hover { color: #2563eb; }
.empty-msg { text-align: center; color: #9ca3af; padding: 28px 0; }
.cell-main { color: #111827; font-weight: 500; }
.cell-sub { color: #9ca3af; font-size: 12px; }

/* ========== 标签 / 徽章 ========== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-ok { background: #f0fdf4; color: #16a34a; }
.tag-warn { background: #fffbeb; color: #d97706; }
.tag-fail { background: #fef2f2; color: #dc2626; }
.ip-chip { display: inline-block; padding: 2px 7px; border-radius: 4px; background: #f1f5f9; color: #334155; font-size: 12px; }
.ip-chip.ip-private { background: #fff7ed; color: #c2410c; }

/* ========== 启动次数 ========== */
.boot-chip { display: inline-block; min-width: 34px; padding: 2px 8px; border-radius: 999px;
             background: #fff7ed; color: #c2410c; font-weight: 700; font-size: 12px; }
.cell-warn { font-weight: 700; }

/* ========== 进度条 ========== */
.bar-wrap { width: 96px; height: 6px; background: #eef2f7; border-radius: 3px; overflow: hidden; margin-bottom: 2px; }
.bar { height: 100%; background: #2563eb; border-radius: 3px; }
.bar-in { background: #2563eb; }
.bar-out { background: #7c3aed; }
.bar-text { font-size: 11px; color: #9ca3af; }

/* ========== 排名 ========== */
.rank { display: inline-block; min-width: 24px; text-align: center; padding: 1px 6px; border-radius: 5px; background: #f1f5f9; color: #64748b; font-size: 12px; font-weight: 700; }
.rank-top { background: #fef3c7; color: #b45309; }

/* ========== 筛选 / 切换 ========== */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar input[type=text] { width: 260px; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; font-family: inherit; }
.filter-bar select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; background: #fff; font-family: inherit; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.toolbar { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.range-bar { display: flex; gap: 6px; }
.range-chip { padding: 5px 14px; border-radius: 999px; background: #fff; border: 1px solid #e5e7eb; color: #6b7280; font-size: 13px; }
.range-chip:hover { border-color: #93c5fd; color: #2563eb; text-decoration: none; }
.range-chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ========== 按钮 ========== */
.btn { display: inline-block; padding: 8px 16px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; background: #fff; color: #374151; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; color: #fff; }
.btn-block { display: block; width: 100%; }

/* ========== 表单 ========== */
.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.field-group input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.field-group input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.field-group .hint { font-size: 12px; color: #6b7280; margin-top: 3px; }

/* ========== 提示条 ========== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert code { display: block; background: #f3f4f6; padding: 10px; border-radius: 6px; font-size: 12.5px; margin-top: 8px; word-break: break-all; }

/* ========== 分页 ========== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.page { display: inline-block; padding: 5px 11px; border-radius: 6px; font-size: 13px; background: #fff; border: 1px solid #e5e7eb; color: #374151; }
.page:hover { background: #f3f4f6; text-decoration: none; }
.page.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ========== 图表 ========== */
.chart { width: 100%; }
