/* ============================================================
   基础样式: 设计变量 / 重置 / 通用组件 / 文本语义色 / 轻提示 / 统计卡
   主题: 科技风 · 深空蓝(2026-11-12 全站 UI 重塑)
   - 语义色: 安全绿/警示橙/警告黄/危险红(霓虹化)
   - 兼容 login 独立页与 index SPA 壳
   - 注意: 选择器名与 JS 生成的类名强耦合, 只改视觉不改名
   ============================================================ */
:root {
    --bg: #04101f;
    --bg-2: #071a30;
    --bg-3: #0b2444;
    --bg-4: #0e2c52;
    --border: rgba(56, 189, 248, .22);
    --border-2: rgba(56, 189, 248, .45);
    --text: #dbeafe;
    --text-dim: #7da2c4;
    --text-faint: #4a6a8c;
    --primary: #22d3ee;       /* 电光青 */
    --primary-dark: #0ea5e9;
    --primary-2: #2563eb;     /* 科技蓝 */
    --grad: linear-gradient(135deg, #0ea5e9, #2563eb);
    --safe: #34d399;          /* 安全绿 */
    --warn: #fbbf24;          /* 警告黄 */
    --orange: #fb923c;        /* 警示橙 */
    --danger: #f87171;        /* 危险红 */
    --radius: 10px;
    --shadow: 0 10px 32px rgba(2, 12, 27, .55), 0 0 0 1px rgba(56, 189, 248, .08);
    --glow: 0 0 18px rgba(34, 211, 238, .14);
    --topbar-h: 52px;     /* 由 core.js syncTopbarH() 按实际高度回写 */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* 全站底纹: 网格 + 径向光晕(科技感基底) */
body {
    background:
        radial-gradient(1100px 460px at 82% -8%, rgba(37, 99, 235, .16), transparent 62%),
        radial-gradient(900px 420px at 6% 108%, rgba(14, 165, 233, .10), transparent 58%),
        repeating-linear-gradient(0deg, transparent 0 47px, rgba(56, 189, 248, .035) 47px 48px),
        repeating-linear-gradient(90deg, transparent 0 47px, rgba(56, 189, 248, .035) 47px 48px),
        linear-gradient(165deg, #051224 0%, var(--bg) 55%, #030b16 100%);
    background-attachment: fixed;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }

/* 超长单行文字滚动显示(跑马灯): host 单行溢出隐藏, nm 为内容块;
   JS refreshMarquee 测出溢出后加 .scroll 并把滚动距离写入 --marquee-dx, 循环平移、起止停顿;
   hover 暂停便于阅读; 减弱动效偏好下不播动画, 改手动横向滚动 */
.marquee-host { overflow: hidden; white-space: nowrap; }
.marquee-nm { display: inline-block; white-space: nowrap; }
.marquee-host.scroll .marquee-nm { animation: marquee-x 9s linear infinite; }
.marquee-host.scroll:hover .marquee-nm { animation-play-state: paused; }
@keyframes marquee-x {
    0%, 12%   { transform: translateX(0); }
    45%, 60%  { transform: translateX(var(--marquee-dx, 0px)); }
    93%, 100% { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
    .marquee-host.scroll { overflow-x: auto; }
    .marquee-host.scroll .marquee-nm { animation: none; }
}

/* ---------- 通用组件 ---------- */
.btn {
    display: inline-block;
    padding: 7px 15px;
    border: 1px solid var(--border-2);
    border-radius: 8px;
    background: rgba(34, 211, 238, .07);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    letter-spacing: .5px;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: rgba(34, 211, 238, .14); border-color: var(--primary); box-shadow: var(--glow); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: rgba(34, 211, 238, .07); border-color: var(--border-2); box-shadow: none; }
.btn-primary {
    background: var(--grad); border-color: transparent; color: #fff; font-weight: 600;
    box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
}
.btn-primary:hover { background: linear-gradient(135deg, #38bdf8, #3b82f6); box-shadow: 0 6px 22px rgba(37, 99, 235, .5); }
.btn-danger { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .5); color: var(--danger); }
.btn-danger:hover { background: rgba(248, 113, 113, .2); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; }

input, select, textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(4, 16, 31, .55);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, .16);
}
input[type="file"] { padding: 6px; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
select option { background: var(--bg-2); color: var(--text); }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--text-dim); font-size: 12.5px; letter-spacing: .5px; }

/* 面板/卡片: 玻璃拟态 + HUD 角括线(科技风标识) */
.card {
    background: linear-gradient(165deg, rgba(13, 42, 80, .72), rgba(8, 24, 46, .78));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
    padding: 16px 18px;
    margin-bottom: 16px;
    position: relative;
    box-shadow: 0 8px 28px rgba(2, 12, 27, .35);
}
.card::before, .card::after {
    content: "";
    position: absolute; width: 12px; height: 12px;
    border-color: var(--primary); border-style: solid; opacity: .7; pointer-events: none;
}
.card::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-radius: var(--radius) 0 0 0; }
.card::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-radius: 0 0 var(--radius) 0; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: 1.5px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(56, 189, 248, .12);
    text-align: left;
}
.table th {
    color: var(--text-dim); font-weight: 600; font-size: 11.5px; letter-spacing: 1.2px;
    background: rgba(14, 165, 233, .1); position: sticky; top: 0; z-index: 1;
}
.table tr:hover td { background: rgba(34, 211, 238, .05); }
.table .wrap { white-space: normal; word-break: break-all; }

/* 徽章 */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: .5px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-safe { background: rgba(52, 211, 153, .13); color: var(--safe); border-color: rgba(52, 211, 153, .35); }
.badge-warn { background: rgba(251, 191, 36, .13); color: var(--warn); border-color: rgba(251, 191, 36, .35); }
.badge-orange { background: rgba(251, 146, 60, .13); color: var(--orange); border-color: rgba(251, 146, 60, .35); }
.badge-danger { background: rgba(248, 113, 113, .14); color: var(--danger); border-color: rgba(248, 113, 113, .35); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-on { background: var(--safe); box-shadow: 0 0 8px rgba(52, 211, 153, .8); }
.dot-off { background: var(--text-faint); }

/* 文本语义色 */
.text-safe { color: var(--safe); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }

/* 固件版本语义色 */
.fw-ver-ok { color: var(--safe); font-weight: 600; }
.fw-ver-old { color: var(--text); }
.fw-ver-stale { color: var(--danger); font-weight: 600; }

/* 轻提示 */
.toast {
    position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 12px);
    background: rgba(10, 34, 66, .95); border: 1px solid var(--border-2);
    color: var(--text); padding: 9px 18px; border-radius: 8px;
    font-size: 13px; opacity: 0; transition: opacity .25s, transform .25s;
    z-index: 200; box-shadow: var(--shadow); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 后台统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
    background: linear-gradient(160deg, rgba(14, 44, 82, .8), rgba(8, 24, 46, .7));
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; text-align: center; position: relative; overflow: hidden;
}
.stat-card::after {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--grad);
}
.stat-val { font-size: 26px; font-weight: 700; color: #e0f2fe; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-dim); font-size: 11.5px; margin-top: 4px; letter-spacing: 1px; }
.stat-models { display: flex; flex-direction: column; gap: 8px; }
.stat-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stat-rank { width: 20px; color: var(--text-faint); text-align: right; flex: none; }
.stat-name { min-width: 200px; }
.stat-bar { flex: 1; height: 8px; background: rgba(4, 16, 31, .55); border-radius: 4px; overflow: hidden; }
.stat-bar-fill { display: block; height: 100%; background: var(--grad); border-radius: 4px; }
