* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}
.container {
    max-width: 600px;
    width: 100%;
}
header {
    text-align: center;
    margin-bottom: 40px;
}
header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
header p {
    color: #64748b;
    margin-top: 8px;
    font-size: 14px;
}
.status-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    transition: all 0.3s;
}
.status-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}
.status-text {
    font-size: 14px;
    color: #94a3b8;
}
.data-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    border: 1px solid #334155;
    transition: all 0.3s;
}
.data-card.has-data {
    border-color: #3b82f6;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.1);
}
.data-value {
    font-size: 72px;
    font-weight: 800;
    color: #60a5fa;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s;
}
.data-value.pop {
    transform: scale(1.1);
    color: #a78bfa;
}
.data-time {
    font-size: 14px;
    color: #64748b;
    margin-top: 12px;
}
.data-label {
    font-size: 16px;
    color: #94a3b8;
    margin-bottom: 20px;
}
.history {
    margin-top: 30px;
}
.history h3 {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.history-list {
    background: #1e293b;
    border-radius: 12px;
    border: 1px solid #334155;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
}
.history-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.history-item:nth-child(odd) {
    background: #0f172a;
}
.history-item .h-time { color: #64748b; }
.history-item .h-val  { color: #60a5fa; font-weight: 600; }
.empty-msg {
    text-align: center;
    color: #475569;
    padding: 20px;
    font-size: 14px;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* ─── Header 顶部（标题+用户信息） ────────────── */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}
.user-name {
    font-size: 14px;
    color: #94a3b8;
}
.btn-logout {
    background: none;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.btn-test {
    background: none;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
    width: 100%;
}
.btn-test:hover {
    border-color: #60a5fa;
    color: #60a5fa;
}

/* ─── 登录弹窗 ────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.login-box {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 40px 32px 32px;
    width: 360px;
    max-width: 90vw;
}
.login-header {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    background: #0f172a;
    border-radius: 8px;
    padding: 3px;
}
.login-tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.login-tab.active {
    background: #1e293b;
    color: #e2e8f0;
    font-weight: 600;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.login-form input {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: #e2e8f0;
    outline: none;
    transition: border-color 0.2s;
}
.login-form input:focus {
    border-color: #60a5fa;
}
.login-form input::placeholder {
    color: #475569;
}
.login-form button {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s;
}
.login-form button:hover {
    opacity: 0.9;
}
.login-form button:active {
    opacity: 0.8;
}
.login-error {
    text-align: center;
    font-size: 13px;
    color: #ef4444;
    min-height: 20px;
    margin: 0;
}
