/* =============================================================
 * 迅测 · 账户 / 后台公共样式（会员中心 + 管理员后台）
 * 依赖 style.css 的 :root 设计令牌
 * ============================================================= */

/* ---------- 登录 / 注册 ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: radial-gradient(1200px 600px at 20% 0%, #ecfdf5 0%, transparent 55%), radial-gradient(1000px 500px at 90% 10%, #e0f2fe 0%, transparent 50%), var(--bg-body); }
.auth-card { width: 100%; max-width: 420px; background: var(--card-bg); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 40px 36px; box-shadow: var(--shadow-hover); }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.3rem; color: var(--text-main); margin-bottom: 6px; letter-spacing: -0.5px; }
.auth-logo .logo-icon { width: 38px; height: 38px; background: var(--primary-light); color: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.auth-title { font-size: 1.5rem; font-weight: 800; color: var(--text-main); letter-spacing: -0.5px; }
.auth-sub { font-size: 0.88rem; color: var(--text-muted); margin: 6px 0 26px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-main); margin-bottom: 7px; }
.form-input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); font-size: 0.95rem; outline: none; color: var(--text-main); background: #f8fafc; transition: all .15s; }
.form-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-light); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 5px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-main); cursor: pointer; user-select: none; }
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-error { font-size: 0.8rem; color: var(--c-red); margin-top: 6px; min-height: 18px; }
.btn-block { width: 100%; padding: 13px; border: none; border-radius: var(--radius-md); background: var(--primary); color: #fff; font-size: 0.98rem; font-weight: 700; cursor: pointer; transition: all .15s; }
.btn-block:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-block:disabled { opacity: .6; cursor: not-allowed; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 0.86rem; color: var(--text-muted); }
.auth-foot a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); text-decoration: none; font-size: 0.85rem; margin-bottom: 20px; }
.auth-back:hover { color: var(--primary); }

/* ---------- 后台布局（会员中心 + 管理后台共用） ---------- */
.app-layout { display: flex; min-height: 100vh; }
.app-sidebar { width: 248px; flex-shrink: 0; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.app-brand { display: flex; align-items: center; gap: 10px; padding: 22px 22px; border-bottom: 1px solid rgba(255,255,255,.08); font-weight: 700; font-size: 1.05rem; color: #fff; letter-spacing: -0.3px; }
.app-brand .logo-icon { width: 32px; height: 32px; background: rgba(16,185,129,.18); color: #34d399; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.app-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.app-nav .nav-sec { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: #64748b; padding: 14px 12px 6px; }
.app-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all .15s; cursor: pointer; }
.app-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-nav a.active { background: var(--primary); color: #fff; }
.app-sidebar .side-foot { padding: 16px 22px; border-top: 1px solid rgba(255,255,255,.08); font-size: 0.8rem; }
.app-sidebar .side-foot a { color: #94a3b8; text-decoration: none; display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.app-sidebar .side-foot a:hover { color: #fff; }
.app-main { flex: 1; min-width: 0; background: var(--bg-body); }
.app-topbar { background: #fff; border-bottom: 1px solid var(--border-subtle); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.app-topbar .crumb { font-size: 0.9rem; color: var(--text-muted); }
.app-topbar .crumb b { color: var(--text-main); font-weight: 600; }
.app-topbar .user { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; color: var(--text-main); }
.app-topbar .user .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.app-content { padding: 28px 32px; max-width: 1280px; }

.page-title { font-size: 1.35rem; font-weight: 800; color: var(--text-main); letter-spacing: -0.4px; margin-bottom: 4px; }
.page-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 24px; }

.card { background: var(--card-bg); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 0.98rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 22px; }

/* 通用按钮 */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 8px; border: 1px solid var(--border-subtle); background: #fff; color: var(--text-main); font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: #fff; border-color: #fecaca; color: #dc2626; }
.btn.danger:hover { background: #fef2f2; border-color: #dc2626; }
.btn.sm { padding: 6px 12px; font-size: 0.8rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 表单行 */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.one { grid-template-columns: 1fr; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.select-input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-subtle); border-radius: var(--radius-md); font-size: 0.95rem; outline: none; background: #fff; color: var(--text-main); }
.select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }

/* 复选框组（节点多选） */
.check-group { display: flex; flex-wrap: wrap; gap: 10px; }
.check-group label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--border-subtle); border-radius: 8px; font-size: 0.85rem; cursor: pointer; color: var(--text-main); transition: all .12s; }
.check-group label:hover { border-color: var(--primary); }
.check-group label.checked { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.check-group input { display: none; }

/* 状态徽章 */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; line-height: 1.2; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.up { background: #ecfdf5; color: #059669; }
.pill.down { background: #fef2f2; color: #dc2626; }
.pill.on { background: var(--primary-light); color: var(--primary); }
.pill.off { background: #f1f5f9; color: #64748b; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.pending { background: #f1f5f9; color: #64748b; }

/* 空状态 / 加载 */
.empty { text-align: center; color: var(--text-muted); padding: 44px 20px; font-size: 0.9rem; }
.empty i { font-size: 2rem; color: var(--border-subtle); display: block; margin-bottom: 12px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 999; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { width: 100%; max-width: 560px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { border: none; background: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { color: var(--text-main); background: #f1f5f9; }
.modal-body { padding: 22px 24px; }

/* 概览统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.stat-card .k { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.stat-card .v { font-size: 1.8rem; font-weight: 800; color: var(--text-main); margin-top: 6px; letter-spacing: -0.5px; }
.stat-card .v em { font-style: normal; font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ---------- 站点监控 · 精简表格 ---------- */
.monitor-table { table-layout: fixed; }
.monitor-table th, .monitor-table td { padding-top: 10px; padding-bottom: 10px; }
.monitor-table th:nth-child(1), .monitor-table td:nth-child(1) { width: 16%; }
.monitor-table th:nth-child(2), .monitor-table td:nth-child(2) { width: 30%; }
.monitor-table th:nth-child(3), .monitor-table td:nth-child(3) { width: 14%; }
.monitor-table th:nth-child(4), .monitor-table td:nth-child(4) { width: 20%; }
.monitor-table th:nth-child(5), .monitor-table td:nth-child(5) { width: 20%; }
.monitor-table th:nth-child(6), .monitor-table td:nth-child(6) { width: 220px; min-width: 220px; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.td-name { font-weight: 600; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-target { font-family: 'Inter', monospace; font-size: 0.86rem; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-node { font-size: 0.82rem; color: var(--text-muted); }
.avail-wrap { display: flex; align-items: center; gap: 8px; }
.avail-bar { width: 120px; flex-shrink: 0; height: 8px; background: var(--border-subtle); border-radius: 999px; overflow: hidden; }
.avail-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #34d399); border-radius: 999px; }
.avail-bar > i.warn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.avail-pct { width: 56px; min-width: 56px; text-align: right; font-weight: 700; color: var(--text-main); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ops-row { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; justify-content: center; }
.btn.ic { padding: 6px 9px; flex-shrink: 0; }

/* 探测历史 / 告警日志弹窗表格列宽（覆盖 node-table 默认 10 列定义，防止文本挤压重叠） */
.checks-table th:nth-child(1), .checks-table td:nth-child(1) { width: 16%; }
.checks-table th:nth-child(2), .checks-table td:nth-child(2) { width: 11%; }
.checks-table th:nth-child(3), .checks-table td:nth-child(3) { width: 11%; }
.checks-table th:nth-child(4), .checks-table td:nth-child(4) { width: 9%; }
.checks-table th:nth-child(5), .checks-table td:nth-child(5) { width: 27%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks-table th:nth-child(6), .checks-table td:nth-child(6) { width: 26%; white-space: nowrap; }
.alerts-table th:nth-child(1), .alerts-table td:nth-child(1) { width: 12%; }
.alerts-table th:nth-child(2), .alerts-table td:nth-child(2) { width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alerts-table th:nth-child(3), .alerts-table td:nth-child(3) { width: 30%; white-space: nowrap; }

/* 概览 · 最近监控列表 */
.recent-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.recent-item:last-child { border-bottom: none; }
.ri-main { min-width: 0; }
.ri-name { font-weight: 600; color: var(--text-main); font-size: 0.92rem; }
.ri-target { font-family: 'Inter', monospace; font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-right { display: flex; align-items: center; justify-content: flex-end; gap: 16px; flex-shrink: 0; }
.ri-right .pill { width: 80px; min-width: 80px; justify-content: center; }
.ri-avail { font-weight: 700; font-size: 0.9rem; color: var(--primary); font-variant-numeric: tabular-nums; width: 60px; min-width: 60px; text-align: right; }

/* 告警日志 · 筛选与分页 */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 10px; }
.alerts-log-table { table-layout: fixed; }
.alerts-log-table th:nth-child(1), .alerts-log-table td:nth-child(1) { width: 160px; }
.alerts-log-table th:nth-child(2), .alerts-log-table td:nth-child(2) { width: 220px; }
.alerts-log-table th:nth-child(3), .alerts-log-table td:nth-child(3) { width: 90px; }
.alerts-log-table th:nth-child(4), .alerts-log-table td:nth-child(4) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 960px) {
    .app-layout { flex-direction: column; }
    .app-sidebar { width: 100%; height: auto; position: static; }
    .app-nav { flex-direction: row; overflow-x: auto; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .app-content { padding: 20px 16px; }
}
